diff --git a/charts/onechart/templates/deployment.yaml b/charts/onechart/templates/deployment.yaml index 776fa78..5255f37 100644 --- a/charts/onechart/templates/deployment.yaml +++ b/charts/onechart/templates/deployment.yaml @@ -15,10 +15,15 @@ spec: matchLabels: {{- include "helm-chart.selectorLabels" . | nindent 6 }} {{- $singleReplica := eq (.Values.replicas | int64) 1 }} - {{- if and .Values.volumes $singleReplica }} + {{- $strategyNotDefined := not .Values.strategy }} + {{- if and (and .Values.volumes $singleReplica) $strategyNotDefined}} strategy: type: Recreate {{- end }} + {{- if .Values.strategy }} + strategy: + type: {{ .Values.strategy }} + {{- end }} template: metadata: annotations: diff --git a/charts/onechart/tests/deployment_volumes_test.yaml b/charts/onechart/tests/deployment_volumes_test.yaml index 13238d9..766499f 100644 --- a/charts/onechart/tests/deployment_volumes_test.yaml +++ b/charts/onechart/tests/deployment_volumes_test.yaml @@ -42,3 +42,22 @@ tests: - equal: path: spec.strategy.type value: Recreate + - it: Should strategy take precedence + set: + volumes: + - name: data + path: /var/lib/1clickinfra/data + size: 10Gi + storageClass: default + strategy: RollingUpdate + asserts: + - equal: + path: spec.strategy.type + value: RollingUpdate + - it: Should strategy be set + set: + strategy: Dummy + asserts: + - equal: + path: spec.strategy.type + value: Dummy \ No newline at end of file