-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
hubble: Add "hubble-prefer-ipv6" option #21751
Conversation
a5af78d
to
2765eda
Compare
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 @mKeRix for the PR!
The --hubble-prefer-ipv6
flag is fine to me, but in code I would slightly prefer (no pun intended) to express the addr family preference like k8s apimachinery rather than bubbling down a bool
(in other words, "parsing" the flag as a AddressFamilyPreference
). That way nodeAddress
would be easier to read IMHO, e.g.
func nodeAddress(n types.Node, pref AddressFamilyPreference) string {
for _, family := range pref {
switch family {
case familyIPv4:
if addr := n.GetNodeIP(false); addr.To4() != nil {
return addr.String()
}
case familyIPv6:
if addr := n.GetNodeIP(true); addr.To4() == nil {
return addr.String()
}
}
}
return ""
}
2765eda
to
427e390
Compare
Hey @kaworu, thanks for your remarks! I tried to integrate your proposals and pushed a new version. I was a bit insecure about where to put the AddressFamily types. I've now thrown them into the |
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.
Awesome @mKeRix thanks for the update, small nit but other than that the patch LGTM.
427e390
to
d59d2ca
Compare
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.
Looks solid, thanks!
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.
Thanks for the PR @mKeRix! I think we are missing the Helm chart changes to export this new option. It should be just a matter of adding a new value and then using it in the configmap template.
As an example you can have a look at how it's done for the Hubble listening address:
cilium/install/kubernetes/cilium/values.yaml
Line 755 in 3c9a5c1
listenAddress: ":4244" cilium/install/kubernetes/cilium/templates/cilium-configmap.yaml
Lines 749 to 751 in 3c9a5c1
{{- if hasKey .Values.hubble "listenAddress" }} # An additional address for Hubble server to listen to (e.g. ":4244"). hubble-listen-address: {{ .Values.hubble.listenAddress | quote }}
(and then remember to run make -C Documentation update-helm-values
to update the docs)
d59d2ca
to
cfa757a
Compare
Thank you for the hint @jibi! I've adapted the PR accordingly. |
ac7e1db
to
bbbf998
Compare
When a node has mixed IPv4 and IPv6 addresses, but internal cluster communication is only IPv6-based, Hubble would announce wrong node addresses which would break communication to the agents. This option allows to control this behavior explicitly. The previous IPv4 preference is kept as default. Signed-off-by: Heiko Rothe <me@heikorothe.com>
bbbf998
to
c928a28
Compare
/test |
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.
Looks good, thank you
/test-runtime |
Please ensure your pull request adheres to the following guidelines:
description and a
Fixes: #XXX
line if the commit addresses a particularGitHub issue.
Fixes: <commit-id>
tag, thenplease add the commit author[s] as reviewer[s] to this issue.
This change adds an option to the Hubble Relay communication that allows to configure the previously hardcoded IPv4/IPv6 preference. When a node has mixed IPv4 and IPv6 addresses, but internal cluster communication is only IPv6-based, Hubble would announce wrong node addresses which would break communication to the agents. The previous IPv4 preference is kept as default.
Our specific use case for this is EKS with IPv6. When an instance is put into a public subnet and receives a public IP, this IP will be mapped as ExternalIP onto the node. Hubble will then announce that IP, even though no communication can happen on it. Instead, it should announce the IPv6 address the EC2 instance (like it does for nodes without public IP).
We've tested this changeset successfully in real IPv6 EKS clusters using a custom build of v1.12.2.