Recreate deployment if volumes used with a single replica to avoid stuck pods
This commit is contained in:
@@ -10,6 +10,11 @@ spec:
|
|||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
{{- include "helm-chart.selectorLabels" . | nindent 6 }}
|
{{- include "helm-chart.selectorLabels" . | nindent 6 }}
|
||||||
|
{{- $singleReplica := eq (.Values.replicas | int64) 1 }}
|
||||||
|
{{- if and .Values.volumes $singleReplica }}
|
||||||
|
strategy:
|
||||||
|
type: Recreate
|
||||||
|
{{- end }}
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
|
|||||||
@@ -31,3 +31,14 @@ tests:
|
|||||||
- name: data
|
- name: data
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: RELEASE-NAME-data
|
claimName: RELEASE-NAME-data
|
||||||
|
- it: Should recreate to avoid stuck deployments
|
||||||
|
set:
|
||||||
|
volumes:
|
||||||
|
- name: data
|
||||||
|
path: /var/lib/1clickinfra/data
|
||||||
|
size: 10Gi
|
||||||
|
storageClass: default
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.strategy.type
|
||||||
|
value: Recreate
|
||||||
|
|||||||
Reference in New Issue
Block a user