From 5926c2fd1c25e0f695487cb8513b867504c8b44f Mon Sep 17 00:00:00 2001 From: Marcell Sevcsik Date: Mon, 1 Jul 2024 10:38:01 +0200 Subject: [PATCH 1/3] Make csidriver updateStrategy configurable --- .../templates/Common/csi/daemonset.yaml | 4 +-- .../tests/Common/csi/daemonset_test.yaml | 31 +++++++++++++++++++ config/helm/chart/default/values.yaml | 4 +++ 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/config/helm/chart/default/templates/Common/csi/daemonset.yaml b/config/helm/chart/default/templates/Common/csi/daemonset.yaml index 6de25c1290..2512e2c9bf 100644 --- a/config/helm/chart/default/templates/Common/csi/daemonset.yaml +++ b/config/helm/chart/default/templates/Common/csi/daemonset.yaml @@ -272,7 +272,5 @@ spec: operator: Exists effect: NoSchedule updateStrategy: - rollingUpdate: - maxUnavailable: 1 - type: RollingUpdate + {{- toYaml .Values.csidriver.updateStrategy | nindent 4 }} {{- end -}} diff --git a/config/helm/chart/default/tests/Common/csi/daemonset_test.yaml b/config/helm/chart/default/tests/Common/csi/daemonset_test.yaml index 35b5e57501..94c2dca116 100644 --- a/config/helm/chart/default/tests/Common/csi/daemonset_test.yaml +++ b/config/helm/chart/default/tests/Common/csi/daemonset_test.yaml @@ -373,6 +373,37 @@ tests: - emptyDir: { } name: tmp-dir + - it: should have default updateStrategy + set: + platform: kubernetes + image: image-name + csidriver.enabled: true + asserts: + - isNotEmpty: + path: spec.updateStrategy + - equal: + path: spec.updateStrategy + value: + rollingUpdate: + maxUnavailable: 1 + type: RollingUpdate + + - it: updateStrategy should be configurable + set: + platform: kubernetes + image: image-name + csidriver.enabled: true + csidriver.updateStrategy.rollingUpdate.maxUnavailable: 3 + asserts: + - isNotEmpty: + path: spec.updateStrategy + - equal: + path: spec.updateStrategy + value: + rollingUpdate: + maxUnavailable: 3 + type: RollingUpdate + - it: should have imagePullSecrets defined in spec set: platform: kubernetes diff --git a/config/helm/chart/default/values.yaml b/config/helm/chart/default/values.yaml index 2f9533543a..f71cd83a63 100644 --- a/config/helm/chart/default/values.yaml +++ b/config/helm/chart/default/values.yaml @@ -105,6 +105,10 @@ csidriver: operator: Exists labels: [] annotations: [] + updateStrategy: + rollingUpdate: + maxUnavailable: 1 + type: RollingUpdate csiInit: securityContext: runAsUser: 0 From dc641c4bb7386f4ec1161088068c50782e43c613 Mon Sep 17 00:00:00 2001 From: Marcell Sevcsik Date: Mon, 1 Jul 2024 10:42:33 +0200 Subject: [PATCH 2/3] Add extra test --- .../chart/default/tests/Common/csi/daemonset_test.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/config/helm/chart/default/tests/Common/csi/daemonset_test.yaml b/config/helm/chart/default/tests/Common/csi/daemonset_test.yaml index 94c2dca116..6fe641a0cb 100644 --- a/config/helm/chart/default/tests/Common/csi/daemonset_test.yaml +++ b/config/helm/chart/default/tests/Common/csi/daemonset_test.yaml @@ -404,6 +404,16 @@ tests: maxUnavailable: 3 type: RollingUpdate + - it: updateStrategy can be null + set: + platform: kubernetes + image: image-name + csidriver.enabled: true + csidriver.updateStrategy: null + asserts: + - isEmpty: + path: spec.updateStrategy + - it: should have imagePullSecrets defined in spec set: platform: kubernetes From 462c1d1225a9537729f90be8a70ab6cbbf49cefe Mon Sep 17 00:00:00 2001 From: Marcell Sevcsik Date: Mon, 1 Jul 2024 15:05:09 +0200 Subject: [PATCH 3/3] Set maxSurge explicitly --- config/helm/chart/default/tests/Common/csi/daemonset_test.yaml | 2 ++ config/helm/chart/default/values.yaml | 1 + 2 files changed, 3 insertions(+) diff --git a/config/helm/chart/default/tests/Common/csi/daemonset_test.yaml b/config/helm/chart/default/tests/Common/csi/daemonset_test.yaml index 6fe641a0cb..c1176b24d1 100644 --- a/config/helm/chart/default/tests/Common/csi/daemonset_test.yaml +++ b/config/helm/chart/default/tests/Common/csi/daemonset_test.yaml @@ -385,6 +385,7 @@ tests: path: spec.updateStrategy value: rollingUpdate: + maxSurge: 0 maxUnavailable: 1 type: RollingUpdate @@ -401,6 +402,7 @@ tests: path: spec.updateStrategy value: rollingUpdate: + maxSurge: 0 maxUnavailable: 3 type: RollingUpdate diff --git a/config/helm/chart/default/values.yaml b/config/helm/chart/default/values.yaml index f71cd83a63..e3d4d8d631 100644 --- a/config/helm/chart/default/values.yaml +++ b/config/helm/chart/default/values.yaml @@ -107,6 +107,7 @@ csidriver: annotations: [] updateStrategy: rollingUpdate: + maxSurge: 0 maxUnavailable: 1 type: RollingUpdate csiInit: