If ingress rule isn't a number, the ingress controller routes to port 0 which fails
iantbutler01 opened this issue · comments
What happened
Hey for standard ingress ports like http and https, it is valid for them to look like:
port:
name: http
or
port:
name: https
in the ingress manifest
and then when you go to generate the tunnel url in this line
servicePort := path.Backend.Service.Port.Number
It fails to find the servicePort and then that is translated to 0 for the dest:
{"level":"info","ts":"2023-05-10T06:24:09Z","logger":"controllers.tunnel","msg":"Accepted connection","V1Alpha1Tunnel":"ghost/dev-ghost-0","id":"tn_2PaNnYqZvEujfvd12Fqx7dP8APg","dest":"dev-ghost.ghost.svc.cluster.local:0","remoteAddr":"108.50.174.179:36924"}
The work around is to manually edit the ingress and change them to something your driver expects:
port:
number: 80
or
port:
number: 443
What you think should happen instead
I would expect this ingress controller to be able to translate named ports into the correct number for http and https.
How to reproduce
You can reproduce this by taking the manifest for the 2048 example and changing the ingress manifest to this:
# ngrok Ingress Controller Configuration
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: game-2048-ingress
namespace: ngrok-ingress-controller
spec:
ingressClassName: ngrok
rules:
- host: NGROK_DOMAIN
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: game-2048
port:
name: http
Apply that manifest on a fresh cluster without other 2048 examples and you should see the controller fails to route the traffic appropriately.