Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kong: Cannot install more than 1 ingress controller release with the same name in different namespace #910

Open
pmalek opened this issue Oct 20, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@pmalek
Copy link
Member

pmalek commented Oct 20, 2023

Problem statement

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 kong IngressClass and that would have to be changed then
@pmalek pmalek added the bug Something isn't working label Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant