mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Migrate components to EndpointsLeases leader election lock
This commit is contained in:
parent
7d13dfe3c3
commit
ce499ac286
@ -49,7 +49,7 @@ func TestDefaultFlags(t *testing.T) {
|
|||||||
},
|
},
|
||||||
ControllerStartInterval: metav1.Duration{Duration: 0},
|
ControllerStartInterval: metav1.Duration{Duration: 0},
|
||||||
LeaderElection: componentbaseconfig.LeaderElectionConfiguration{
|
LeaderElection: componentbaseconfig.LeaderElectionConfiguration{
|
||||||
ResourceLock: "endpoints",
|
ResourceLock: "endpointsleases",
|
||||||
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},
|
||||||
|
@ -266,7 +266,7 @@ pluginConfig:
|
|||||||
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: "endpoints",
|
ResourceLock: "endpointsleases",
|
||||||
ResourceNamespace: "kube-system",
|
ResourceNamespace: "kube-system",
|
||||||
ResourceName: "kube-scheduler",
|
ResourceName: "kube-scheduler",
|
||||||
},
|
},
|
||||||
@ -348,7 +348,7 @@ pluginConfig:
|
|||||||
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: "endpoints",
|
ResourceLock: "endpointsleases",
|
||||||
ResourceNamespace: "kube-system",
|
ResourceNamespace: "kube-system",
|
||||||
ResourceName: "kube-scheduler",
|
ResourceName: "kube-scheduler",
|
||||||
},
|
},
|
||||||
@ -411,7 +411,7 @@ pluginConfig:
|
|||||||
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: "endpoints",
|
ResourceLock: "endpointsleases",
|
||||||
ResourceNamespace: "kube-system",
|
ResourceNamespace: "kube-system",
|
||||||
ResourceName: "kube-scheduler",
|
ResourceName: "kube-scheduler",
|
||||||
},
|
},
|
||||||
|
@ -126,6 +126,10 @@ func RecommendedDefaultGenericControllerManagerConfiguration(obj *kubectrlmgrcon
|
|||||||
obj.Controllers = []string{"*"}
|
obj.Controllers = []string{"*"}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(obj.LeaderElection.ResourceLock) == 0 {
|
||||||
|
obj.LeaderElection.ResourceLock = "endpointsleases"
|
||||||
|
}
|
||||||
|
|
||||||
// Use the default ClientConnectionConfiguration and LeaderElectionConfiguration options
|
// Use the default ClientConnectionConfiguration and LeaderElectionConfiguration options
|
||||||
componentbaseconfigv1alpha1.RecommendedDefaultClientConnectionConfiguration(&obj.ClientConnection)
|
componentbaseconfigv1alpha1.RecommendedDefaultClientConnectionConfiguration(&obj.ClientConnection)
|
||||||
componentbaseconfigv1alpha1.RecommendedDefaultLeaderElectionConfiguration(&obj.LeaderElection)
|
componentbaseconfigv1alpha1.RecommendedDefaultLeaderElectionConfiguration(&obj.LeaderElection)
|
||||||
|
@ -73,6 +73,9 @@ func SetDefaults_KubeSchedulerConfiguration(obj *kubeschedulerconfigv1alpha1.Kub
|
|||||||
obj.MetricsBindAddress = net.JoinHostPort("0.0.0.0", strconv.Itoa(ports.InsecureSchedulerPort))
|
obj.MetricsBindAddress = net.JoinHostPort("0.0.0.0", strconv.Itoa(ports.InsecureSchedulerPort))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(obj.LeaderElection.ResourceLock) == 0 {
|
||||||
|
obj.LeaderElection.ResourceLock = "endpointsleases"
|
||||||
|
}
|
||||||
if len(obj.LeaderElection.LockObjectNamespace) == 0 && len(obj.LeaderElection.ResourceNamespace) == 0 {
|
if len(obj.LeaderElection.LockObjectNamespace) == 0 && len(obj.LeaderElection.ResourceNamespace) == 0 {
|
||||||
obj.LeaderElection.LockObjectNamespace = kubeschedulerconfigv1alpha1.SchedulerDefaultLockObjectNamespace
|
obj.LeaderElection.LockObjectNamespace = kubeschedulerconfigv1alpha1.SchedulerDefaultLockObjectNamespace
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,7 @@ func RecommendedDefaultLeaderElectionConfiguration(obj *LeaderElectionConfigurat
|
|||||||
obj.RetryPeriod = metav1.Duration{Duration: 2 * time.Second}
|
obj.RetryPeriod = metav1.Duration{Duration: 2 * time.Second}
|
||||||
}
|
}
|
||||||
if obj.ResourceLock == "" {
|
if obj.ResourceLock == "" {
|
||||||
|
// TODO: Migrate to LeaseLock.
|
||||||
obj.ResourceLock = EndpointsResourceLock
|
obj.ResourceLock = EndpointsResourceLock
|
||||||
}
|
}
|
||||||
if obj.LeaderElect == nil {
|
if obj.LeaderElect == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user