Description
Is this a request for help? (If yes, you should use our troubleshooting guide and community support channels, see https://kubernetes.io/docs/tasks/debug-application-cluster/troubleshooting/.): No
What keywords did you search in NGINX Ingress controller issues before filing this one? (If you have found any duplicates, you should instead reply there.): "Secret namespace"
Is this a BUG REPORT or FEATURE REQUEST? (choose one): Feature
NGINX Ingress controller version: "0.10.2"
Kubernetes version (use kubectl version
): v1.8.7
Environment:
- Cloud provider or hardware configuration: Azure
- OS (e.g. from /etc/os-release): Ubuntu 16.04.3
- Kernel (e.g.
uname -a
): 4.11.0-1016-azure - Install tools: Helm Chart v0.9.5 from https://github.com/kubernetes/charts/blob/master/stable/nginx-ingress/
- Others:
What happened:
When trying to use a TLS certificate using <namespace>/<secretName>
pattern in tls
section of ingress definition, Nginx controller still tries to get the details from the namespace where ingress was created.
What you expected to happen:
When TLS secret referred when creating an ingress is of pattern <namespace>/<secretName>
, ingress controller shouldn't check only in ingress' namespace.
How to reproduce it (as minimally and precisely as possible):
- Create 2 namespaces, say
secret-store
andingress-store
. - Create a secret containing a TLS certificate and key in
secret-store
namespace, saymy-tls
. - Create an ingress in
ingress-store
namespace with TLS enabled and in the.spec.tls.hosts[].secretName
field putsecret-store/my-tls
to refer to the secret insecret-store
namespace. - Check logs of ingress controller, line similar to below will be printed, indicating secret was never searched in
secret-store
namespace:
W0305 11:39:26.826578 6 backend_ssl.go:49] error obtaining PEM from secret ingress-store/secret-store/my-tls: error retrieving secret ingress-store/secret-store/my-tls: secret ingress-store/secret-store/my-tls was not found
Anything else we need to know:
Initial glance on the code suggests that in below snippet, in the if block, we check if the secret has a /
in it, and try to extract the secret from the namespace provided in ingress .spec.tls
definition, it could work.
ingress-nginx/internal/ingress/controller/controller.go
Lines 1000 to 1005 in 164bb7b