{{- if eq .Values.global.ha.enabled true }}
{{- if .Capabilities.APIVersions.Has "policy/v1" }}
apiVersion: policy/v1
{{- else }}
apiVersion: policy/v1beta1
{{- end }}
kind: PodDisruptionBudget
metadata:
  name: dapr-sentry-budget
  namespace: {{ .Release.Namespace }}
  labels:
    app: dapr-sentry
    {{- range $key, $value := .Values.global.k8sLabels }}
    {{ $key }}: {{ tpl $value $ }}
    {{- end }}
spec:
{{- if .Values.global.ha.disruption.minimumAvailable }}
  minAvailable: {{ .Values.global.ha.disruption.minimumAvailable }}
{{- end }}
{{- if .Values.global.ha.disruption.maximumUnavailable }}
  maxUnavailable: {{ .Values.global.ha.disruption.maximumUnavailable }}
{{- end }}
  selector:
    matchLabels:
      app: dapr-sentry
      {{- range $key, $value := .Values.global.k8sLabels }}
      {{ $key }}: {{ tpl $value $ }}
      {{- end }}
      {{- with .Values.global.labels }}
        {{- toYaml . | nindent 6 }}
      {{- end }}
{{- end }}
