From 3c907b33e1c1ea93ac2f5caf9fc4f30c9e5c47d3 Mon Sep 17 00:00:00 2001 From: gmarek Date: Thu, 13 Aug 2015 13:23:49 +0200 Subject: [PATCH] Remove external function setting Kubelet flags --- cmd/kube-apiserver/app/server.go | 8 +++++++- pkg/client/unversioned/flags.go | 9 --------- pkg/client/unversioned/flags_test.go | 9 --------- 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/cmd/kube-apiserver/app/server.go b/cmd/kube-apiserver/app/server.go index 135e42846ce..fe61bbc4f63 100644 --- a/cmd/kube-apiserver/app/server.go +++ b/cmd/kube-apiserver/app/server.go @@ -210,7 +210,6 @@ func (s *APIServer) AddFlags(fs *pflag.FlagSet) { fs.MarkDeprecated("service-node-ports", "see --service-node-port-range instead.") fs.StringVar(&s.MasterServiceNamespace, "master-service-namespace", s.MasterServiceNamespace, "The namespace from which the kubernetes master services should be injected into pods") fs.Var(&s.RuntimeConfig, "runtime-config", "A set of key=value pairs that describe runtime configuration that may be passed to the apiserver. api/ key can be used to turn on/off specific api versions. api/all and api/legacy are special keys to control all and legacy api versions respectively.") - client.BindKubeletClientConfigFlags(fs, &s.KubeletConfig) fs.StringVar(&s.ClusterName, "cluster-name", s.ClusterName, "The instance prefix for the cluster") fs.BoolVar(&s.EnableProfiling, "profiling", true, "Enable profiling via web interface host:port/debug/pprof/") fs.StringVar(&s.ExternalHost, "external-hostname", "", "The hostname to use when generating externalized URLs for this master (e.g. Swagger API Docs.)") @@ -220,6 +219,13 @@ func (s *APIServer) AddFlags(fs *pflag.FlagSet) { fs.StringVar(&s.SSHUser, "ssh-user", "", "If non-empty, use secure SSH proxy to the nodes, using this user name") fs.StringVar(&s.SSHKeyfile, "ssh-keyfile", "", "If non-empty, use secure SSH proxy to the nodes, using this user keyfile") fs.Int64Var(&s.MaxConnectionBytesPerSec, "max-connection-bytes-per-sec", 0, "If non-zero, throttle each user connection to this number of bytes/sec. Currently only applies to long-running requests") + // Kubelet related flags: + fs.BoolVar(&s.KubeletConfig.EnableHttps, "kubelet-https", s.KubeletConfig.EnableHttps, "Use https for kubelet connections") + fs.UintVar(&s.KubeletConfig.Port, "kubelet-port", s.KubeletConfig.Port, "Kubelet port") + fs.DurationVar(&s.KubeletConfig.HTTPTimeout, "kubelet-timeout", s.KubeletConfig.HTTPTimeout, "Timeout for kubelet operations") + fs.StringVar(&s.KubeletConfig.CertFile, "kubelet-client-certificate", s.KubeletConfig.CertFile, "Path to a client key file for TLS.") + fs.StringVar(&s.KubeletConfig.KeyFile, "kubelet-client-key", s.KubeletConfig.KeyFile, "Path to a client key file for TLS.") + fs.StringVar(&s.KubeletConfig.CAFile, "kubelet-certificate-authority", s.KubeletConfig.CAFile, "Path to a cert. file for the certificate authority.") } // TODO: Longer term we should read this from some config store, rather than a flag. diff --git a/pkg/client/unversioned/flags.go b/pkg/client/unversioned/flags.go index ccee1ada55e..9fc540cfbda 100644 --- a/pkg/client/unversioned/flags.go +++ b/pkg/client/unversioned/flags.go @@ -29,12 +29,3 @@ type FlagSet interface { DurationVar(p *time.Duration, name string, value time.Duration, usage string) IntVar(p *int, name string, value int, usage string) } - -func BindKubeletClientConfigFlags(flags FlagSet, config *KubeletConfig) { - flags.BoolVar(&config.EnableHttps, "kubelet-https", config.EnableHttps, "Use https for kubelet connections") - flags.UintVar(&config.Port, "kubelet-port", config.Port, "Kubelet port") - flags.DurationVar(&config.HTTPTimeout, "kubelet-timeout", config.HTTPTimeout, "Timeout for kubelet operations") - flags.StringVar(&config.CertFile, "kubelet-client-certificate", config.CertFile, "Path to a client key file for TLS.") - flags.StringVar(&config.KeyFile, "kubelet-client-key", config.KeyFile, "Path to a client key file for TLS.") - flags.StringVar(&config.CAFile, "kubelet-certificate-authority", config.CAFile, "Path to a cert. file for the certificate authority.") -} diff --git a/pkg/client/unversioned/flags_test.go b/pkg/client/unversioned/flags_test.go index a450c722c14..ea8da3546db 100644 --- a/pkg/client/unversioned/flags_test.go +++ b/pkg/client/unversioned/flags_test.go @@ -77,12 +77,3 @@ func (f *fakeFlagSet) IntVar(p *int, name string, value int, usage string) { } f.set.Insert(name) } - -func TestBindKubeletClientConfigFlags(t *testing.T) { - flags := &fakeFlagSet{t, util.StringSet{}} - config := &KubeletConfig{} - BindKubeletClientConfigFlags(flags, config) - if len(flags.set) != 6 { - t.Errorf("unexpected flag set: %#v", flags) - } -}