{{- $installCRDs := false -}} {{- if (hasKey .Values.ingressController "installCRDs") -}} {{/* Explicitly set, honor whatever's set */}} {{- $installCRDs = .Values.ingressController.installCRDs -}} {{- else -}} {{/* Legacy default handling. CRD installation is _not_ enabled, but CRDs are already present and are managed by this release. This release previously relied on the <2.0 default .Values.ingressController.installCRDs=true. The default change would delete CRDs on upgrade, which would cascade delete all associated CRs. This unexpected loss of configuration is bad, so this clause pretends the default didn't change if you have an existing release that relied on it */}} {{- $kongPluginCRD := false -}} {{- if .Capabilities.APIVersions.Has "apiextensions.k8s.io/v1/CustomResourceDefinition" -}} {{- $kongPluginCRD = (lookup "apiextensions.k8s.io/v1" "CustomResourceDefinition" "" "kongplugins.configuration.konghq.com") -}} {{- else -}} {{/* TODO: remove the v1beta1 path when we no longer support k8s <1.16 */}} {{- $kongPluginCRD = (lookup "apiextensions.k8s.io/v1beta1" "CustomResourceDefinition" "" "kongplugins.configuration.konghq.com") -}} {{- end -}} {{- if $kongPluginCRD -}} {{- if (hasKey $kongPluginCRD.metadata "annotations") -}} {{- if (eq .Release.Name (get $kongPluginCRD.metadata.annotations "meta.helm.sh/release-name")) -}} {{- $installCRDs = true -}} {{- end -}} {{- end -}} {{- end -}} {{- end -}} {{- if $installCRDs -}} {{- range $path, $bytes := .Files.Glob "crds/*.yaml" }} {{ $.Files.Get $path }} --- {{- end }} {{- end }}