33 lines
989 B
YAML
33 lines
989 B
YAML
{{/* vim: set filetype=mustache: */}}
|
|
|
|
{{- define "common.pdb.tpl" -}}
|
|
{{- $top := first . -}}
|
|
{{- $pdb := index . 1 -}}
|
|
apiVersion: policy/v1beta1
|
|
kind: PodDisruptionBudget
|
|
metadata:
|
|
{{- include "common.metadata" (list $top) | nindent 2 }}
|
|
spec:
|
|
selector:
|
|
matchLabels:
|
|
{{- include "common.selectorLabels" $top | nindent 6 }}
|
|
{{- if not (or (empty $pdb.minAvailable) (empty $pdb.maxUnavailable)) -}}
|
|
{{- fail "minAvailable and maxUnavailable can not be set together" }}
|
|
{{- end -}}
|
|
{{- with $pdb.minAvailable }}
|
|
minAvailable: {{ . }}
|
|
{{- end }}
|
|
{{- with $pdb.maxUnavailable }}
|
|
maxUnavailable: {{ . }}
|
|
{{- end }}
|
|
{{- end -}}
|
|
|
|
{{- define "common.pdb" -}}
|
|
{{- $top := first . -}}
|
|
{{- $deployment := index . 2 -}}
|
|
{{- $autoscaling := index . 3 -}}
|
|
{{- if or (and $autoscaling.enabled (gt ($autoscaling.minReplicas | int) 1)) (gt ($deployment.replicaCount | int) 1) }}
|
|
{{- include "common.utils.merge" (append . "common.pdb.tpl") -}}
|
|
{{- end -}}
|
|
{{- end -}}
|