Deployment strategy is configurable; still having the single replica volume rule

This commit is contained in:
Laszlo Fogas
2021-07-27 10:02:46 +02:00
parent 0a162de948
commit d0d0b28c9a
2 changed files with 25 additions and 1 deletions
+6 -1
View File
@@ -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:
@@ -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