{{- if .Values.appgw -}}
{{- if .Values.appgw.shared -}}
{{- $watchNamespace := .Values.kubernetes.watchNamespace -}}
{{- if not .Values.appgw.prohibitedTargets }}
apiVersion: appgw.ingress.k8s.io/v1
kind: AzureIngressProhibitedTarget
metadata:
  name: prohibit-all-targets
spec:
  paths:
    - /*
{{- end -}}
{{- range .Values.appgw.prohibitedTargets -}}
apiVersion: appgw.ingress.k8s.io/v1
kind: AzureIngressProhibitedTarget
metadata:
  name: {{ .name }}
  {{- if $watchNamespace }}
  namespace: {{ $watchNamespace | splitList "," | first }}
  {{- end }}
spec:
  {{- if .hostname }}
  hostname: {{ .hostname | quote }}
  {{- end }}
  {{- if .paths }}
  paths:
  {{- range .paths }}
  - {{ . }}
  {{- end }}
  {{- end }}
---
{{- end }}
{{- end -}}
{{- end -}}
