fix nil pointers

This commit is contained in:
Stavros kois
2023-02-13 14:37:59 +02:00
parent e8eda8fc58
commit 46f163cad9
3 changed files with 9 additions and 0 deletions
@@ -14,6 +14,9 @@ revisionHistoryLimit: {{ $objectData.revisionHistoryLimit | default 3 }}
updateStrategy:
type: {{ $objectData.strategy | default "RollingUpdate" }}
{{- if eq $objectData.strategy "RollingUpdate" }}
{{- if not $objectData.rollingUpdate -}} {{/* Create the key if it does not exist, to avoid nil pointers */}}
{{- $_ := set $objectData "rollingUpdate" dict -}}
{{- end }}
rollingUpdate:
maxUnavailable: {{ $objectData.rollingUpdate.maxUnavailable | default $rootCtx.Values.fallbackDefaults.maxUnavailable }}
maxSurge: {{ $objectData.rollingUpdate.maxSurge | default $rootCtx.Values.fallbackDefaults.maxSurge }}
@@ -15,6 +15,9 @@ revisionHistoryLimit: {{ $objectData.revisionHistoryLimit | default 3 }}
strategy:
type: {{ $objectData.strategy | default "Recreate" }}
{{- if eq $objectData.strategy "RollingUpdate" }}
{{- if not $objectData.rollingUpdate -}} {{/* Create the key if it does not exist, to avoid nil pointers */}}
{{- $_ := set $objectData "rollingUpdate" dict -}}
{{- end }}
rollingUpdate:
maxUnavailable: {{ $objectData.rollingUpdate.maxUnavailable | default $rootCtx.Values.fallbackDefaults.maxUnavailable }}
maxSurge: {{ $objectData.rollingUpdate.maxSurge | default $rootCtx.Values.fallbackDefaults.maxSurge }}
@@ -17,6 +17,9 @@ updateStrategy:
type: {{ $objectData.strategy | default "RollingUpdate" }}
{{- if eq $objectData.strategy "RollingUpdate" }}
rollingUpdate:
{{- if not $objectData.rollingUpdate -}} {{/* Create the key if it does not exist, to avoid nil pointers */}}
{{- $_ := set $objectData "rollingUpdate" dict -}}
{{- end }}
maxUnavailable: {{ $objectData.rollingUpdate.maxUnavailable | default $rootCtx.Values.fallbackDefaults.maxUnavailable }}
partition: {{ $objectData.rollingUpdate.partition | default $rootCtx.Values.fallbackDefaults.partition }}
{{- end -}}