ngrok / kubernetes-ingress-controller

The official ngrok Ingress Controller for Kubernetes
https://ngrok.com
MIT License
184 stars 20 forks source link

Add an ingress uid label to tunnels #293

Closed jrobsonchase closed 10 months ago

jrobsonchase commented 10 months ago

Resolves #291

What

Add a k8s.ngrok.com/ingress-uid label to tunnels created by the ingress controller to uniquely identify them among multiple ingress controller instances.

How

Plumb the full ingress object down to the method to create ngrok tunnel lables, and add the UID from that. The ingress UID should be stable as long as the object exists in k8s (citation needed?), so we don't have to worry about unexpected recreate thrashing as a result of it changing.

Breaking Changes

Shouldn't be any. After the ingress controller is redeployed, a difference should be detected between the desired and actual tunnel state, and things should be recreated with the new labels as expected.

jrobsonchase commented 10 months ago

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

jrobsonchase commented 10 months ago

The ingress UID maps most cleanly to our current tunnel ownership model. We're also setting the tunnel owner as the ingress, so I don't think it was ever the intended behavior for a tunnel to be usable by multiple ingresses that just so happened to have the same labels.

@bobzilladev Well... it was, and I was getting panics :sweat_smile: Didn't dig much deeper into the underlying cause though.

nikolay-ngrok commented 10 months ago

This actually breaks the case where we have multiple ingresses in the same namespaces, defining routes leading to the same service. This is because we are creating multiple https edge routes, but a single tunnel, so the last one that marks the tunnel wins, leaving the rest unroutable.