Commit f6bcac3f authored by Matt Liggett's avatar Matt Liggett

Add version and flag info to apiserver and CM logs.

Should help debugging. Specifically for #45706
parent 88add574
...@@ -104,6 +104,9 @@ cluster's shared state through which all other components interact.`, ...@@ -104,6 +104,9 @@ cluster's shared state through which all other components interact.`,
// Run runs the specified APIServer. This should never exit. // Run runs the specified APIServer. This should never exit.
func Run(runOptions *options.ServerRunOptions, stopCh <-chan struct{}) error { func Run(runOptions *options.ServerRunOptions, stopCh <-chan struct{}) error {
// To help debugging, immediately log version
glog.Infof("Version: %+v", version.Get())
nodeTunneler, proxyTransport, err := CreateNodeDialer(runOptions) nodeTunneler, proxyTransport, err := CreateNodeDialer(runOptions)
if err != nil { if err != nil {
return err return err
......
...@@ -57,6 +57,7 @@ import ( ...@@ -57,6 +57,7 @@ import (
serviceaccountcontroller "k8s.io/kubernetes/pkg/controller/serviceaccount" serviceaccountcontroller "k8s.io/kubernetes/pkg/controller/serviceaccount"
"k8s.io/kubernetes/pkg/serviceaccount" "k8s.io/kubernetes/pkg/serviceaccount"
"k8s.io/kubernetes/pkg/util/configz" "k8s.io/kubernetes/pkg/util/configz"
"k8s.io/kubernetes/pkg/version"
"github.com/golang/glog" "github.com/golang/glog"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
...@@ -102,6 +103,8 @@ func ResyncPeriod(s *options.CMServer) func() time.Duration { ...@@ -102,6 +103,8 @@ func ResyncPeriod(s *options.CMServer) func() time.Duration {
// Run runs the CMServer. This should never exit. // Run runs the CMServer. This should never exit.
func Run(s *options.CMServer) error { func Run(s *options.CMServer) error {
// To help debugging, immediately log version
glog.Infof("Version: %+v", version.Get())
if err := s.Validate(KnownControllers(), ControllersDisabledByDefault.List()); err != nil { if err := s.Validate(KnownControllers(), ControllersDisabledByDefault.List()); err != nil {
return err return err
} }
......
...@@ -43,9 +43,12 @@ func WarnWordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedNam ...@@ -43,9 +43,12 @@ func WarnWordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedNam
return pflag.NormalizedName(name) return pflag.NormalizedName(name)
} }
// InitFlags normalizes and parses the command line flags // InitFlags normalizes, parses, then logs the command line flags
func InitFlags() { func InitFlags() {
pflag.CommandLine.SetNormalizeFunc(WordSepNormalizeFunc) pflag.CommandLine.SetNormalizeFunc(WordSepNormalizeFunc)
pflag.CommandLine.AddGoFlagSet(goflag.CommandLine) pflag.CommandLine.AddGoFlagSet(goflag.CommandLine)
pflag.Parse() pflag.Parse()
pflag.VisitAll(func(flag *pflag.Flag) {
glog.Infof("FLAG: --%s=%q", flag.Name, flag.Value)
})
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment