-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
cnitool: fix default CNI directory on Windows and add extra checks. #942
base: main
Are you sure you want to change the base?
cnitool: fix default CNI directory on Windows and add extra checks. #942
Conversation
Note that the only new validation logic which may introduce extra constraints is this new I'm also open to any better suggestions for the Windows default path than this default from containerd. |
c27ab2c
to
ca319a0
Compare
…ory. Signed-off-by: Nashwan Azhari <nazhari@cloudbasesolutions.com>
Signed-off-by: Nashwan Azhari <nazhari@cloudbasesolutions.com>
ca319a0
to
289c64b
Compare
FWIW I have switched to using I've also compared the pre and post-patch behavior on Linux: ### Pre-patch:
# Relative paths work:
$ NETCONFPATH=../../../../etc/cni/net.d/ ./cnitool check nonexistent-net /var/run/netns/testing
no net configuration with name "nonexistent-net" in ../../../../etc/cni/net.d/ # correct
# Setting a nonexistent directory will only claim there are no net configurations:
$ NETCONFPATH=/nonexistent/path ./cnitool check nonexistent-net /var/run/netns/testing
no net configurations found in /nonexistent/path
# Setting a nonexistent relative directory will also only claim there are no net configurations:
$ NETCONFPATH=./nonexistent/relative/path ./cnitool check nonexistent-net /var/run/netns/testing
no net configurations found in ./nonexistent/relative/path
### Post-patch:
# Relative paths still work:
$ NETCONFPATH=../../../../etc/cni/net.d/ ./cnitool check nonexistent-net /var/run/netns/testing
no net configuration with name "nonexistent-net" in /etc/cni/net.d # correct
# Setting a nonexistent directory will error out with a clear message:
$ NETCONFPATH=/nonexistent/path ./cnitool check nonexistent-net /var/run/netns/testing
the provided CNI config path ($NETCONFPATH) does not exist: "/nonexistent/path"
# Setting a nonexistent relative directory will also error out with a clear message:
$ NETCONFPATH=./nonexistent/relative/path ./cnitool check nonexistent-net /var/run/netns/testing
the provided CNI config path ($NETCONFPATH) does not exist: "/home/nashu/cni/cnitool/nonexistent/relative/path" |
// NOTE: this is the most reasonable default as most CNI setups on Windows | ||
// will have been made using the helper script in the containerd repo. | ||
// https://github.com/containerd/containerd/blob/main/script/setup/install-cni-windows | ||
DefaultNetDir = "C:\\Program Files\\containerd\\cni\\conf" |
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.
@aznashwan this seems containerd specific, but CNI is used by more than just containerd. If each CRI implementation has its own default directory, should this be a list of default dirs that get tried in sequence?
No description provided.