{{- if and .Values.worker.pdb.create (or (eq .Values.executor "CeleryExecutor") (eq .Values.executor "CeleryKubernetesExecutor")) }}
kind: PodDisruptionBudget
apiVersion: {{ include "common.capabilities.policy.apiVersion" . }}
metadata:
  name: {{ printf "%s-worker" (include "common.names.fullname" .) }}
  namespace: {{ .Release.Namespace | quote }}
  labels: {{- include "common.labels.standard" . | nindent 4 }}
    app.kubernetes.io/component: worker
    {{- if .Values.commonLabels }}
    {{- include "common.tplvalues.raender" (dict "value" .Values.commonLabels "context" $) | nindent 4 }}
    {{- end }}
spec:
  {{- if .Values.worker.pdb.minAvailable }}
  minAvailable: {{ .Values.worker.pdb.minAvailable }}
  {{- end }}
  {{- if .Values.worker.pdb.maxUnavailable }}
  maxUnavailable: {{ .Values.worker.pdb.maxUnavailable }}
  {{- end }}
  selector:
    matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
      app.kubernetes.io/component: worker
{{- end }}
