Skip to content

Commit 2727afd

Browse files
committed
update README, examples and RBAC to include leader election
1 parent f3cbc7f commit 2727afd

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ It is necessary to create a new service account and give it enough privileges to
4848
for i in $(find deploy/kubernetes -name '*.yaml'); do kubectl create -f $i; done
4949
```
5050

51+
### Running with Leader Election
52+
53+
If you want to run external-snapshotter with higher availability, you can enable resource based leader election. To enable this, set the following flags:
54+
```bash
55+
--leader-election=true
56+
```
57+
5158
## Testing
5259

5360
Running Unit Tests:

deploy/kubernetes/rbac-external-provisioner.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ roleRef:
5959
apiGroup: rbac.authorization.k8s.io
6060

6161
---
62-
# Provisioner must be able to work with endpoints in current namespace
62+
# Provisioner must be able to work with endpoints and leases in current namespace
6363
# if (and only if) leadership election is enabled
6464
kind: Role
6565
apiVersion: rbac.authorization.k8s.io/v1
@@ -71,6 +71,9 @@ rules:
7171
- apiGroups: [""]
7272
resources: ["endpoints"]
7373
verbs: ["get", "watch", "list", "delete", "update", "create"]
74+
- apiGroups: ["coordination.k8s.io"]
75+
resources: ["leases"]
76+
verbs: ["get", "watch", "list", "delete", "update", "create"]
7477

7578
---
7679
kind: RoleBinding

deploy/kubernetes/rbac.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ rules:
4747
- apiGroups: ["apiextensions.k8s.io"]
4848
resources: ["customresourcedefinitions"]
4949
verbs: ["create", "list", "watch", "delete"]
50+
# access to leases is required for leader election
51+
- apiGroups: ["coordination.k8s.io"]
52+
resources: ["leases"]
53+
verbs: ["get", "watch", "list", "delete", "update", "create"]
5054

5155
---
5256
kind: ClusterRoleBinding

deploy/kubernetes/setup-csi-snapshotter.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ spec:
8989
args:
9090
- "--csi-address=$(ADDRESS)"
9191
- "--connection-timeout=15s"
92+
- "--leader-election=true"
9293
env:
9394
- name: ADDRESS
9495
value: /csi/csi.sock

0 commit comments

Comments
 (0)