{{- if .Values.armAuth -}}
{{- if eq .Values.armAuth.type "aadPodIdentity"}}

# Please see https://github.com/Azure/aad-pod-identity for more information
apiVersion: "aadpodidentity.k8s.io/v1"
kind: AzureIdentity
metadata:
  name: {{ template "application-gateway-kubernetes-ingress.azureidentity" . }}
  {{- if .Values.armAuth.namespaced }}
  annotations:
    aadpodidentity.k8s.io/Behavior: namespaced
  {{- end }}
spec:
  type: 0
  resourceID: {{ required "armAuth.identityResourceID is required if using AAD-Pod-Identity" .Values.armAuth.identityResourceID }}
  clientID: {{ required "armAuth.identityClientID is required if using AAD-Pod-Identity" .Values.armAuth.identityClientID }}

{{- end}}
{{- end}}
