diff --git a/changelog/v0.38.6/fix-conditional-strategy.yaml b/changelog/v0.38.6/fix-conditional-strategy.yaml new file mode 100644 index 000000000..53c699489 --- /dev/null +++ b/changelog/v0.38.6/fix-conditional-strategy.yaml @@ -0,0 +1,7 @@ +changelog: + - type: FIX + issueLink: https://github.com/solo-io/gloo-mesh-enterprise/issues/15710 + resolvesIssue: false + description: | + Avoid setting deployment strategy to null when no condition is evaluated. + skipCI: false diff --git a/codegen/templates/chart/operator-deployment.yamltmpl b/codegen/templates/chart/operator-deployment.yamltmpl index 5875d8dff..965053d30 100644 --- a/codegen/templates/chart/operator-deployment.yamltmpl +++ b/codegen/templates/chart/operator-deployment.yamltmpl @@ -65,9 +65,9 @@ spec: strategy: [[ toYaml $strategy | indent 4 ]] [[- else if $conditionalStrategy ]] - strategy: [[- range $s := $conditionalStrategy ]] {{- if [[ $s.Condition ]] }} + strategy: [[ toYaml $s.Strategy | indent 4 ]] {{- end }} [[- end ]] diff --git a/codegen/test/chart-conditional-deployment-strategy/templates/deployment.yaml b/codegen/test/chart-conditional-deployment-strategy/templates/deployment.yaml index f44f6b136..9c9ab1ae6 100644 --- a/codegen/test/chart-conditional-deployment-strategy/templates/deployment.yaml +++ b/codegen/test/chart-conditional-deployment-strategy/templates/deployment.yaml @@ -21,11 +21,12 @@ spec: selector: matchLabels: app: painter - strategy: {{- if $.Values.painter.condition }} + strategy: type: RollingUpdate {{- end }} {{- if not $.Values.painter.condition }} + strategy: type: Recreate {{- end }} template: