1 {{/* Default to not managing if unsupported or created outside this chart */}}
2 {{- $includeIngressClass := false -}}
3 {{- if .Values.ingressController.enabled -}}
4 {{- if (.Capabilities.APIVersions.Has "networking.k8s.io/v1/IngressClass") -}}
5 {{- with (lookup "networking.k8s.io/v1" "IngressClass" "" .Values.ingressController.ingressClass) -}}
6 {{- if (hasKey .metadata "annotations") -}}
7 {{- if (eq $.Release.Name (get .metadata.annotations "meta.helm.sh/release-name")) -}}
8 {{/* IngressClass exists and is managed by this chart */}}
9 {{- $includeIngressClass = true -}}
13 {{/* IngressClass doesn't exist */}}
14 {{- $includeIngressClass = true -}}
18 {{- if $includeIngressClass -}}
19 apiVersion: networking.k8s.io/v1
22 name: {{ .Values.ingressController.ingressClass }}
23 {{- if .Values.ingressController.ingressClassAnnotations }}
25 {{- range $key, $value := .Values.ingressController.ingressClassAnnotations }}
26 {{ $key }}: {{ $value | quote }}
30 {{- include "kong.metaLabels" . | nindent 4 }}
32 controller: ingress-controllers.konghq.com/kong