Skip to content

Commit 24282a0

Browse files
committed
Added flag for leader election
1 parent eb0172e commit 24282a0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cmd/csi-provisioner/csi-provisioner.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@ var (
4848
provisioner = flag.String("provisioner", "", "Name of the provisioner. The provisioner will only provision volumes for claims that request a StorageClass with a provisioner field set equal to this name.")
4949
master = flag.String("master", "", "Master URL to build a client config from. Either this or kubeconfig needs to be set if the provisioner is being run out of cluster.")
5050
kubeconfig = flag.String("kubeconfig", "", "Absolute path to the kubeconfig file. Either this or master needs to be set if the provisioner is being run out of cluster.")
51-
csiEndpoint = flag.String("csi-address", "/run/csi/socket", "The gRPC endpoint for Target CSI Volume")
51+
csiEndpoint = flag.String("csi-address", "/run/csi/socket", "The gRPC endpoint for Target CSI Volume.")
5252
connectionTimeout = flag.Duration("connection-timeout", 10*time.Second, "Timeout for waiting for CSI driver socket.")
53-
volumeNamePrefix = flag.String("volume-name-prefix", "pvc", "Prefix to apply to the name of a created volume")
53+
volumeNamePrefix = flag.String("volume-name-prefix", "pvc", "Prefix to apply to the name of a created volume.")
5454
volumeNameUUIDLength = flag.Int("volume-name-uuid-length", -1, "Truncates generated UUID of a created volume to this length. Defaults behavior is to NOT truncate.")
5555
showVersion = flag.Bool("version", false, "Show version.")
56+
enableLeaderElection = flag.Bool("enable-leader-election", false, "Enables leader election. If leader election is enabled, additional RBAC rules are required. Please refer to the Kubernetes CSI documentation for instructions on setting up these RBAC rules.")
5657
featureGates map[string]bool
5758

5859
provisionController *controller.ProvisionController
@@ -143,6 +144,7 @@ func init() {
143144
*provisioner,
144145
csiProvisioner,
145146
serverVersion.GitVersion,
147+
controller.LeaderElection(*enableLeaderElection),
146148
)
147149
}
148150

0 commit comments

Comments
 (0)