Skip to content

Commit

Permalink
feat: attempt to add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
metacosm committed Jan 23, 2020
1 parent 92ef31e commit 4b4c487
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/kubedb-capability/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,18 @@ import (
"halkyon.io/kubedb-capability/pkg/plugin/mysql"
"halkyon.io/kubedb-capability/pkg/plugin/postgresql"
plugins "halkyon.io/operator-framework/plugins/capability"
"log"
"os"
"path/filepath"
)

func main() {
pluginName := filepath.Base(os.Args[0])
f, err := os.OpenFile(pluginName+".log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0644)
if err != nil {
log.Fatalf("error opening file: %v", err)
}
log.SetOutput(f)

plugins.StartPluginServerFor(postgresql.NewPluginResource(), mysql.NewPluginResource(), mongodb.NewPluginResource())
}
5 changes: 5 additions & 0 deletions pkg/plugin/postgresql/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ import (
"halkyon.io/operator-framework/plugins/capability"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kubedbv1 "kubedb.dev/apimachinery/apis/kubedb/v1alpha1"
"log"
)

var _ capability.PluginResource = &PostgresPluginResource{}

func NewPluginResource() capability.PluginResource {
log.Println("Starting Postgres support")
list, err := plugin.Client.PostgresVersions().List(v1.ListOptions{})
if err != nil {
log.Printf("error retrieving versions: %v", err)
}
versions := []string{}
if err == nil {
versions = make([]string, 0, len(list.Items))
Expand Down

0 comments on commit 4b4c487

Please sign in to comment.