Skip to content

Commit

Permalink
fix(helm): Add extra args to zfsController containers and leader elec…
Browse files Browse the repository at this point in the history
…tion inteligence (#492)

Added zfsController extraArgs variable to pass extra argumenta to containers command line.

Also adding inteligence to enable leader election only when number of replicas is more than one.

Fixes #486

Signed-off-by: Wagner Sartori Junior <[email protected]>
  • Loading branch information
trunet authored Jan 24, 2024
1 parent 6b0942c commit 15260d6
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 6 deletions.
1 change: 1 addition & 0 deletions changelogs/unreleased/492-trunet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fix(helm): Add extra args to zfsController containers and leader election inteligence
4 changes: 2 additions & 2 deletions deploy/helm/charts/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v2
name: zfs-localpv
description: Helm chart for CSI Driver for dynamic provisioning of ZFS Persistent Local Volumes. For instructions on how to use this helm chart, see - https://openebs.github.io/zfs-localpv/
version: 2.4.0
appVersion: 2.4.0
version: 2.4.1
appVersion: 2.4.1
icon: https://raw.githubusercontent.com/cncf/artwork/master/projects/openebs/icon/color/openebs-icon-color.png
home: https://openebs.io/
keywords:
Expand Down
5 changes: 5 additions & 0 deletions deploy/helm/charts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,21 +99,26 @@ The following table lists the configurable parameters of the OpenEBS ZFS Localpv
| `zfsController.resizer.image.repository`| Image repository for csi-resizer| `sig-storage/csi-resizer`|
| `zfsController.resizer.image.pullPolicy`| Image pull policy for csi-resizer| `IfNotPresent`|
| `zfsController.resizer.image.tag`| Image tag for csi-resizer| `v1.8.0`|
| `zfsController.resizer.extraArgs`| Extra command line arguments| `[]`|
| `zfsController.snapshotter.image.registry`| Registry for csi-snapshotter image| `registry.k8s.io/`|
| `zfsController.snapshotter.image.repository`| Image repository for csi-snapshotter| `sig-storage/csi-snapshotter`|
| `zfsController.snapshotter.image.pullPolicy`| Image pull policy for csi-snapshotter| `IfNotPresent`|
| `zfsController.snapshotter.image.tag`| Image tag for csi-snapshotter| `v6.2.2`|
| `zfsController.snapshotter.extraArgs`| Extra command line arguments| `[]`|
| `zfsController.snapshotController.image.registry`| Registry for snapshot-controller image| `registry.k8s.io/`|
| `zfsController.snapshotController.image.repository`| Image repository for snapshot-controller| `sig-storage/snapshot-controller`|
| `zfsController.snapshotController.image.pullPolicy`| Image pull policy for snapshot-controller| `IfNotPresent`|
| `zfsController.snapshotController.image.tag`| Image tag for snapshot-controller| `v6.2.2`|
| `zfsController.snapshotController.extraArgs`| Extra command line arguments| `[]`|
| `zfsController.provisioner.image.registry`| Registry for csi-provisioner image| `registry.k8s.io/`|
| `zfsController.provisioner.image.repository`| Image repository for csi-provisioner| `sig-storage/csi-provisioner`|
| `zfsController.provisioner.image.pullPolicy`| Image pull policy for csi-provisioner| `IfNotPresent`|
| `zfsController.provisioner.image.tag`| Image tag for csi-provisioner| `v3.5.0`|
| `zfsController.provisioner.extraArgs`| Extra command line arguments| `[]`|
| `zfsController.updateStrategy.type`| Update strategy for zfs localpv controller statefulset | `RollingUpdate` |
| `zfsController.annotations` | Annotations for zfs localpv controller statefulset metadata| `""`|
| `zfsController.podAnnotations`| Annotations for zfs localpv controller statefulset's pods metadata | `""`|
| `zfsController.replicas` | Number of zfs localpv controller replicas | `1` |
| `zfsController.resources`| Resource and request and limit for zfs localpv controller statefulset containers | `""`|
| `zfsController.labels`| Labels for zfs localpv controller statefulset metadata | `""`|
| `zfsController.podLabels`| Appends labels to the zfs localpv controller statefulset pods| `""`|
Expand Down
11 changes: 11 additions & 0 deletions deploy/helm/charts/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,14 @@ Create the name of the priority class for csi controller plugin
{{- printf "%s" .Values.zfsController.priorityClass.name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}

{{/*
Enable zfsController containers leader election if replicas > 1
*/}}
{{- define "zfslocalpv.zfsController.leaderElection" -}}
{{- with .Values.zfsController.replicas | int }}
{{- if gt . 1 }}
- "--leader-election"
{{- end }}
{{- end }}
{{- end }}
20 changes: 16 additions & 4 deletions deploy/helm/charts/templates/zfs-contoller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ spec:
args:
- "--v=5"
- "--csi-address=$(ADDRESS)"
- "--leader-election"
{{- include "zfslocalpv.zfsController.leaderElection" . | indent 12 }}
{{- range .Values.zfsController.resizer.extraArgs }}
- {{ tpl . $ | quote }}
{{- end }}
env:
- name: ADDRESS
value: /var/lib/csi/sockets/pluginproxy/csi.sock
Expand All @@ -65,7 +68,10 @@ spec:
imagePullPolicy: {{ .Values.zfsController.snapshotter.image.pullPolicy }}
args:
- "--csi-address=$(ADDRESS)"
- "--leader-election"
{{- include "zfslocalpv.zfsController.leaderElection" . | indent 12 }}
{{- range .Values.zfsController.snapshotter.extraArgs }}
- {{ tpl . $ | quote }}
{{- end }}
env:
- name: ADDRESS
value: /var/lib/csi/sockets/pluginproxy/csi.sock
Expand All @@ -76,7 +82,10 @@ spec:
image: "{{ .Values.zfsController.snapshotController.image.registry }}{{ .Values.zfsController.snapshotController.image.repository }}:{{ .Values.zfsController.snapshotController.image.tag }}"
args:
- "--v=5"
- "--leader-election=true"
{{- include "zfslocalpv.zfsController.leaderElection" . | indent 12 }}
{{- range .Values.zfsController.snapshotController.extraArgs }}
- {{ tpl . $ | quote }}
{{- end }}
imagePullPolicy: {{ .Values.zfsController.snapshotController.image.pullPolicy }}
- name: {{ .Values.zfsController.provisioner.name }}
image: "{{ .Values.zfsController.provisioner.image.registry }}{{ .Values.zfsController.provisioner.image.repository }}:{{ .Values.zfsController.provisioner.image.tag }}"
Expand All @@ -86,10 +95,13 @@ spec:
- "--v=5"
- "--feature-gates=Topology=true"
- "--strict-topology"
- "--leader-election"
- "--enable-capacity={{ .Values.feature.storageCapacity }}"
- "--extra-create-metadata=true"
- "--default-fstype=ext4"
{{- include "zfslocalpv.zfsController.leaderElection" . | indent 12 }}
{{- range .Values.zfsController.provisioner.extraArgs }}
- {{ tpl . $ | quote }}
{{- end }}
env:
- name: ADDRESS
value: /var/lib/csi/sockets/pluginproxy/csi.sock
Expand Down
4 changes: 4 additions & 0 deletions deploy/helm/charts/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ zfsController:
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: v1.8.0
extraArgs: []
snapshotter:
name: "csi-snapshotter"
image:
Expand All @@ -91,6 +92,7 @@ zfsController:
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: v6.2.2
extraArgs: []
snapshotController:
name: "snapshot-controller"
image:
Expand All @@ -101,6 +103,7 @@ zfsController:
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: v6.2.2
extraArgs: []
provisioner:
name: "csi-provisioner"
image:
Expand All @@ -111,6 +114,7 @@ zfsController:
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: v3.5.0
extraArgs: []
updateStrategy:
type: RollingUpdate
annotations: {}
Expand Down

0 comments on commit 15260d6

Please sign in to comment.