From 4689c21cb46ded08929c7d43270633f5e4714016 Mon Sep 17 00:00:00 2001 From: Pawan Date: Tue, 31 Dec 2019 16:54:50 +0530 Subject: [PATCH] feat(HA): adding support to have controller in HA We can have more than one controller in the system, but only one will be the master and others will be slave. Once master is down, one of the slave will take over via lease mechanism and start provisioning/deprovisioning the volumes. Signed-off-by: Pawan --- deploy/zfs-operator.yaml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/deploy/zfs-operator.yaml b/deploy/zfs-operator.yaml index 75aee0a8..0c486300 100644 --- a/deploy/zfs-operator.yaml +++ b/deploy/zfs-operator.yaml @@ -82,6 +82,9 @@ rules: - apiGroups: [""] resources: ["events"] verbs: ["list", "watch", "create", "update", "patch"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "watch", "list", "delete", "update", "create"] - apiGroups: ["*"] resources: ["zfsvolumes"] verbs: ["*"] @@ -112,7 +115,7 @@ spec: app: openebs-zfs-controller role: openebs-zfs serviceName: "openebs-zfs" - replicas: 1 + replicas: 2 template: metadata: labels: @@ -130,6 +133,8 @@ spec: - "--v=5" - "--feature-gates=Topology=true" - "--strict-topology" + - "--enable-leader-election" + - "--leader-election-type=leases" env: - name: ADDRESS value: /var/lib/csi/sockets/pluginproxy/csi.sock @@ -142,6 +147,7 @@ spec: args: - "--v=5" - "--csi-address=$(ADDRESS)" + - "--leader-election" env: - name: ADDRESS value: /var/lib/csi/sockets/pluginproxy/csi.sock @@ -201,7 +207,9 @@ rules: - apiGroups: ["storage.k8s.io"] resources: ["volumeattachments", "csinodes"] verbs: ["get", "list", "watch", "update", "patch"] - + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "watch", "list", "delete", "update", "create"] --- kind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1