my-apps/charts/common/templates/lib/workload/_daemonsetSpec.tpl
2025-08-24 00:09:37 +03:00

31 lines
1.3 KiB
Smarty

{{/* DaemonSet Spec */}}
{{/* Call this template:
{{ include "tc.v1.common.lib.workload.daemonsetSpec" (dict "rootCtx" $rootCtx "objectData" $objectData) -}}
rootCtx: The root context of the chart.
objectData:
revisionHistoryLimit: The number of old ReplicaSets to retain to allow rollback.
strategy: The daemonset strategy to use to replace existing pods with new ones.
*/}}
{{- define "tc.v1.common.lib.workload.daemonsetSpec" -}}
{{- $objectData := .objectData -}}
{{- $rootCtx := .rootCtx -}}
{{- include "tc.v1.common.lib.workload.components.strategyType" (dict
"rootCtx" $rootCtx "objectData" $objectData
"defaultStrategy" "RollingUpdate" "resource" "DaemonSet"
) }}
revisionHistoryLimit: {{ $objectData.revisionHistoryLimit | default 3 }}
updateStrategy:
type: {{ $objectData.strategy }}
{{- if and (eq $objectData.strategy "RollingUpdate") $objectData.rollingUpdate -}}
{{ if (or (hasKey $objectData.rollingUpdate "maxUnavailable") (hasKey $objectData.rollingUpdate "maxSurge")) }}
rollingUpdate:
{{- if hasKey $objectData.rollingUpdate "maxUnavailable" }}
maxUnavailable: {{ $objectData.rollingUpdate.maxUnavailable }}
{{- end -}}
{{- if hasKey $objectData.rollingUpdate "maxSurge" }}
maxSurge: {{ $objectData.rollingUpdate.maxSurge }}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}