Merge pull request #106865 from jonyhy96/cleanup-scheduler-flag

[scheduler] cleanup: remove insecure flag
This commit is contained in:
Kubernetes Prow Robot 2022-01-07 08:58:45 -08:00 committed by GitHub
commit ac318a6518
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 33 deletions

View File

@ -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
}

View File

@ -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