...
1
16
17 package options
18
19 import (
20 "github.com/spf13/pflag"
21 "k8s.io/component-base/config"
22 )
23
24
25 func BindLeaderElectionFlags(l *config.LeaderElectionConfiguration, fs *pflag.FlagSet) {
26 fs.BoolVar(&l.LeaderElect, "leader-elect", l.LeaderElect, ""+
27 "Start a leader election client and gain leadership before "+
28 "executing the main loop. Enable this when running replicated "+
29 "components for high availability.")
30 fs.DurationVar(&l.LeaseDuration.Duration, "leader-elect-lease-duration", l.LeaseDuration.Duration, ""+
31 "The duration that non-leader candidates will wait after observing a leadership "+
32 "renewal until attempting to acquire leadership of a led but unrenewed leader "+
33 "slot. This is effectively the maximum duration that a leader can be stopped "+
34 "before it is replaced by another candidate. This is only applicable if leader "+
35 "election is enabled.")
36 fs.DurationVar(&l.RenewDeadline.Duration, "leader-elect-renew-deadline", l.RenewDeadline.Duration, ""+
37 "The interval between attempts by the acting master to renew a leadership slot "+
38 "before it stops leading. This must be less than the lease duration. "+
39 "This is only applicable if leader election is enabled.")
40 fs.DurationVar(&l.RetryPeriod.Duration, "leader-elect-retry-period", l.RetryPeriod.Duration, ""+
41 "The duration the clients should wait between attempting acquisition and renewal "+
42 "of a leadership. This is only applicable if leader election is enabled.")
43 fs.StringVar(&l.ResourceLock, "leader-elect-resource-lock", l.ResourceLock, ""+
44 "The type of resource object that is used for locking during "+
45 "leader election. Supported options are 'leases', 'endpointsleases' "+
46 "and 'configmapsleases'.")
47 fs.StringVar(&l.ResourceName, "leader-elect-resource-name", l.ResourceName, ""+
48 "The name of resource object that is used for locking during "+
49 "leader election.")
50 fs.StringVar(&l.ResourceNamespace, "leader-elect-resource-namespace", l.ResourceNamespace, ""+
51 "The namespace of resource object that is used for locking during "+
52 "leader election.")
53 }
54
View as plain text