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

ExternalName service cannot be used as default-backend #5854

Closed
kibs opened this issue Jul 6, 2020 · 3 comments · Fixed by #5857
Closed

ExternalName service cannot be used as default-backend #5854

kibs opened this issue Jul 6, 2020 · 3 comments · Fixed by #5857
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@kibs
Copy link

kibs commented Jul 6, 2020

NGINX Ingress controller version:
0.33

Kubernetes version (use kubectl version):
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.3", GitCommit:"2e7996e3e2712684bc73f0dec0200d64eec7fe40", GitTreeState:"clean", BuildDate:"2020-05-21T14:51:23Z", GoVersion:"go1.14.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"16+", GitVersion:"v1.16.6-beta.0", GitCommit:"e7f962ba86f4ce7033828210ca3556393c377bcc", GitTreeState:"clean", BuildDate:"2020-01-15T08:18:29Z", GoVersion:"go1.13.5", Compiler:"gc", Platform:"linux/amd64"}

Environment:
Docker-For-Mac

What happened:

When setting "default-backend" annotation on an ingress to a service which points to an externalName, the ingress won't updated. If editing again, the annotation is gone. If i set it to a ClusterIP service, it works fine.

When setting the default-backend to my externalname service, the controller logs the following

│ controller 2020/07/06 19:34:43 http: panic serving 192.168.65.3:54926: runtime error: index out of range [0] with length 0                                                                                   │
│ controller goroutine 8668 [running]:                                                                                                                                                                         │
│ controller net/http.(*conn).serve.func1(0xc0001392c0)                                                                                                                                                        │
│ controller     /home/ubuntu/.gimme/versions/go1.14.2.linux.amd64/src/net/http/server.go:1772 +0x139                                                                                                          │
│ controller panic(0x176ed60, 0xc000893c60)                                                                                                                                                                    │
│ controller     /home/ubuntu/.gimme/versions/go1.14.2.linux.amd64/src/runtime/panic.go:975 +0x3e3                                                                                                             │
│ controller k8s.io/ingress-nginx/internal/ingress/controller.(*NGINXController).getBackendServers(0xc0003d55e0, 0xc0001b20e0, 0x4, 0x4, 0x187ca2a, 0x1b, 0x185e5a8, 0x0, 0x185e5a8, 0x0)                      │
│ controller     /tmp/go/src/k8s.io/ingress-nginx/internal/ingress/controller/controller.go:645 +0x2e6a                                                                                                        │
│ controller k8s.io/ingress-nginx/internal/ingress/controller.(*NGINXController).getConfiguration(0xc0003d55e0, 0xc0001b20e0, 0x4, 0x4, 0xc000194d00, 0xc00095e401, 0x40c626, 0xc00095e458, 0x118d44b)         │
│ controller     /tmp/go/src/k8s.io/ingress-nginx/internal/ingress/controller/controller.go:404 +0x80                                                                                                          │
│ controller k8s.io/ingress-nginx/internal/ingress/controller.(*NGINXController).CheckIngress(0xc0003d55e0, 0xc000a89b00, 0x4d0, 0x500)                                                                        │
│ controller     /tmp/go/src/k8s.io/ingress-nginx/internal/ingress/controller/controller.go:230 +0x2e2                                                                                                         │
│ controller k8s.io/ingress-nginx/internal/admission/controller.(*IngressAdmission).HandleAdmission(0xc00037aeb0, 0xc0008fd740)                                                                                │
│ controller     /tmp/go/src/k8s.io/ingress-nginx/internal/admission/controller/main.go:100 +0x8fe                                                                                                             │
│ controller k8s.io/ingress-nginx/internal/admission/controller.(*AdmissionControllerServer).ServeHTTP(0xc000117600, 0x1b054a0, 0xc00014c9a0, 0xc0009a3700)                                                    │
│ controller     /tmp/go/src/k8s.io/ingress-nginx/internal/admission/controller/server.go:68 +0x166                                                                                                            │
│ controller net/http.serverHandler.ServeHTTP(0xc0003d40e0, 0x1b054a0, 0xc00014c9a0, 0xc0009a3700)                                                                                                             │
│ controller     /home/ubuntu/.gimme/versions/go1.14.2.linux.amd64/src/net/http/server.go:2807 +0xa3                                                                                                           │
│ controller net/http.(*conn).serve(0xc0001392c0, 0x1b076a0, 0xc00047dac0)                                                                                                                                     │
│ controller     /home/ubuntu/.gimme/versions/go1.14.2.linux.amd64/src/net/http/server.go:1895 +0x86c                                                                                                          │
│ controller created by net/http.(*Server).Serve                                                                                                                                                               │
│ controller     /home/ubuntu/.gimme/versions/go1.14.2.linux.amd64/src/net/http/server.go:2933 +0x35c                                                                                                          │

What you expected to happen:

Would think the externalName service could be used as a default-backend for an Ingress

/kind bug

@kibs kibs added the kind/bug Categorizes issue or PR as related to a bug. label Jul 6, 2020
@aledbf
Copy link
Member

aledbf commented Jul 6, 2020

Would think the externalName service could be used as a default-backend for an Ingress

Does it seem the service you are creating has no ports defined? Please make sure you have one (without it, the ingress controller does not know where to send the traffic)

@kibs
Copy link
Author

kibs commented Jul 7, 2020

Okay that makes sense, but an external name service cannot have ports defined. Thanks for clarifying, and thank you for the pull request

@aledbf
Copy link
Member

aledbf commented Jul 7, 2020

, but an external name service cannot have ports defined.

Yes, it can have ports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants