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: Add wildcard support to --devices ("eth+") #15697
daemon: Add wildcard support to --devices ("eth+") #15697
Conversation
test-me-please |
c.Assert(detectDevices(true, true), IsNil) | ||
c.Assert(option.Config.Devices, checker.DeepEquals, []string{"dummy1"}) | ||
c.Assert(option.Config.DirectRoutingDevice, Equals, "dummy1") | ||
act() |
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.
Is it leftover?
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.
Which one? act()
? This function abstracted the namespace setup and act
is the actual test function invoked in the new fresh namespace. Perhaps it could use a better name?
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.
Where is it defined?
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.
The diff looks a bit funny as I moved a chunk of code around. Perhaps have a look at the whole file? I added withFreshNetNS
function that takes a function as argument and it takes care of setting up and tearing down the namespace around the act()
function call.
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.
Aha, I see it now. Maybe s/act/test/?
3d09b54
to
7e2bb90
Compare
test-me-please |
7e2bb90
to
ff3261e
Compare
ff3261e
to
a2fbd38
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.
The approach looks good!
A few things:
- My comment re duplicates ^^.
- This needs a doc change https://github.com/cilium/cilium/blob/master/Documentation/gettingstarted/kubeproxy-free.rst (rendered https://docs.cilium.io/en/v1.9/gettingstarted/kubeproxy-free/).
daemon/cmd/kube_proxy_replacement.go
Outdated
if err != nil { | ||
log.WithError(err).Fatal("Cannot list network devices via netlink") | ||
} | ||
var expandedDevices []string |
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.
I'd use map (e.g. map[string]struct{}
) instead to avoid duplicates.
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.
Added the deduplication and tests for it.
c.Assert(detectDevices(true, true), IsNil) | ||
c.Assert(option.Config.Devices, checker.DeepEquals, []string{"dummy1"}) | ||
c.Assert(option.Config.DirectRoutingDevice, Equals, "dummy1") | ||
act() |
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.
Where is it defined?
0b6b6c6
to
676ed2d
Compare
676ed2d
to
7238631
Compare
listed device has to be named the same on all Cilium managed nodes. Alternatively | ||
if the devices do not match across different nodes, the wildcard option can be | ||
used, e.g. ``devices=eth+``, which would match any device starting with prefix | ||
``eth``. |
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.
Maybe add that if no device can be matched, then cilium-agent will try to perform the auto 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.
Added.
7238631
to
868a007
Compare
test-me-please |
868a007
to
524ed64
Compare
test-net-next |
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.
🚀
This adds support for device name wildcards to the "--devices" option, e.g. if user specifies "--devices=eth+,en+" the agent will match devices eth0, eth1, en0, etc. Fixes: cilium#15693 Signed-off-by: Jussi Maki <jussi@isovalent.com>
test-gke |
test-runtime |
test-1.20-4.19 |
test-1.21-4.9 |
524ed64
to
db613b4
Compare
test-net-next |
test-gke |
test-runtime |
test-1.21-4.9 |
test-1.20-4.19 |
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.
LGTM. An interesting followup would be to allow this to dynamically apply to new devices as they are attached (common in some cloud environments like EKS), but that's more of a "future wishlist" item. In the mean time if users are concerned about matching dynamic devices, they can restart the agent.
This adds support for device name wildcards to the "--devices"
option, e.g. if user specifies "--devices=eth+,en+" the agent
will match devices eth0, eth1, en0, etc.
Fixes: #15693