-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
daemon: Ignore cilium_* interfaces when deriving NodePort device #16104
daemon: Ignore cilium_* interfaces when deriving NodePort device #16104
Conversation
Commit 102d4515a6b8c84d8aca5f947e568c42ca1b0953 does not contain "Signed-off-by". Please follow instructions provided in https://docs.cilium.io/en/stable/contributing/development/contributing_guide/#developer-s-certificate-of-origin |
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 contribution! Looks good, just two nits.
daemon/cmd/kube_proxy_replacement.go
Outdated
// ifIndex or if its name begins with cilium_. | ||
if link, err := netlink.LinkByIndex(a.LinkIndex); err != nil { | ||
log.WithError(err).WithField(logfields.LinkIndex, a.LinkIndex).Warn( | ||
"Unable to resolve link from ifIndex, skipping interface") |
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.
Nit: s/skipping interface/skipping interface for device detection/.
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.
Updated, thanks.
daemon/cmd/kube_proxy_replacement.go
Outdated
continue | ||
} else if strings.HasPrefix(link.Attrs().Name, "cilium_") { | ||
log.WithField(logfields.Device, link.Attrs().Name).Debug( | ||
"Skipping Cilium-generated interface in NodePort device detection") |
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.
Nit: s/NodePort device/device/ (it's not only used for NodePort).
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.
Updated, thanks. Also s/in/for/ to be consistent with various messages around it.
daemon/cmd/kube_proxy_replacement.go
Outdated
if link, err := netlink.LinkByIndex(a.LinkIndex); err != nil { | ||
log.WithError(err).WithField(logfields.LinkIndex, a.LinkIndex).Warn( | ||
"Unable to resolve link from ifIndex, skipping interface") | ||
continue |
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.
nit: no need for these continue
s
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 catching that, I've removed them. I had gone back and forth between having an "implicit" and "explicit" else
condition and the continue
s would have been required for the implicit condition, but I forgot to remove them after settling on an explicit else
.
Any Cilium-created interface (cilium_host, etc) will never be a valid interface for kube-proxy-replacement NodePort (or direct routing). In certain cases, it is possible for the NodePort auto-derivation code to select one of these interfaces. This notably happens when the k8s node IP is an IPv6 address: the node IP is cloned to cilium_host, and the IP (sans netmask) is used as a map key - so cilium_host may be viewed as the only interface with an address matching the node IP. Add a check bypassing any interface whose name is prefixed with "cilium_" during NodePort device detection. Add a test mimicking the IPv6 cilium_host case: node IP assigned to a "real" interface and a "cilium_foo" interface, we should ignore "cilium_foo". Fixes: #16019 Signed-off-by: Eric M. Yanulis <eric@eyanulis.net>
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!
test-me-please |
It looks like most(/all?) of the failing tests are Github flakes from the first run (HTTP 500 during checkout, etc). Is there any way to rerun them? I'm not terribly familiar with how this repo is wired up to Github Actions but it doesn't seem like they re-ran after the |
I think GH was having some issues yesterday with actions. Closing and reopening the PR should have restarted them |
test-1.16-netnext |
The tests relevant to this PR are passing, so marking this ready for merge. |
Any Cilium-created interface (
cilium_host
, etc) will never be a validinterface for kube-proxy-replacement NodePort (or direct routing). In
certain cases, it is possible for the NodePort auto-derivation code to
select one of these interfaces. This notably happens when the k8s node
IP is an IPv6 address: the node IP is cloned to
cilium_host
, and the IP(sans netmask) is used as a map key - so
cilium_host
may be viewed asthe only interface with an address matching the node IP.
Add a check bypassing any interface whose name is prefixed with
cilium_
during NodePort device detection.Add a test mimicking the IPv6
cilium_host
case: node IP assigned to a"real" interface and a
cilium_foo
interface, we should ignorecilium_foo
.Fixes: #16019
Please ensure your pull request adheres to the following guidelines:
description and a
Fixes: #XXX
line if the commit addresses a particularGitHub issue.