From 75130319c9042d67bf4078c2d1a53806f17f2365 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Thu, 3 Mar 2022 20:10:07 +0100 Subject: [PATCH] leader election: remove obsolete ConfigMapsResourceLock and EndpointsResourceLock Kubernetes 1.24 won't support those anymore. To support building with a newer client-go, csi-lib-utils must not reference the removed constants. This doesn't affect the sidecars because those only use the default NewLeaderElection. --- leaderelection/leader_election.go | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/leaderelection/leader_election.go b/leaderelection/leader_election.go index 5db61ca18..8c32f30c7 100644 --- a/leaderelection/leader_election.go +++ b/leaderelection/leader_election.go @@ -61,8 +61,7 @@ type leaderElection struct { // the namespace to store the lock resource namespace string // resourceLock defines the type of leaderelection that should be used - // valid options are resourcelock.LeasesResourceLock, resourcelock.EndpointsResourceLock, - // and resourcelock.ConfigMapsResourceLock + // Only resourcelock.LeasesResourceLock is valid at the moment. resourceLock string // healthCheck reports unhealthy if leader election fails to renew leadership // within a timeout period. @@ -95,32 +94,6 @@ func NewLeaderElectionWithLeases(clientset kubernetes.Interface, lockName string } } -// NewLeaderElectionWithEndpoints returns an implementation of leader election using Endpoints -func NewLeaderElectionWithEndpoints(clientset kubernetes.Interface, lockName string, runFunc func(ctx context.Context)) *leaderElection { - return &leaderElection{ - runFunc: runFunc, - lockName: lockName, - resourceLock: resourcelock.EndpointsResourceLock, - leaseDuration: defaultLeaseDuration, - renewDeadline: defaultRenewDeadline, - retryPeriod: defaultRetryPeriod, - clientset: clientset, - } -} - -// NewLeaderElectionWithConfigMaps returns an implementation of leader election using ConfigMaps -func NewLeaderElectionWithConfigMaps(clientset kubernetes.Interface, lockName string, runFunc func(ctx context.Context)) *leaderElection { - return &leaderElection{ - runFunc: runFunc, - lockName: lockName, - resourceLock: resourcelock.ConfigMapsResourceLock, - leaseDuration: defaultLeaseDuration, - renewDeadline: defaultRenewDeadline, - retryPeriod: defaultRetryPeriod, - clientset: clientset, - } -} - func (l *leaderElection) WithIdentity(identity string) { l.identity = identity }