mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 21:47:07 +00:00
Merge pull request #90565 from alculquicondor/cleanup-sched-config
Remove wrapper around base LeaderElectionConfiguration
This commit is contained in:
commit
40b0f4f6cb
@ -158,7 +158,7 @@ func (o *Options) Flags() (nfs cliflag.NamedFlagSets) {
|
|||||||
o.Authorization.AddFlags(nfs.FlagSet("authorization"))
|
o.Authorization.AddFlags(nfs.FlagSet("authorization"))
|
||||||
o.Deprecated.AddFlags(nfs.FlagSet("deprecated"), &o.ComponentConfig)
|
o.Deprecated.AddFlags(nfs.FlagSet("deprecated"), &o.ComponentConfig)
|
||||||
|
|
||||||
leaderelectionconfig.BindFlags(&o.ComponentConfig.LeaderElection.LeaderElectionConfiguration, nfs.FlagSet("leader election"))
|
leaderelectionconfig.BindFlags(&o.ComponentConfig.LeaderElection, nfs.FlagSet("leader election"))
|
||||||
utilfeature.DefaultMutableFeatureGate.AddFlag(nfs.FlagSet("feature gate"))
|
utilfeature.DefaultMutableFeatureGate.AddFlag(nfs.FlagSet("feature gate"))
|
||||||
o.Metrics.AddFlags(nfs.FlagSet("metrics"))
|
o.Metrics.AddFlags(nfs.FlagSet("metrics"))
|
||||||
|
|
||||||
@ -273,7 +273,7 @@ func (o *Options) Config() (*schedulerappconfig.Config, error) {
|
|||||||
|
|
||||||
// makeLeaderElectionConfig builds a leader election configuration. It will
|
// makeLeaderElectionConfig builds a leader election configuration. It will
|
||||||
// create a new resource lock associated with the configuration.
|
// create a new resource lock associated with the configuration.
|
||||||
func makeLeaderElectionConfig(config kubeschedulerconfig.KubeSchedulerLeaderElectionConfiguration, client clientset.Interface, recorder record.EventRecorder) (*leaderelection.LeaderElectionConfig, error) {
|
func makeLeaderElectionConfig(config componentbaseconfig.LeaderElectionConfiguration, client clientset.Interface, recorder record.EventRecorder) (*leaderelection.LeaderElectionConfig, error) {
|
||||||
hostname, err := os.Hostname()
|
hostname, err := os.Hostname()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to get hostname: %v", err)
|
return nil, fmt.Errorf("unable to get hostname: %v", err)
|
||||||
|
@ -304,16 +304,14 @@ profiles:
|
|||||||
EnableProfiling: true,
|
EnableProfiling: true,
|
||||||
EnableContentionProfiling: true,
|
EnableContentionProfiling: true,
|
||||||
},
|
},
|
||||||
LeaderElection: kubeschedulerconfig.KubeSchedulerLeaderElectionConfiguration{
|
LeaderElection: componentbaseconfig.LeaderElectionConfiguration{
|
||||||
LeaderElectionConfiguration: componentbaseconfig.LeaderElectionConfiguration{
|
LeaderElect: true,
|
||||||
LeaderElect: true,
|
LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
|
||||||
LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
|
RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
|
||||||
RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
|
RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
|
||||||
RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
|
ResourceLock: "endpointsleases",
|
||||||
ResourceLock: "endpointsleases",
|
ResourceNamespace: "kube-system",
|
||||||
ResourceNamespace: "kube-system",
|
ResourceName: "kube-scheduler",
|
||||||
ResourceName: "kube-scheduler",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
ClientConnection: componentbaseconfig.ClientConnectionConfiguration{
|
ClientConnection: componentbaseconfig.ClientConnectionConfiguration{
|
||||||
Kubeconfig: configKubeconfig,
|
Kubeconfig: configKubeconfig,
|
||||||
@ -396,16 +394,14 @@ profiles:
|
|||||||
EnableProfiling: true,
|
EnableProfiling: true,
|
||||||
EnableContentionProfiling: true,
|
EnableContentionProfiling: true,
|
||||||
},
|
},
|
||||||
LeaderElection: kubeschedulerconfig.KubeSchedulerLeaderElectionConfiguration{
|
LeaderElection: componentbaseconfig.LeaderElectionConfiguration{
|
||||||
LeaderElectionConfiguration: componentbaseconfig.LeaderElectionConfiguration{
|
LeaderElect: true,
|
||||||
LeaderElect: true,
|
LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
|
||||||
LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
|
RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
|
||||||
RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
|
RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
|
||||||
RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
|
ResourceLock: "endpointsleases",
|
||||||
ResourceLock: "endpointsleases",
|
ResourceNamespace: "kube-system",
|
||||||
ResourceNamespace: "kube-system",
|
ResourceName: "kube-scheduler",
|
||||||
ResourceName: "kube-scheduler",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
ClientConnection: componentbaseconfig.ClientConnectionConfiguration{
|
ClientConnection: componentbaseconfig.ClientConnectionConfiguration{
|
||||||
Kubeconfig: flagKubeconfig,
|
Kubeconfig: flagKubeconfig,
|
||||||
@ -462,16 +458,14 @@ profiles:
|
|||||||
EnableProfiling: true,
|
EnableProfiling: true,
|
||||||
EnableContentionProfiling: true,
|
EnableContentionProfiling: true,
|
||||||
},
|
},
|
||||||
LeaderElection: kubeschedulerconfig.KubeSchedulerLeaderElectionConfiguration{
|
LeaderElection: componentbaseconfig.LeaderElectionConfiguration{
|
||||||
LeaderElectionConfiguration: componentbaseconfig.LeaderElectionConfiguration{
|
LeaderElect: true,
|
||||||
LeaderElect: true,
|
LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
|
||||||
LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
|
RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
|
||||||
RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
|
RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
|
||||||
RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
|
ResourceLock: "endpointsleases",
|
||||||
ResourceLock: "endpointsleases",
|
ResourceNamespace: "kube-system",
|
||||||
ResourceNamespace: "kube-system",
|
ResourceName: "kube-scheduler",
|
||||||
ResourceName: "kube-scheduler",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
ClientConnection: componentbaseconfig.ClientConnectionConfiguration{
|
ClientConnection: componentbaseconfig.ClientConnectionConfiguration{
|
||||||
Kubeconfig: flagKubeconfig,
|
Kubeconfig: flagKubeconfig,
|
||||||
@ -503,16 +497,14 @@ profiles:
|
|||||||
EnableProfiling: true,
|
EnableProfiling: true,
|
||||||
EnableContentionProfiling: true,
|
EnableContentionProfiling: true,
|
||||||
},
|
},
|
||||||
LeaderElection: kubeschedulerconfig.KubeSchedulerLeaderElectionConfiguration{
|
LeaderElection: componentbaseconfig.LeaderElectionConfiguration{
|
||||||
LeaderElectionConfiguration: componentbaseconfig.LeaderElectionConfiguration{
|
LeaderElect: true,
|
||||||
LeaderElect: true,
|
LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
|
||||||
LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
|
RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
|
||||||
RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
|
RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
|
||||||
RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
|
ResourceLock: "endpointsleases",
|
||||||
ResourceLock: "endpointsleases",
|
ResourceNamespace: "kube-system",
|
||||||
ResourceNamespace: "kube-system",
|
ResourceName: "kube-scheduler",
|
||||||
ResourceName: "kube-scheduler",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
ClientConnection: componentbaseconfig.ClientConnectionConfiguration{
|
ClientConnection: componentbaseconfig.ClientConnectionConfiguration{
|
||||||
Kubeconfig: configKubeconfig,
|
Kubeconfig: configKubeconfig,
|
||||||
@ -579,16 +571,14 @@ profiles:
|
|||||||
EnableProfiling: true,
|
EnableProfiling: true,
|
||||||
EnableContentionProfiling: true,
|
EnableContentionProfiling: true,
|
||||||
},
|
},
|
||||||
LeaderElection: kubeschedulerconfig.KubeSchedulerLeaderElectionConfiguration{
|
LeaderElection: componentbaseconfig.LeaderElectionConfiguration{
|
||||||
LeaderElectionConfiguration: componentbaseconfig.LeaderElectionConfiguration{
|
LeaderElect: true,
|
||||||
LeaderElect: true,
|
LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
|
||||||
LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
|
RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
|
||||||
RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
|
RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
|
||||||
RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
|
ResourceLock: "endpointsleases",
|
||||||
ResourceLock: "endpointsleases",
|
ResourceNamespace: "kube-system",
|
||||||
ResourceNamespace: "kube-system",
|
ResourceName: "kube-scheduler",
|
||||||
ResourceName: "kube-scheduler",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
ClientConnection: componentbaseconfig.ClientConnectionConfiguration{
|
ClientConnection: componentbaseconfig.ClientConnectionConfiguration{
|
||||||
Kubeconfig: configKubeconfig,
|
Kubeconfig: configKubeconfig,
|
||||||
@ -653,16 +643,14 @@ profiles:
|
|||||||
EnableProfiling: true,
|
EnableProfiling: true,
|
||||||
EnableContentionProfiling: true,
|
EnableContentionProfiling: true,
|
||||||
},
|
},
|
||||||
LeaderElection: kubeschedulerconfig.KubeSchedulerLeaderElectionConfiguration{
|
LeaderElection: componentbaseconfig.LeaderElectionConfiguration{
|
||||||
LeaderElectionConfiguration: componentbaseconfig.LeaderElectionConfiguration{
|
LeaderElect: true,
|
||||||
LeaderElect: true,
|
LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
|
||||||
LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
|
RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
|
||||||
RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
|
RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
|
||||||
RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
|
ResourceLock: "endpointsleases",
|
||||||
ResourceLock: "endpointsleases",
|
ResourceNamespace: "kube-system",
|
||||||
ResourceNamespace: "kube-system",
|
ResourceName: "kube-scheduler",
|
||||||
ResourceName: "kube-scheduler",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
ClientConnection: componentbaseconfig.ClientConnectionConfiguration{
|
ClientConnection: componentbaseconfig.ClientConnectionConfiguration{
|
||||||
Kubeconfig: flagKubeconfig,
|
Kubeconfig: flagKubeconfig,
|
||||||
@ -707,16 +695,14 @@ profiles:
|
|||||||
EnableProfiling: true,
|
EnableProfiling: true,
|
||||||
EnableContentionProfiling: true,
|
EnableContentionProfiling: true,
|
||||||
},
|
},
|
||||||
LeaderElection: kubeschedulerconfig.KubeSchedulerLeaderElectionConfiguration{
|
LeaderElection: componentbaseconfig.LeaderElectionConfiguration{
|
||||||
LeaderElectionConfiguration: componentbaseconfig.LeaderElectionConfiguration{
|
LeaderElect: true,
|
||||||
LeaderElect: true,
|
LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
|
||||||
LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
|
RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
|
||||||
RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
|
RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
|
||||||
RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
|
ResourceLock: "endpointsleases",
|
||||||
ResourceLock: "endpointsleases",
|
ResourceNamespace: "kube-system",
|
||||||
ResourceNamespace: "kube-system",
|
ResourceName: "kube-scheduler",
|
||||||
ResourceName: "kube-scheduler",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
ClientConnection: componentbaseconfig.ClientConnectionConfiguration{
|
ClientConnection: componentbaseconfig.ClientConnectionConfiguration{
|
||||||
Kubeconfig: flagKubeconfig,
|
Kubeconfig: flagKubeconfig,
|
||||||
|
@ -61,7 +61,7 @@ type KubeSchedulerConfiguration struct {
|
|||||||
AlgorithmSource SchedulerAlgorithmSource
|
AlgorithmSource SchedulerAlgorithmSource
|
||||||
|
|
||||||
// LeaderElection defines the configuration of leader election client.
|
// LeaderElection defines the configuration of leader election client.
|
||||||
LeaderElection KubeSchedulerLeaderElectionConfiguration
|
LeaderElection componentbaseconfig.LeaderElectionConfiguration
|
||||||
|
|
||||||
// ClientConnection specifies the kubeconfig file and client connection
|
// ClientConnection specifies the kubeconfig file and client connection
|
||||||
// settings for the proxy server to use when communicating with the apiserver.
|
// settings for the proxy server to use when communicating with the apiserver.
|
||||||
@ -173,12 +173,6 @@ type SchedulerPolicyConfigMapSource struct {
|
|||||||
Name string
|
Name string
|
||||||
}
|
}
|
||||||
|
|
||||||
// KubeSchedulerLeaderElectionConfiguration expands LeaderElectionConfiguration
|
|
||||||
// to include scheduler specific configuration.
|
|
||||||
type KubeSchedulerLeaderElectionConfiguration struct {
|
|
||||||
componentbaseconfig.LeaderElectionConfiguration
|
|
||||||
}
|
|
||||||
|
|
||||||
// Plugins include multiple extension points. When specified, the list of plugins for
|
// Plugins include multiple extension points. When specified, the list of plugins for
|
||||||
// a particular extension point are the only ones enabled. If an extension point is
|
// a particular extension point are the only ones enabled. If an extension point is
|
||||||
// omitted from the config, then the default set of plugins is used for that extension point.
|
// omitted from the config, then the default set of plugins is used for that extension point.
|
||||||
|
@ -127,7 +127,7 @@ func SetDefaults_KubeSchedulerConfiguration(obj *v1alpha2.KubeSchedulerConfigura
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Use the default LeaderElectionConfiguration options
|
// Use the default LeaderElectionConfiguration options
|
||||||
componentbaseconfigv1alpha1.RecommendedDefaultLeaderElectionConfiguration(&obj.LeaderElection.LeaderElectionConfiguration)
|
componentbaseconfigv1alpha1.RecommendedDefaultLeaderElectionConfiguration(&obj.LeaderElection)
|
||||||
|
|
||||||
if obj.BindTimeoutSeconds == nil {
|
if obj.BindTimeoutSeconds == nil {
|
||||||
val := int64(600)
|
val := int64(600)
|
||||||
|
@ -46,16 +46,14 @@ func TestSchedulerDefaults(t *testing.T) {
|
|||||||
EnableProfiling: &enable,
|
EnableProfiling: &enable,
|
||||||
EnableContentionProfiling: &enable,
|
EnableContentionProfiling: &enable,
|
||||||
},
|
},
|
||||||
LeaderElection: v1alpha2.KubeSchedulerLeaderElectionConfiguration{
|
LeaderElection: componentbaseconfig.LeaderElectionConfiguration{
|
||||||
LeaderElectionConfiguration: componentbaseconfig.LeaderElectionConfiguration{
|
LeaderElect: pointer.BoolPtr(true),
|
||||||
LeaderElect: pointer.BoolPtr(true),
|
LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
|
||||||
LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
|
RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
|
||||||
RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
|
RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
|
||||||
RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
|
ResourceLock: "endpointsleases",
|
||||||
ResourceLock: "endpointsleases",
|
ResourceNamespace: "kube-system",
|
||||||
ResourceNamespace: "kube-system",
|
ResourceName: "kube-scheduler",
|
||||||
ResourceName: "kube-scheduler",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
ClientConnection: componentbaseconfig.ClientConnectionConfiguration{
|
ClientConnection: componentbaseconfig.ClientConnectionConfiguration{
|
||||||
QPS: 50,
|
QPS: 50,
|
||||||
@ -90,16 +88,14 @@ func TestSchedulerDefaults(t *testing.T) {
|
|||||||
EnableProfiling: &enable,
|
EnableProfiling: &enable,
|
||||||
EnableContentionProfiling: &enable,
|
EnableContentionProfiling: &enable,
|
||||||
},
|
},
|
||||||
LeaderElection: v1alpha2.KubeSchedulerLeaderElectionConfiguration{
|
LeaderElection: componentbaseconfig.LeaderElectionConfiguration{
|
||||||
LeaderElectionConfiguration: componentbaseconfig.LeaderElectionConfiguration{
|
LeaderElect: pointer.BoolPtr(true),
|
||||||
LeaderElect: pointer.BoolPtr(true),
|
LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
|
||||||
LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
|
RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
|
||||||
RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
|
RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
|
||||||
RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
|
ResourceLock: "endpointsleases",
|
||||||
ResourceLock: "endpointsleases",
|
ResourceNamespace: "kube-system",
|
||||||
ResourceNamespace: "kube-system",
|
ResourceName: "kube-scheduler",
|
||||||
ResourceName: "kube-scheduler",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
ClientConnection: componentbaseconfig.ClientConnectionConfiguration{
|
ClientConnection: componentbaseconfig.ClientConnectionConfiguration{
|
||||||
QPS: 50,
|
QPS: 50,
|
||||||
@ -149,16 +145,14 @@ func TestSchedulerDefaults(t *testing.T) {
|
|||||||
EnableProfiling: &enable,
|
EnableProfiling: &enable,
|
||||||
EnableContentionProfiling: &enable,
|
EnableContentionProfiling: &enable,
|
||||||
},
|
},
|
||||||
LeaderElection: v1alpha2.KubeSchedulerLeaderElectionConfiguration{
|
LeaderElection: componentbaseconfig.LeaderElectionConfiguration{
|
||||||
LeaderElectionConfiguration: componentbaseconfig.LeaderElectionConfiguration{
|
LeaderElect: pointer.BoolPtr(true),
|
||||||
LeaderElect: pointer.BoolPtr(true),
|
LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
|
||||||
LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
|
RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
|
||||||
RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
|
RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
|
||||||
RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
|
ResourceLock: "endpointsleases",
|
||||||
ResourceLock: "endpointsleases",
|
ResourceNamespace: "kube-system",
|
||||||
ResourceNamespace: "kube-system",
|
ResourceName: "kube-scheduler",
|
||||||
ResourceName: "kube-scheduler",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
ClientConnection: componentbaseconfig.ClientConnectionConfiguration{
|
ClientConnection: componentbaseconfig.ClientConnectionConfiguration{
|
||||||
QPS: 50,
|
QPS: 50,
|
||||||
@ -202,16 +196,14 @@ func TestSchedulerDefaults(t *testing.T) {
|
|||||||
EnableProfiling: &enable,
|
EnableProfiling: &enable,
|
||||||
EnableContentionProfiling: &enable,
|
EnableContentionProfiling: &enable,
|
||||||
},
|
},
|
||||||
LeaderElection: v1alpha2.KubeSchedulerLeaderElectionConfiguration{
|
LeaderElection: componentbaseconfig.LeaderElectionConfiguration{
|
||||||
LeaderElectionConfiguration: componentbaseconfig.LeaderElectionConfiguration{
|
LeaderElect: pointer.BoolPtr(true),
|
||||||
LeaderElect: pointer.BoolPtr(true),
|
LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
|
||||||
LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
|
RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
|
||||||
RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
|
RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
|
||||||
RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
|
ResourceLock: "endpointsleases",
|
||||||
ResourceLock: "endpointsleases",
|
ResourceNamespace: "kube-system",
|
||||||
ResourceNamespace: "kube-system",
|
ResourceName: "kube-scheduler",
|
||||||
ResourceName: "kube-scheduler",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
ClientConnection: componentbaseconfig.ClientConnectionConfiguration{
|
ClientConnection: componentbaseconfig.ClientConnectionConfiguration{
|
||||||
QPS: 50,
|
QPS: 50,
|
||||||
@ -241,16 +233,14 @@ func TestSchedulerDefaults(t *testing.T) {
|
|||||||
EnableProfiling: &enable,
|
EnableProfiling: &enable,
|
||||||
EnableContentionProfiling: &enable,
|
EnableContentionProfiling: &enable,
|
||||||
},
|
},
|
||||||
LeaderElection: v1alpha2.KubeSchedulerLeaderElectionConfiguration{
|
LeaderElection: componentbaseconfig.LeaderElectionConfiguration{
|
||||||
LeaderElectionConfiguration: componentbaseconfig.LeaderElectionConfiguration{
|
LeaderElect: pointer.BoolPtr(true),
|
||||||
LeaderElect: pointer.BoolPtr(true),
|
LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
|
||||||
LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
|
RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
|
||||||
RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
|
RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
|
||||||
RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
|
ResourceLock: "endpointsleases",
|
||||||
ResourceLock: "endpointsleases",
|
ResourceNamespace: "kube-system",
|
||||||
ResourceNamespace: "kube-system",
|
ResourceName: "kube-scheduler",
|
||||||
ResourceName: "kube-scheduler",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
ClientConnection: componentbaseconfig.ClientConnectionConfiguration{
|
ClientConnection: componentbaseconfig.ClientConnectionConfiguration{
|
||||||
QPS: 50,
|
QPS: 50,
|
||||||
|
@ -50,16 +50,6 @@ func RegisterConversions(s *runtime.Scheme) error {
|
|||||||
}); err != nil {
|
}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := s.AddGeneratedConversionFunc((*v1alpha2.KubeSchedulerLeaderElectionConfiguration)(nil), (*config.KubeSchedulerLeaderElectionConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
|
||||||
return Convert_v1alpha2_KubeSchedulerLeaderElectionConfiguration_To_config_KubeSchedulerLeaderElectionConfiguration(a.(*v1alpha2.KubeSchedulerLeaderElectionConfiguration), b.(*config.KubeSchedulerLeaderElectionConfiguration), scope)
|
|
||||||
}); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if err := s.AddGeneratedConversionFunc((*config.KubeSchedulerLeaderElectionConfiguration)(nil), (*v1alpha2.KubeSchedulerLeaderElectionConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
|
||||||
return Convert_config_KubeSchedulerLeaderElectionConfiguration_To_v1alpha2_KubeSchedulerLeaderElectionConfiguration(a.(*config.KubeSchedulerLeaderElectionConfiguration), b.(*v1alpha2.KubeSchedulerLeaderElectionConfiguration), scope)
|
|
||||||
}); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if err := s.AddGeneratedConversionFunc((*v1alpha2.KubeSchedulerProfile)(nil), (*config.KubeSchedulerProfile)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
if err := s.AddGeneratedConversionFunc((*v1alpha2.KubeSchedulerProfile)(nil), (*config.KubeSchedulerProfile)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
return Convert_v1alpha2_KubeSchedulerProfile_To_config_KubeSchedulerProfile(a.(*v1alpha2.KubeSchedulerProfile), b.(*config.KubeSchedulerProfile), scope)
|
return Convert_v1alpha2_KubeSchedulerProfile_To_config_KubeSchedulerProfile(a.(*v1alpha2.KubeSchedulerProfile), b.(*config.KubeSchedulerProfile), scope)
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
@ -218,7 +208,7 @@ func Convert_config_InterPodAffinityArgs_To_v1alpha2_InterPodAffinityArgs(in *co
|
|||||||
}
|
}
|
||||||
|
|
||||||
func autoConvert_v1alpha2_KubeSchedulerConfiguration_To_config_KubeSchedulerConfiguration(in *v1alpha2.KubeSchedulerConfiguration, out *config.KubeSchedulerConfiguration, s conversion.Scope) error {
|
func autoConvert_v1alpha2_KubeSchedulerConfiguration_To_config_KubeSchedulerConfiguration(in *v1alpha2.KubeSchedulerConfiguration, out *config.KubeSchedulerConfiguration, s conversion.Scope) error {
|
||||||
if err := Convert_v1alpha2_KubeSchedulerLeaderElectionConfiguration_To_config_KubeSchedulerLeaderElectionConfiguration(&in.LeaderElection, &out.LeaderElection, s); err != nil {
|
if err := v1alpha1.Convert_v1alpha1_LeaderElectionConfiguration_To_config_LeaderElectionConfiguration(&in.LeaderElection, &out.LeaderElection, s); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := v1alpha1.Convert_v1alpha1_ClientConnectionConfiguration_To_config_ClientConnectionConfiguration(&in.ClientConnection, &out.ClientConnection, s); err != nil {
|
if err := v1alpha1.Convert_v1alpha1_ClientConnectionConfiguration_To_config_ClientConnectionConfiguration(&in.ClientConnection, &out.ClientConnection, s); err != nil {
|
||||||
@ -265,7 +255,7 @@ func autoConvert_v1alpha2_KubeSchedulerConfiguration_To_config_KubeSchedulerConf
|
|||||||
|
|
||||||
func autoConvert_config_KubeSchedulerConfiguration_To_v1alpha2_KubeSchedulerConfiguration(in *config.KubeSchedulerConfiguration, out *v1alpha2.KubeSchedulerConfiguration, s conversion.Scope) error {
|
func autoConvert_config_KubeSchedulerConfiguration_To_v1alpha2_KubeSchedulerConfiguration(in *config.KubeSchedulerConfiguration, out *v1alpha2.KubeSchedulerConfiguration, s conversion.Scope) error {
|
||||||
// WARNING: in.AlgorithmSource requires manual conversion: does not exist in peer-type
|
// WARNING: in.AlgorithmSource requires manual conversion: does not exist in peer-type
|
||||||
if err := Convert_config_KubeSchedulerLeaderElectionConfiguration_To_v1alpha2_KubeSchedulerLeaderElectionConfiguration(&in.LeaderElection, &out.LeaderElection, s); err != nil {
|
if err := v1alpha1.Convert_config_LeaderElectionConfiguration_To_v1alpha1_LeaderElectionConfiguration(&in.LeaderElection, &out.LeaderElection, s); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := v1alpha1.Convert_config_ClientConnectionConfiguration_To_v1alpha1_ClientConnectionConfiguration(&in.ClientConnection, &out.ClientConnection, s); err != nil {
|
if err := v1alpha1.Convert_config_ClientConnectionConfiguration_To_v1alpha1_ClientConnectionConfiguration(&in.ClientConnection, &out.ClientConnection, s); err != nil {
|
||||||
@ -310,30 +300,6 @@ func autoConvert_config_KubeSchedulerConfiguration_To_v1alpha2_KubeSchedulerConf
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func autoConvert_v1alpha2_KubeSchedulerLeaderElectionConfiguration_To_config_KubeSchedulerLeaderElectionConfiguration(in *v1alpha2.KubeSchedulerLeaderElectionConfiguration, out *config.KubeSchedulerLeaderElectionConfiguration, s conversion.Scope) error {
|
|
||||||
if err := v1alpha1.Convert_v1alpha1_LeaderElectionConfiguration_To_config_LeaderElectionConfiguration(&in.LeaderElectionConfiguration, &out.LeaderElectionConfiguration, s); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert_v1alpha2_KubeSchedulerLeaderElectionConfiguration_To_config_KubeSchedulerLeaderElectionConfiguration is an autogenerated conversion function.
|
|
||||||
func Convert_v1alpha2_KubeSchedulerLeaderElectionConfiguration_To_config_KubeSchedulerLeaderElectionConfiguration(in *v1alpha2.KubeSchedulerLeaderElectionConfiguration, out *config.KubeSchedulerLeaderElectionConfiguration, s conversion.Scope) error {
|
|
||||||
return autoConvert_v1alpha2_KubeSchedulerLeaderElectionConfiguration_To_config_KubeSchedulerLeaderElectionConfiguration(in, out, s)
|
|
||||||
}
|
|
||||||
|
|
||||||
func autoConvert_config_KubeSchedulerLeaderElectionConfiguration_To_v1alpha2_KubeSchedulerLeaderElectionConfiguration(in *config.KubeSchedulerLeaderElectionConfiguration, out *v1alpha2.KubeSchedulerLeaderElectionConfiguration, s conversion.Scope) error {
|
|
||||||
if err := v1alpha1.Convert_config_LeaderElectionConfiguration_To_v1alpha1_LeaderElectionConfiguration(&in.LeaderElectionConfiguration, &out.LeaderElectionConfiguration, s); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert_config_KubeSchedulerLeaderElectionConfiguration_To_v1alpha2_KubeSchedulerLeaderElectionConfiguration is an autogenerated conversion function.
|
|
||||||
func Convert_config_KubeSchedulerLeaderElectionConfiguration_To_v1alpha2_KubeSchedulerLeaderElectionConfiguration(in *config.KubeSchedulerLeaderElectionConfiguration, out *v1alpha2.KubeSchedulerLeaderElectionConfiguration, s conversion.Scope) error {
|
|
||||||
return autoConvert_config_KubeSchedulerLeaderElectionConfiguration_To_v1alpha2_KubeSchedulerLeaderElectionConfiguration(in, out, s)
|
|
||||||
}
|
|
||||||
|
|
||||||
func autoConvert_v1alpha2_KubeSchedulerProfile_To_config_KubeSchedulerProfile(in *v1alpha2.KubeSchedulerProfile, out *config.KubeSchedulerProfile, s conversion.Scope) error {
|
func autoConvert_v1alpha2_KubeSchedulerProfile_To_config_KubeSchedulerProfile(in *v1alpha2.KubeSchedulerProfile, out *config.KubeSchedulerProfile, s conversion.Scope) error {
|
||||||
if err := v1.Convert_Pointer_string_To_string(&in.SchedulerName, &out.SchedulerName, s); err != nil {
|
if err := v1.Convert_Pointer_string_To_string(&in.SchedulerName, &out.SchedulerName, s); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -35,7 +35,7 @@ import (
|
|||||||
func ValidateKubeSchedulerConfiguration(cc *config.KubeSchedulerConfiguration) field.ErrorList {
|
func ValidateKubeSchedulerConfiguration(cc *config.KubeSchedulerConfiguration) field.ErrorList {
|
||||||
allErrs := field.ErrorList{}
|
allErrs := field.ErrorList{}
|
||||||
allErrs = append(allErrs, componentbasevalidation.ValidateClientConnectionConfiguration(&cc.ClientConnection, field.NewPath("clientConnection"))...)
|
allErrs = append(allErrs, componentbasevalidation.ValidateClientConnectionConfiguration(&cc.ClientConnection, field.NewPath("clientConnection"))...)
|
||||||
allErrs = append(allErrs, validateKubeSchedulerLeaderElectionConfiguration(field.NewPath("leaderElection"), &cc.LeaderElection)...)
|
allErrs = append(allErrs, componentbasevalidation.ValidateLeaderElectionConfiguration(&cc.LeaderElection, field.NewPath("leaderElection"))...)
|
||||||
|
|
||||||
profilesPath := field.NewPath("profiles")
|
profilesPath := field.NewPath("profiles")
|
||||||
if len(cc.Profiles) == 0 {
|
if len(cc.Profiles) == 0 {
|
||||||
@ -103,15 +103,6 @@ func validateCommonQueueSort(path *field.Path, profiles []config.KubeSchedulerPr
|
|||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
|
||||||
func validateKubeSchedulerLeaderElectionConfiguration(fldPath *field.Path, cc *config.KubeSchedulerLeaderElectionConfiguration) field.ErrorList {
|
|
||||||
allErrs := field.ErrorList{}
|
|
||||||
if !cc.LeaderElectionConfiguration.LeaderElect {
|
|
||||||
return allErrs
|
|
||||||
}
|
|
||||||
allErrs = append(allErrs, componentbasevalidation.ValidateLeaderElectionConfiguration(&cc.LeaderElectionConfiguration, fldPath)...)
|
|
||||||
return allErrs
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidatePolicy checks for errors in the Config
|
// ValidatePolicy checks for errors in the Config
|
||||||
// It does not return early so that it can find as many errors as possible
|
// It does not return early so that it can find as many errors as possible
|
||||||
func ValidatePolicy(policy config.Policy) error {
|
func ValidatePolicy(policy config.Policy) error {
|
||||||
|
@ -48,16 +48,14 @@ func TestValidateKubeSchedulerConfiguration(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
LeaderElection: config.KubeSchedulerLeaderElectionConfiguration{
|
LeaderElection: componentbaseconfig.LeaderElectionConfiguration{
|
||||||
LeaderElectionConfiguration: componentbaseconfig.LeaderElectionConfiguration{
|
ResourceLock: "configmap",
|
||||||
ResourceLock: "configmap",
|
LeaderElect: true,
|
||||||
LeaderElect: true,
|
LeaseDuration: metav1.Duration{Duration: 30 * time.Second},
|
||||||
LeaseDuration: metav1.Duration{Duration: 30 * time.Second},
|
RenewDeadline: metav1.Duration{Duration: 15 * time.Second},
|
||||||
RenewDeadline: metav1.Duration{Duration: 15 * time.Second},
|
RetryPeriod: metav1.Duration{Duration: 5 * time.Second},
|
||||||
RetryPeriod: metav1.Duration{Duration: 5 * time.Second},
|
ResourceNamespace: "name",
|
||||||
ResourceNamespace: "name",
|
ResourceName: "name",
|
||||||
ResourceName: "name",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
PodInitialBackoffSeconds: podInitialBackoffSeconds,
|
PodInitialBackoffSeconds: podInitialBackoffSeconds,
|
||||||
PodMaxBackoffSeconds: podMaxBackoffSeconds,
|
PodMaxBackoffSeconds: podMaxBackoffSeconds,
|
||||||
|
17
pkg/scheduler/apis/config/zz_generated.deepcopy.go
generated
17
pkg/scheduler/apis/config/zz_generated.deepcopy.go
generated
@ -166,23 +166,6 @@ func (in *KubeSchedulerConfiguration) DeepCopyObject() runtime.Object {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *KubeSchedulerLeaderElectionConfiguration) DeepCopyInto(out *KubeSchedulerLeaderElectionConfiguration) {
|
|
||||||
*out = *in
|
|
||||||
out.LeaderElectionConfiguration = in.LeaderElectionConfiguration
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeSchedulerLeaderElectionConfiguration.
|
|
||||||
func (in *KubeSchedulerLeaderElectionConfiguration) DeepCopy() *KubeSchedulerLeaderElectionConfiguration {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(KubeSchedulerLeaderElectionConfiguration)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *KubeSchedulerProfile) DeepCopyInto(out *KubeSchedulerProfile) {
|
func (in *KubeSchedulerProfile) DeepCopyInto(out *KubeSchedulerProfile) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
@ -45,7 +45,7 @@ type KubeSchedulerConfiguration struct {
|
|||||||
metav1.TypeMeta `json:",inline"`
|
metav1.TypeMeta `json:",inline"`
|
||||||
|
|
||||||
// LeaderElection defines the configuration of leader election client.
|
// LeaderElection defines the configuration of leader election client.
|
||||||
LeaderElection KubeSchedulerLeaderElectionConfiguration `json:"leaderElection"`
|
LeaderElection componentbaseconfigv1alpha1.LeaderElectionConfiguration `json:"leaderElection"`
|
||||||
|
|
||||||
// ClientConnection specifies the kubeconfig file and client connection
|
// ClientConnection specifies the kubeconfig file and client connection
|
||||||
// settings for the proxy server to use when communicating with the apiserver.
|
// settings for the proxy server to use when communicating with the apiserver.
|
||||||
@ -156,12 +156,6 @@ type KubeSchedulerProfile struct {
|
|||||||
PluginConfig []PluginConfig `json:"pluginConfig,omitempty"`
|
PluginConfig []PluginConfig `json:"pluginConfig,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// KubeSchedulerLeaderElectionConfiguration expands LeaderElectionConfiguration
|
|
||||||
// to include scheduler specific configuration.
|
|
||||||
type KubeSchedulerLeaderElectionConfiguration struct {
|
|
||||||
componentbaseconfigv1alpha1.LeaderElectionConfiguration `json:",inline"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Plugins include multiple extension points. When specified, the list of plugins for
|
// Plugins include multiple extension points. When specified, the list of plugins for
|
||||||
// a particular extension point are the only ones enabled. If an extension point is
|
// a particular extension point are the only ones enabled. If an extension point is
|
||||||
// omitted from the config, then the default set of plugins is used for that extension point.
|
// omitted from the config, then the default set of plugins is used for that extension point.
|
||||||
|
@ -133,23 +133,6 @@ func (in *KubeSchedulerConfiguration) DeepCopyObject() runtime.Object {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *KubeSchedulerLeaderElectionConfiguration) DeepCopyInto(out *KubeSchedulerLeaderElectionConfiguration) {
|
|
||||||
*out = *in
|
|
||||||
in.LeaderElectionConfiguration.DeepCopyInto(&out.LeaderElectionConfiguration)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeSchedulerLeaderElectionConfiguration.
|
|
||||||
func (in *KubeSchedulerLeaderElectionConfiguration) DeepCopy() *KubeSchedulerLeaderElectionConfiguration {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(KubeSchedulerLeaderElectionConfiguration)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *KubeSchedulerProfile) DeepCopyInto(out *KubeSchedulerProfile) {
|
func (in *KubeSchedulerProfile) DeepCopyInto(out *KubeSchedulerProfile) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
Loading…
Reference in New Issue
Block a user