// Validate ensures that the insecure port values within the range of the port.
func(s*InsecureServingOptions)Validate()[]error{
errors:=[]error{}
ifs==nil{
returnnil
}
errors:=[]error{}
ifs.BindPort<0||s.BindPort>32767{
errors=append(errors,fmt.Errorf("--insecure-port %v must be between 0 and 32767, inclusive. 0 for turning off insecure (HTTP) port",s.BindPort))
}
...
...
@@ -64,10 +61,20 @@ func (s *InsecureServingOptions) AddFlags(fs *pflag.FlagSet) {
ifs==nil{
return
}
}
fs.IPVar(&s.BindAddress,"address",s.BindAddress,"DEPRECATED: the IP address on which to listen for the --port port (set to 0.0.0.0 for all IPv4 interfaces and :: for all IPv6 interfaces). See --bind-address instead.")
// AddDeprecatedFlags adds deprecated flags related to insecure serving for controller manager to the specified FlagSet.
// TODO: remove it until kops stop using `--address`
"DEPRECATED: the IP address on which to listen for the --port port. See --bind-address instead.")
// MarkDeprecated hides the flag from the help. We don't want that:
// fs.MarkDeprecated("address", "see --bind-address instead.")
fs.IntVar(&s.BindPort,"port",s.BindPort,"DEPRECATED: the port on which to serve HTTP insecurely without authentication and authorization. If 0, don't serve HTTPS at all. See --secure-port instead.")
// MarkDeprecated hides the flag from the help. We don't want that:
// fs.MarkDeprecated("port", "see --secure-port instead.")
...
...
@@ -75,7 +82,7 @@ func (s *InsecureServingOptions) AddFlags(fs *pflag.FlagSet) {
// ApplyTo adds InsecureServingOptions to the insecureserverinfo amd kube-controller manager configuration.
// Note: the double pointer allows to set the *InsecureServingInfo to nil without referencing the struct hosting this pointer.
// TODO: unify deprecation mechanism, string prefix or MarkDeprecated (the latter hides the flag. We also don't want that).
fs.StringVar(&o.AlgorithmProvider,"algorithm-provider",o.AlgorithmProvider,"DEPRECATED: the scheduling algorithm provider to use, one of: "+factory.ListAlgorithmProviders())
fs.StringVar(&o.PolicyConfigFile,"policy-config-file",o.PolicyConfigFile,"DEPRECATED: file with scheduler policy configuration. This file is used if policy ConfigMap is not provided or --use-legacy-policy-config=true")
usage:=fmt.Sprintf("DEPRECATED: name of the ConfigMap object that contains scheduler's policy configuration. It must exist in the system namespace before scheduler initialization if --use-legacy-policy-config=false. The config must be provided as the value of an element in 'Data' map with the key='%v'",componentconfig.SchedulerPolicyConfigMapKey)
fs.StringVar(&o.PolicyConfigMapNamespace,"policy-configmap-namespace",o.PolicyConfigMapNamespace,"DEPRECATED: the namespace where policy ConfigMap is located. The kube-system namespace will be used if this is not provided or is empty.")
fs.BoolVar(&o.UseLegacyPolicyConfig,"use-legacy-policy-config",o.UseLegacyPolicyConfig,"DEPRECATED: when set to true, scheduler will ignore policy ConfigMap and uses policy config file")
fs.BoolVar(&cfg.EnableProfiling,"profiling",cfg.EnableProfiling,"DEPRECATED: enable profiling via web interface host:port/debug/pprof/")
fs.BoolVar(&cfg.EnableContentionProfiling,"contention-profiling",cfg.EnableContentionProfiling,"DEPRECATED: enable lock contention profiling, if profiling is enabled")
fs.StringVar(&cfg.ClientConnection.KubeConfigFile,"kubeconfig",cfg.ClientConnection.KubeConfigFile,"DEPRECATED: path to kubeconfig file with authorization and master location information.")
fs.StringVar(&cfg.ClientConnection.ContentType,"kube-api-content-type",cfg.ClientConnection.ContentType,"DEPRECATED: content type of requests sent to apiserver.")
fs.Float32Var(&cfg.ClientConnection.QPS,"kube-api-qps",cfg.ClientConnection.QPS,"DEPRECATED: QPS to use while talking with kubernetes apiserver")
fs.Int32Var(&cfg.ClientConnection.Burst,"kube-api-burst",cfg.ClientConnection.Burst,"DEPRECATED: burst to use while talking with kubernetes apiserver")
fs.StringVar(&cfg.SchedulerName,"scheduler-name",cfg.SchedulerName,"DEPRECATED: name of the scheduler, used to select which pods will be processed by this scheduler, based on pod's \"spec.schedulerName\".")
fs.StringVar(&cfg.LeaderElection.LockObjectNamespace,"lock-object-namespace",cfg.LeaderElection.LockObjectNamespace,"DEPRECATED: define the namespace of the lock object.")
fs.StringVar(&cfg.LeaderElection.LockObjectName,"lock-object-name",cfg.LeaderElection.LockObjectName,"DEPRECATED: define the name of the lock object.")
"RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling affinity rule corresponding "+
"to every RequiredDuringScheduling affinity rule. --hard-pod-affinity-symmetric-weight represents the weight of implicit PreferredDuringScheduling affinity rule.")
fs.MarkDeprecated("hard-pod-affinity-symmetric-weight","This option was moved to the policy configuration file")
fs.StringVar(&cfg.FailureDomains,"failure-domains",cfg.FailureDomains,"Indicate the \"all topologies\" set for an empty topologyKey when it's used for PreferredDuringScheduling pod anti-affinity.")
fs.MarkDeprecated("failure-domains","Doesn't have any effect. Will be removed in future version.")
}
// Validate validates the deprecated scheduler options.
func(o*DeprecatedOptions)Validate()[]error{
ifo!=nil{
returnnil
}
returnnil
}
// ApplyTo sets cfg.AlgorithmSource from flags passed on the command line in the following precedence order:
//
// 1. --use-legacy-policy-config to use a policy file.
// 2. --policy-configmap to use a policy config map value.
// 3. --algorithm-provider to use a named algorithm provider.
fs.StringVar(&o.BindAddress,"address",o.BindAddress,"DEPRECATED: the IP address on which to listen for the --port port (set to 0.0.0.0 for all IPv4 interfaces and :: for all IPv6 interfaces). See --bind-address instead.")
// MarkDeprecated hides the flag from the help. We don't want that:
// fs.MarkDeprecated("address", "see --bind-address instead.")
fs.IntVar(&o.BindPort,"port",o.BindPort,"DEPRECATED: the port on which to serve HTTP insecurely without authentication and authorization. If 0, don't serve HTTPS at all. See --secure-port instead.")
// MarkDeprecated hides the flag from the help. We don't want that:
// fs.MarkDeprecated("port", "see --secure-port instead.")