Skip to content

Commit

Permalink
Merge pull request #109 from pohly/leader-election-1.24
Browse files Browse the repository at this point in the history
leader election: remove obsolete ConfigMapsResourceLock and EndpointsResourceLock
  • Loading branch information
k8s-ci-robot authored Mar 4, 2022
2 parents 24345a2 + 7513031 commit 071361c
Showing 1 changed file with 1 addition and 28 deletions.
29 changes: 1 addition & 28 deletions leaderelection/leader_election.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 071361c

Please sign in to comment.