Endpointslice detection fails if servicename is too long #9240
Labels
area/stabilization
Work for increasing stabilization of the ingress-nginx codebase
kind/bug
Categorizes issue or PR as related to a bug.
needs-priority
triage/accepted
Indicates an issue or PR is ready to be actively worked on.
What happened:
Since updating to version 1.4.0 services with long names don't work anymore with nginx-ingress. Accessing the service results in a 503 error and the error I get is:
Moving back to previous version makes everything work again.
Especially with vcluster this is a big issue as vcluster generates long names per default.
See also:
loft-sh/vcluster#800
What you expected to happen:
No 503 error but successful proxy to the endpoint/pod.
The reason seems to be the new Endpointslice detection here
ingress-nginx/internal/ingress/controller/store/endpointslice.go
Lines 36 to 39 in 3579ed0
It seems like it match by "prefix" first and then check if the label matches.
If the service name is long (I guess around 55-60 chars makes it start) then it seems like it gets truncated with a value in the end and the prefix check doesn't work anymore see:
mail-backend-http-test-http-test-http-test-http-test-http-vhk88 is NOT a prefix of mail-backend-http-test-http-test-http-test-http-test-http-test but it does have the correct kubernetes.io/service-name label.
This results in
NGINX Ingress controller version (exec into the pod and run nginx-ingress-controller --version.):
NGINX Ingress controller
Release: v1.4.0
Build: 50be2bf
Repository: https://github.com/kubernetes/ingress-nginx
nginx version: nginx/1.19.10
Kubernetes version (use
kubectl version
):Client Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.7", GitCommit:"e6f35974b08862a23e7f4aad8e5d7f7f2de26c15", GitTreeState:"clean", BuildDate:"2022-10-12T10:57:14Z", GoVersion:"go1.18.7", Compiler:"gc", Platform:"windows/amd64"}
Kustomize Version: v4.5.4
Server Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.7+k3s1", GitCommit:"7af5b16788afe9ce1718d7b75b35eafac7454705", GitTreeState:"clean", BuildDate:"2022-10-25T19:31:34Z", GoVersion:"go1.18.7", Compiler:"gc", Platform:"linux/amd64"}
How was the ingress-nginx-controller installed:
Helm:
ngx kube-system 13 2022-11-01 00:18:32.613367459 +0000 UTC deployed ingress-nginx-4.3.0 1.4.0
How to reproduce this issue:
The text was updated successfully, but these errors were encountered: