-
Notifications
You must be signed in to change notification settings - Fork 1
Add option to prevent cluster-traffic from bypassing loadbalancers #16
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
Conversation
The server can be run as follows: cd cmd/http-echo go run main.go Then in a separate shell: curl http://127.0.0.1/proxy-protocol/used --haproxy-protocol false curl http://127.0.0.1/proxy-protocol/used --haproxy-protocol true This tool could live outside this repository and may one day just do that, once it has more fetures and could replace the nginx hello server used in other places.
8a89b09 to
1a1feae
Compare
1a1feae to
fa7d151
Compare
ce903d9 to
e3b8612
Compare
alakae
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Just a single suggestion.
| // LoadBalancerForceHostname forces the CCM to report a specific hostname | ||
| // to Kubernetes when returning the loadbalancer status, instead of | ||
| // reporting the IP address(es). | ||
| // | ||
| // The hostname used should point to the same IP address that would | ||
| // otherwise be reported. This is used as a workaround for clusters that | ||
| // do not support status.loadBalancer.ingress.ipMode, and use `proxy` or | ||
| // `proxyv2` protocol. | ||
| // | ||
| // For newer clusters, .status.loadBalancer.ingress.ipMode is automatically | ||
| // set to "Proxy", unless LoadBalancerIPMode is set to "VIP" | ||
| // | ||
| // For more information about this workaround see | ||
| // https://kubernetes.io/blog/2023/12/18/kubernetes-1-29-feature-loadbalancer-ip-mode-alpha/ | ||
| LoadBalancerForceHostname = "k8s.cloudscale.ch/loadbalancer-force-hostname" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, I'd suggest to mention .status.loadBalancer.ingress.hostname here and make explicit, that it essentially sets that property.
Other than that: LGTM
This is accomplished with two new annotations: - `k8s.cloudscale.ch/loadbalancer-force-hostname` - `k8s.cloudscale.ch/loadbalancer-ip-mode` The former forces a hostname to be reported for loadbalancer ingress, the latter adds support for the new IPMode config available by default on Kubernetes 1.30, and feature-gated on 1.29. This is required for clusters that use the `proxy` or `proxyv2` protocol for any of their loadbalancers, and send traffic from inside the cluster to the loadbalancers. In such a constellation, traffic may not be sent through the loadbalancer, unless the hostname is set (for older clusters). For newer cluster, the default "IP Mode" used is "Proxy", as that is the least surprising setting. References: - https://kubernetes.io/blog/2023/12/18/kubernetes-1-29-feature-loadbalancer-ip-mode-alpha/ - #15
e3b8612 to
0c0afd8
Compare
See #15