pdb.yaml 798 B

1234567891011121314151617181920212223242526
  1. {{- $ctx := dict "helm" . }}
  2. {{- range $name, $app := .Values }}
  3. {{- if and (kindIs "map" $app) $app.enabled ($app.podDisruptionBudget).enabled }}
  4. {{- $pdb := $app.podDisruptionBudget }}
  5. {{- $_ := set $ctx "extraLabels" $pdb.labels }}
  6. {{- $_ := set $ctx "appKey" $name }}
  7. {{- $fullname := include "vm.plain.fullname" $ctx }}
  8. ---
  9. apiVersion: policy/v1
  10. kind: PodDisruptionBudget
  11. metadata:
  12. name: {{ $fullname }}
  13. namespace: {{ include "vm.namespace" $ }}
  14. labels: {{ include "vm.labels" $ctx | nindent 4 }}
  15. {{- $_ := unset $ctx "extraLabels" }}
  16. spec:
  17. {{- with $pdb.minAvailable }}
  18. minAvailable: {{ . }}
  19. {{- end }}
  20. {{- with $pdb.maxUnavailable }}
  21. maxUnavailable: {{ . }}
  22. {{- end }}
  23. selector:
  24. matchLabels: {{ include "vm.selectorLabels" $ctx | nindent 6 }}
  25. {{- end }}
  26. {{- end }}