Skip to content

Commit

Permalink
Avoid generating empty "strategy:"
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianeicher committed Jul 8, 2024
1 parent b3800de commit 66639a0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion charts/generic-service/templates/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ spec:
selector:
matchLabels: {{- include "generic-service.selector-labels" . | nindent 6 }}

strategy:
{{- if eq .Values.rollout.strategy "RollingUpdate" }}
{{- if eq .Values.rollout.controller "ArgoRollout" }}
{{ fail "rollout.strategy cannot be RollingUpdate if rollout.controller is ArgoRollout, must be Canary or BlueGreen" }}
Expand All @@ -44,11 +43,13 @@ spec:
{{- if eq .Values.rollout.controller "ArgoRollout" }}
{{ fail "rollout.strategy cannot be Recreate if rollout.controller is ArgoRollout, must be Canary or BlueGreen" }}
{{- end }}
strategy:
type: Recreate
{{- else if eq .Values.rollout.strategy "OnDelete" }}
{{- if and (ne .Values.rollout.controller "StatefulSet") (ne .Values.rollout.controller "DaemonSet") }}
{{ fail "rollout.strategy may only be OnDelete if rollout.controller is StatefulSet or DaemonSet" }}
{{- end }}
strategy:
type: OnDelete
{{- else if eq .Values.rollout.strategy "Canary" }}
{{- if not .Values.ingress.enabled }}
Expand All @@ -58,6 +59,7 @@ spec:
{{ fail "ingress.domains must not be empty if rollout.strategy is Canary" }}
{{- end }}
{{- if eq .Values.rollout.controller "ArgoRollout" }}
strategy:
canary:
stableService: {{ include "generic-service.fullname" . }}
stableMetadata:
Expand Down Expand Up @@ -87,6 +89,7 @@ spec:
{{ fail "ingress.enabled must be true if rollout.strategy is BlueGreen" }}
{{- end }}
{{- if eq .Values.rollout.controller "ArgoRollout" }}
strategy:
blueGreen:
activeService: {{ include "generic-service.fullname" . }}
activeMetadata:
Expand Down

0 comments on commit 66639a0

Please sign in to comment.