From d2d21facc1f1569c1bd0a5c08e79e376ce182426 Mon Sep 17 00:00:00 2001 From: haoyun Date: Wed, 8 Dec 2021 12:02:43 +0800 Subject: [PATCH] cleanup: remove insecure flag Signed-off-by: haoyun --- cmd/kube-scheduler/app/options/deprecated.go | 32 -------------------- cmd/kube-scheduler/app/options/options.go | 1 - 2 files changed, 33 deletions(-) diff --git a/cmd/kube-scheduler/app/options/deprecated.go b/cmd/kube-scheduler/app/options/deprecated.go index 279ed422c2f..6693655d08e 100644 --- a/cmd/kube-scheduler/app/options/deprecated.go +++ b/cmd/kube-scheduler/app/options/deprecated.go @@ -17,11 +17,7 @@ limitations under the License. package options import ( - "fmt" - "net" - "github.com/spf13/pflag" - "k8s.io/apimachinery/pkg/util/validation/field" componentbaseconfig "k8s.io/component-base/config" ) @@ -32,21 +28,6 @@ type DeprecatedOptions struct { componentbaseconfig.ClientConnectionConfiguration // Note that only the deprecated options (lock-object-name and lock-object-namespace) are populated here. componentbaseconfig.LeaderElectionConfiguration - - Port int -} - -// TODO: remove these insecure flags in v1.24 -func addDummyInsecureFlags(o *DeprecatedOptions, fs *pflag.FlagSet) { - var ( - bindAddr = net.IPv4(127, 0, 0, 1) - ) - fs.IPVar(&bindAddr, "address", bindAddr, - "The IP address on which to serve the insecure --port (set to 0.0.0.0 for all IPv4 interfaces and :: for all IPv6 interfaces).") - fs.MarkDeprecated("address", "This flag has no effect now and will be removed in v1.24. You can use --bind-address instead.") - - fs.IntVar(&o.Port, "port", o.Port, "The port on which to serve unsecured, unauthenticated access. Set to 0 to disable.") - fs.MarkDeprecated("port", "This flag has no effect now and will be removed in v1.24. You can use --secure-port instead.") } // AddFlags adds flags for the deprecated options. @@ -55,8 +36,6 @@ func (o *DeprecatedOptions) AddFlags(fs *pflag.FlagSet) { return } - addDummyInsecureFlags(o, fs) - fs.BoolVar(&o.EnableProfiling, "profiling", true, "DEPRECATED: enable profiling via web interface host:port/debug/pprof/. This parameter is ignored if a config file is specified in --config.") fs.BoolVar(&o.EnableContentionProfiling, "contention-profiling", true, "DEPRECATED: enable lock contention profiling, if profiling is enabled. This parameter is ignored if a config file is specified in --config.") fs.StringVar(&o.Kubeconfig, "kubeconfig", "", "DEPRECATED: path to kubeconfig file with authorization and master location information. This parameter is ignored if a config file is specified in --config.") @@ -66,14 +45,3 @@ func (o *DeprecatedOptions) AddFlags(fs *pflag.FlagSet) { fs.StringVar(&o.ResourceNamespace, "lock-object-namespace", "kube-system", "DEPRECATED: define the namespace of the lock object. Will be removed in favor of leader-elect-resource-namespace. This parameter is ignored if a config file is specified in --config.") fs.StringVar(&o.ResourceName, "lock-object-name", "kube-scheduler", "DEPRECATED: define the name of the lock object. Will be removed in favor of leader-elect-resource-name. This parameter is ignored if a config file is specified in --config.") } - -// Validate validates the deprecated scheduler options. -func (o *DeprecatedOptions) Validate() []error { - var errs []error - - // TODO: delete this check after insecure flags removed in v1.24 - if o.Port != 0 { - errs = append(errs, field.Required(field.NewPath("port"), fmt.Sprintf("invalid port value %d: only zero is allowed", o.Port))) - } - return errs -} diff --git a/cmd/kube-scheduler/app/options/options.go b/cmd/kube-scheduler/app/options/options.go index 347842d23d0..ab313266f60 100644 --- a/cmd/kube-scheduler/app/options/options.go +++ b/cmd/kube-scheduler/app/options/options.go @@ -244,7 +244,6 @@ func (o *Options) Validate() []error { errs = append(errs, o.SecureServing.Validate()...) errs = append(errs, o.Authentication.Validate()...) errs = append(errs, o.Authorization.Validate()...) - errs = append(errs, o.Deprecated.Validate()...) errs = append(errs, o.Metrics.Validate()...) return errs