Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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