When using kong chart, users cannot install more than 1 ingress controller releases with the same name in different namespaces.
$ helm upgrade --install --create-namespace -n kong kic --values ./v_kic.yaml ./charts/kong
Release "kic" does not exist. Installing it now.
NAME: kic
LAST DEPLOYED: Fri Oct 20 17:55:54 2023
NAMESPACE: kong
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
To connect to Kong, please execute the following commands:
HOST=$(kubectl get svc --namespace kong kic-kong-proxy -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
PORT=$(kubectl get svc --namespace kong kic-kong-proxy -o jsonpath='{.spec.ports[0].port}')
export PROXY_IP=${HOST}:${PORT}
curl $PROXY_IP
Once installed, please follow along the getting started guide to start using
Kong: https://docs.konghq.com/kubernetes-ingress-controller/latest/guides/getting-started/
$ helm upgrade --install --create-namespace -n kong1 kic --values ./v_kic.yaml ./charts/kong
Release "kic" does not exist. Installing it now.
Error: Unable to continue with install: ClusterRole "kic-kong" in namespace "" exists and cannot be imported into the current release: invalid ownership metadata; annotation validation error: key "meta.helm.sh/release-namespace" must equal "kong1": current value is "kong"
Trying to fix the ClusterRole issue by including the namespace in the name
diff --git a/charts/kong/templates/_helpers.tpl b/charts/kong/templates/_helpers.tpl
index 7564c2e..1a77fc8 100644
--- a/charts/kong/templates/_helpers.tpl
+++ b/charts/kong/templates/_helpers.tpl
@@ -18,7 +18,7 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
{{- define "kong.fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
-{{- default (printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-") .Values.fullnameOverride -}}
+{{- default (printf "%s-%s-%s" .Release.Namespace .Release.Name $name | trunc 63 | trimSuffix "-") .Values.fullnameOverride -}}
{{- end -}}
{{- define "kong.chart" -}}
Doesn't solve the problem because then we're conflicting owners of the IngressClass
Error: Unable to continue with install: IngressClass "kong" in namespace "" exists and cannot be imported into the current release: invalid ownership metadata; annotation validation error: key "meta.helm.sh/release-namespace" must equal "kong1": current value is "kong"
Surprisingly, installing in the same namespace with different release name works. The helm annotations on the IngressClass are then retained to refer to the first release.
Proposed solution(s)
Leave this as is and document properly
Allow installing with the same release name in different namespaces and account for that in cluster wide resources
Might be problematic when we take into account the fact that a lot of places that use this chart use the hardcoded kongIngressClass and that would have to be changed then
Problem statement
When using
kong
chart, users cannot install more than 1 ingress controller releases with the same name in different namespaces.Trying to fix the
ClusterRole
issue by including the namespace in the nameDoesn't solve the problem because then we're conflicting owners of the
IngressClass
Surprisingly, installing in the same namespace with different release name works. The helm
annotations
on theIngressClass
are then retained to refer to the first release.Proposed solution(s)
kong
IngressClass
and that would have to be changed then