From 4b18ee55b7d7b3ad7df2ad14e88a56c7fc7bb1b6 Mon Sep 17 00:00:00 2001 From: Simon Ostendorf <github@simon-ostendorf.de> Date: Thu, 24 Aug 2023 10:57:45 +0200 Subject: [PATCH] feat(charts): add replica count (#498) This adds configurable replicas to the helm chart. --- chart/README.md | 6 ++++++ chart/templates/deployment.yaml | 5 ++++- chart/values.yaml | 5 +++-- deploy/ccm-networks.yaml | 2 +- deploy/ccm.yaml | 2 +- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/chart/README.md b/chart/README.md index 53a73791..c9e06556 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 ed8e3907..190ed0a2 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 7402ed15..a16a0fb1 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 30b39943..0db7ce8e 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 51cb5786..960a1606 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: -- GitLab