mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-10 13:42:02 +00:00
Merge pull request #80681 from ricky1993/customize_resource_name_and_namespace
add options for name and namespace of leaderelection object
This commit is contained in:
@@ -257,9 +257,10 @@ func Run(c *config.CompletedConfig, stopCh <-chan struct{}) error {
|
||||
|
||||
// add a uniquifier so that two processes on the same host don't accidentally both become active
|
||||
id = id + "_" + string(uuid.NewUUID())
|
||||
|
||||
rl, err := resourcelock.New(c.ComponentConfig.Generic.LeaderElection.ResourceLock,
|
||||
"kube-system",
|
||||
"kube-controller-manager",
|
||||
c.ComponentConfig.Generic.LeaderElection.ResourceNamespace,
|
||||
c.ComponentConfig.Generic.LeaderElection.ResourceName,
|
||||
c.LeaderElectionClient.CoreV1(),
|
||||
c.LeaderElectionClient.CoordinationV1(),
|
||||
resourcelock.ResourceLockConfig{
|
||||
|
@@ -188,6 +188,8 @@ func NewKubeControllerManagerOptions() (*KubeControllerManagerOptions, error) {
|
||||
}
|
||||
|
||||
s.GarbageCollectorController.GCIgnoredResources = gcIgnoredResources
|
||||
s.Generic.LeaderElection.ResourceName = "kube-controller-manager"
|
||||
s.Generic.LeaderElection.ResourceNamespace = "kube-system"
|
||||
|
||||
return &s, nil
|
||||
}
|
||||
|
@@ -156,11 +156,13 @@ func TestAddFlags(t *testing.T) {
|
||||
},
|
||||
ControllerStartInterval: metav1.Duration{Duration: 2 * time.Minute},
|
||||
LeaderElection: componentbaseconfig.LeaderElectionConfiguration{
|
||||
ResourceLock: "configmap",
|
||||
LeaderElect: false,
|
||||
LeaseDuration: metav1.Duration{Duration: 30 * time.Second},
|
||||
RenewDeadline: metav1.Duration{Duration: 15 * time.Second},
|
||||
RetryPeriod: metav1.Duration{Duration: 5 * time.Second},
|
||||
ResourceLock: "configmap",
|
||||
LeaderElect: false,
|
||||
LeaseDuration: metav1.Duration{Duration: 30 * time.Second},
|
||||
RenewDeadline: metav1.Duration{Duration: 15 * time.Second},
|
||||
RetryPeriod: metav1.Duration{Duration: 5 * time.Second},
|
||||
ResourceName: "kube-controller-manager",
|
||||
ResourceNamespace: "kube-system",
|
||||
},
|
||||
Controllers: []string{"foo", "bar"},
|
||||
},
|
||||
|
Reference in New Issue
Block a user