diff --git a/chart/README.md b/chart/README.md index 53a73791db0c28ca9176f20aaf89a792cbd57fda..c9e06556c4fc3228fbb12ed99cd41b93082a7045 100644 --- a/chart/README.md +++ b/chart/README.md @@ -49,3 +49,9 @@ If you've already deployed hccm using the `helm install` command above, you can ```sh helm upgrade hccm hcloud/hcloud-cloud-controller-manager -n kube-system --set monitoring.podMonitor.enabled=true ``` + +### Multiple replicas + +If you want to use multiple replicas you can change `replicaCount` inside the helm values. + +If you have more than 1 replica leader election will be turned on automatically. diff --git a/chart/templates/deployment.yaml b/chart/templates/deployment.yaml index ed8e3907e6b12a6c4b842701a607b2a1b7e7b8de..190ed0a21f1367826b8e2889ea3aa034d57b13e4 100644 --- a/chart/templates/deployment.yaml +++ b/chart/templates/deployment.yaml @@ -4,7 +4,7 @@ metadata: name: {{ include "hcloud-cloud-controller-manager.name" . }} namespace: {{ .Release.Namespace }} spec: - replicas: 1 + replicas: {{ .Values.replicaCount }} revisionHistoryLimit: 2 selector: matchLabels: @@ -50,6 +50,9 @@ spec: - "--allocate-node-cidrs=true" - "--cluster-cidr={{ $.Values.networking.clusterCIDR }}" {{- end }} + {{- if (eq (int $.Values.replicaCount) 1) }} + - "--leader-elect=false" + {{- end }} env: {{- range $key, $value := $.Values.env }} - name: {{ $key }} diff --git a/chart/values.yaml b/chart/values.yaml index 7402ed15099ce9c814883397f327f7f270e2190e..a16a0fb16e6ace5941e96c4df07fcf04fced0c1f 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -1,8 +1,7 @@ # hccm program command line arguments. -# The "--allocate-node-cidrs" + "--cluster-cidr" arguments are managed by the chart and should *not* be set directly here. +# The "--allocate-node-cidrs" + "--cluster-cidr" + "--leader-elect" arguments are managed by the chart and should *not* be set directly here. args: cloud-provider: hcloud - leader-elect: "false" allow-untagged-cloud: "" # Read issue #395 to understand how changes to this value affect you. @@ -14,6 +13,8 @@ args: # https://github.com/hetznercloud/hcloud-cloud-controller-manager/issues/492 webhook-secure-port: "0" +replicaCount: 1 + # hccm environment variables env: # The following two variables should *not* be set here: diff --git a/deploy/ccm-networks.yaml b/deploy/ccm-networks.yaml index 30b399432c014c190c9c7c665a635c797bcc2b95..0db7ce8efef8fef8ddbc9f5d96d480f80efae04e 100644 --- a/deploy/ccm-networks.yaml +++ b/deploy/ccm-networks.yaml @@ -64,11 +64,11 @@ spec: - "/bin/hcloud-cloud-controller-manager" - "--allow-untagged-cloud" - "--cloud-provider=hcloud" - - "--leader-elect=false" - "--route-reconciliation-period=30s" - "--webhook-secure-port=0" - "--allocate-node-cidrs=true" - "--cluster-cidr=10.244.0.0/16" + - "--leader-elect=false" env: - name: HCLOUD_TOKEN valueFrom: diff --git a/deploy/ccm.yaml b/deploy/ccm.yaml index 51cb5786e12500fe65beda9e9fd95f0bdc2b3542..960a1606b4c8e1ef28290284ea3bd247b094682d 100644 --- a/deploy/ccm.yaml +++ b/deploy/ccm.yaml @@ -63,9 +63,9 @@ spec: - "/bin/hcloud-cloud-controller-manager" - "--allow-untagged-cloud" - "--cloud-provider=hcloud" - - "--leader-elect=false" - "--route-reconciliation-period=30s" - "--webhook-secure-port=0" + - "--leader-elect=false" env: - name: HCLOUD_TOKEN valueFrom: