k8s/helm-charts/dashy/charts/common/templates/lib/pod/_terminationGracePeriodSeconds.tpl
root 1eaf295724
Some checks failed
continuous-integration/drone/push Build is failing
new way of doin
2023-11-16 19:42:02 +10:00

30 lines
939 B
Smarty

{{/* Returns Termination Grace Period Seconds */}}
{{/* Call this template:
{{ include "tc.v1.common.lib.pod.terminationGracePeriodSeconds" (dict "rootCtx" $ "objectData" $objectData) }}
rootCtx: The root context of the chart.
objectData: The object data to be used to render the Pod.
*/}}
{{- define "tc.v1.common.lib.pod.terminationGracePeriodSeconds" -}}
{{- $rootCtx := .rootCtx -}}
{{- $objectData := .objectData -}}
{{- $gracePeriod := "" -}}
{{/* Initialize from the "global" option */}}
{{- with $rootCtx.Values.podOptions.terminationGracePeriodSeconds -}}
{{- $gracePeriod = . -}}
{{- end -}}
{{/* Override with pod's option */}}
{{- with $objectData.podSpec.terminationGracePeriodSeconds -}}
{{- $gracePeriod = . -}}
{{- end -}}
{{/* Expand tpl */}}
{{- if (kindIs "string" $gracePeriod) -}}
{{- $gracePeriod = tpl $gracePeriod $rootCtx -}}
{{- end -}}
{{- $gracePeriod -}}
{{- end -}}