mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-22 01:56:16 +00:00
Merge pull request #119130 from SataQiu/clean-sheduler-20230706
Remove deprecated scheduler CLI flags
This commit is contained in:
commit
42e1e72105
@ -28,8 +28,6 @@ import (
|
||||
type DeprecatedOptions struct {
|
||||
componentbaseconfig.DebuggingConfiguration
|
||||
componentbaseconfig.ClientConnectionConfiguration
|
||||
// Note that only the deprecated options (lock-object-name and lock-object-namespace) are populated here.
|
||||
componentbaseconfig.LeaderElectionConfiguration
|
||||
// PodMaxInUnschedulablePodsDuration is the maximum time a pod can stay in
|
||||
// unschedulablePods. If a pod stays in unschedulablePods for longer than this
|
||||
// value, the pod will be moved from unschedulablePods to backoffQ or activeQ.
|
||||
@ -49,7 +47,5 @@ func (o *DeprecatedOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
fs.StringVar(&o.ContentType, "kube-api-content-type", "application/vnd.kubernetes.protobuf", "DEPRECATED: content type of requests sent to apiserver. This parameter is ignored if a config file is specified in --config.")
|
||||
fs.Float32Var(&o.QPS, "kube-api-qps", 50.0, "DEPRECATED: QPS to use while talking with kubernetes apiserver. This parameter is ignored if a config file is specified in --config.")
|
||||
fs.Int32Var(&o.Burst, "kube-api-burst", 100, "DEPRECATED: burst to use while talking with kubernetes apiserver. This parameter is ignored if a config file is specified in --config.")
|
||||
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.")
|
||||
fs.DurationVar(&o.PodMaxInUnschedulablePodsDuration, "pod-max-in-unschedulable-pods-duration", 5*time.Minute, "DEPRECATED: the maximum time a pod can stay in unschedulablePods. If a pod stays in unschedulablePods for longer than this value, the pod will be moved from unschedulablePods to backoffQ or activeQ. This flag is deprecated and will be removed in 1.26")
|
||||
}
|
||||
|
@ -137,12 +137,6 @@ func (o *Options) ApplyDeprecated() {
|
||||
if deprecated.Changed("kube-api-burst") {
|
||||
o.ComponentConfig.ClientConnection.Burst = o.Deprecated.Burst
|
||||
}
|
||||
if deprecated.Changed("lock-object-namespace") {
|
||||
o.ComponentConfig.LeaderElection.ResourceNamespace = o.Deprecated.ResourceNamespace
|
||||
}
|
||||
if deprecated.Changed("lock-object-name") {
|
||||
o.ComponentConfig.LeaderElection.ResourceName = o.Deprecated.ResourceName
|
||||
}
|
||||
}
|
||||
|
||||
// ApplyLeaderElectionTo obtains the CLI args related with leaderelection, and override the values in `cfg`.
|
||||
|
@ -253,12 +253,13 @@ leaderElection:
|
||||
}
|
||||
|
||||
testcases := []struct {
|
||||
name string
|
||||
flags []string
|
||||
registryOptions []Option
|
||||
restoreFeatures map[featuregate.Feature]bool
|
||||
wantPlugins map[string]*config.Plugins
|
||||
wantLeaderElection *componentbaseconfig.LeaderElectionConfiguration
|
||||
name string
|
||||
flags []string
|
||||
registryOptions []Option
|
||||
restoreFeatures map[featuregate.Feature]bool
|
||||
wantPlugins map[string]*config.Plugins
|
||||
wantLeaderElection *componentbaseconfig.LeaderElectionConfiguration
|
||||
wantClientConnection *componentbaseconfig.ClientConnectionConfiguration
|
||||
}{
|
||||
{
|
||||
name: "default config with an alpha feature enabled",
|
||||
@ -396,7 +397,7 @@ leaderElection:
|
||||
flags: []string{
|
||||
"--leader-elect=false",
|
||||
"--leader-elect-lease-duration=2h", // CLI args are favored over the fields in ComponentConfig
|
||||
"--lock-object-namespace=default", // deprecated CLI arg will be ignored if --config is specified
|
||||
"--kubeconfig=foo", // deprecated CLI arg will be ignored if --config is specified
|
||||
"--config", emptyLeaderElectionConfig,
|
||||
},
|
||||
wantLeaderElection: &componentbaseconfig.LeaderElectionConfiguration{
|
||||
@ -408,14 +409,20 @@ leaderElection:
|
||||
ResourceName: v1beta3.SchedulerDefaultLockObjectName,
|
||||
ResourceNamespace: v1beta3.SchedulerDefaultLockObjectNamespace,
|
||||
},
|
||||
wantClientConnection: &componentbaseconfig.ClientConnectionConfiguration{
|
||||
Kubeconfig: configKubeconfig,
|
||||
ContentType: "application/vnd.kubernetes.protobuf",
|
||||
QPS: 50,
|
||||
Burst: 100,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "leader election CLI args, without --config arg",
|
||||
flags: []string{
|
||||
"--leader-elect=false",
|
||||
"--leader-elect-lease-duration=2h",
|
||||
"--lock-object-namespace=default", // deprecated CLI arg is honored if --config is not specified
|
||||
"--kubeconfig", configKubeconfig,
|
||||
"--leader-elect-resource-namespace=default",
|
||||
"--kubeconfig", configKubeconfig, // deprecated CLI arg is honored if --config is not specified
|
||||
},
|
||||
wantLeaderElection: &componentbaseconfig.LeaderElectionConfiguration{
|
||||
LeaderElect: false, // from CLI args
|
||||
@ -424,7 +431,13 @@ leaderElection:
|
||||
RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
|
||||
ResourceLock: "leases",
|
||||
ResourceName: v1beta3.SchedulerDefaultLockObjectName,
|
||||
ResourceNamespace: "default", // from deprecated CLI args
|
||||
ResourceNamespace: "default", // from CLI args
|
||||
},
|
||||
wantClientConnection: &componentbaseconfig.ClientConnectionConfiguration{
|
||||
Kubeconfig: configKubeconfig, // from deprecated CLI args
|
||||
ContentType: "application/vnd.kubernetes.protobuf",
|
||||
QPS: 50,
|
||||
Burst: 100,
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -520,6 +533,13 @@ leaderElection:
|
||||
t.Errorf("Unexpected leaderElection diff (-want, +got): %s", diff)
|
||||
}
|
||||
}
|
||||
|
||||
if tc.wantClientConnection != nil {
|
||||
gotClientConnection := opts.ComponentConfig.ClientConnection
|
||||
if diff := cmp.Diff(*tc.wantClientConnection, gotClientConnection); diff != "" {
|
||||
t.Errorf("Unexpected clientConnection diff (-want, +got): %s", diff)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user