_terminationGracePeriodSeconds.tpl 939 B

1234567891011121314151617181920212223242526272829
  1. {{/* Returns Termination Grace Period Seconds */}}
  2. {{/* Call this template:
  3. {{ include "ix.v1.common.lib.pod.terminationGracePeriodSeconds" (dict "rootCtx" $ "objectData" $objectData) }}
  4. rootCtx: The root context of the chart.
  5. objectData: The object data to be used to render the Pod.
  6. */}}
  7. {{- define "ix.v1.common.lib.pod.terminationGracePeriodSeconds" -}}
  8. {{- $rootCtx := .rootCtx -}}
  9. {{- $objectData := .objectData -}}
  10. {{- $gracePeriod := "" -}}
  11. {{/* Initialize from the "global" option */}}
  12. {{- with $rootCtx.Values.podOptions.terminationGracePeriodSeconds -}}
  13. {{- $gracePeriod = . -}}
  14. {{- end -}}
  15. {{/* Override with pod's option */}}
  16. {{- with $objectData.podSpec.terminationGracePeriodSeconds -}}
  17. {{- $gracePeriod = . -}}
  18. {{- end -}}
  19. {{/* Expand tpl */}}
  20. {{- if (kindIs "string" $gracePeriod) -}}
  21. {{- $gracePeriod = tpl $gracePeriod $rootCtx -}}
  22. {{- end -}}
  23. {{- $gracePeriod -}}
  24. {{- end -}}