Skip to content

Commit

Permalink
Merge pull request #1250 from aledbf/server-version
Browse files Browse the repository at this point in the history
Add server information to controller startup
  • Loading branch information
aledbf authored Aug 28, 2017
2 parents d6efc29 + 6c5ee05 commit a8bfdc2
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion core/pkg/ingress/controller/launch.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"net/http"
"net/http/pprof"
"os"
"strings"
"syscall"
"time"

Expand Down Expand Up @@ -122,6 +123,9 @@ func NewIngressController(backend ingress.Controller) *GenericController {

_, err = k8s.IsValidService(kubeClient, *defaultSvc)
if err != nil {
if strings.Contains(err.Error(), "cannot get services in the namespace") {
glog.Fatalf("✖ It seems the cluster it is running with Authorization enabled (like RBAC) and there is no permissions for the ingress controller. Please check the configuration")
}
glog.Fatalf("no service with name %v found: %v", *defaultSvc, err)
}
glog.Infof("validated %v as the default backend", *defaultSvc)
Expand All @@ -143,6 +147,7 @@ func NewIngressController(backend ingress.Controller) *GenericController {
glog.Infof("service %v validated as source of Ingress status", *publishSvc)
}
}

if *watchNamespace != "" {

_, err = k8s.IsValidNamespace(kubeClient, *watchNamespace)
Expand Down Expand Up @@ -270,13 +275,21 @@ func createApiserverClient(apiserverHost string, kubeConfig string) (*kubernetes
cfg.Burst = defaultBurst
cfg.ContentType = "application/vnd.kubernetes.protobuf"

glog.Infof("Creating API server client for %s", cfg.Host)
glog.Infof("Creating API client for %s", cfg.Host)

client, err := kubernetes.NewForConfig(cfg)
if err != nil {
return nil, err
}

v, err := client.Discovery().ServerVersion()
if err != nil {
return nil, err
}

glog.Infof("Running in Kubernetes Cluster version v%v.%v (%v) - git (%v) commit %v - platform %v",
v.Major, v.Minor, v.GitVersion, v.GitTreeState, v.GitCommit, v.Platform)

return client, nil
}

Expand Down

0 comments on commit a8bfdc2

Please sign in to comment.