-
Notifications
You must be signed in to change notification settings - Fork 4.7k
SDN options and CNI directory cleanup #18404
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
SDN options and CNI directory cleanup #18404
Conversation
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.
Instead of hard-coding cniDirPath="/etc/cni/net.d" in pkg/network/node/node.go,
we can actually get the CNI conf dir:
cniDirPath = kubeletArguments["cni-conf-dir"][0] if present, otherwise kubeletcni.DefaultNetDir
By doing this, we do not have to change anything in openshift-sdn when upstream changes these default values.
Similar to DefaultCNIDir in k8s.io/kubernetes/pkg/kubelet/network/kubenet/kubenet_linux.go, I think we should expose defaultIPAMDir in upstream and reuse it in: |
@@ -1,72 +0,0 @@ | |||
// Copyright 2016 CNI authors |
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.
Do we want to remove these files from vendor dir? Removing this plugin from openshift packaging/installation is not sufficient?
I see other plugins under vendor/github.com/containernetworking/plugins/plugins/main which are not directly used by openshift SDN.
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.
@pravisankar yeah, those exist there. we don't build or install them though, so we could either remove them from Godeps or just leave them for now. No reason to have those sources around if we don't use them I think.
/retest |
Even if they expose defaultIPAMDir, we'd still be making assumptions about the format it stores the data in. So we'd need them to expose a "getMetrics()" function or something. Another possibility is to just add a check to the extended networking test that just verifies that the data there is what we expect. |
The CNI directory arguments are already the defaults in cni.go and we shouldn't need to change them (unless upstream changes them, at which point we should probably match). The Hairpin mode has been ignored upstream for CNI plugins since the switch to CRI. It's up to CNI network plugins to do what they need to do WRT allowing pods to talk back to themselves via the service IP. (note that hairpin is still used for --network-plugin=kubenet and for the old rkt runtime).
@pravisankar @danwinship so I forgot that the kubelet CNI driver uses loopback, so I've dropped that commit. |
e8de175
to
9341a78
Compare
9341a78
to
89afcf3
Compare
@@ -153,7 +154,8 @@ func getIPAMConfig(clusterNetworks []common.ClusterNetwork, localSubnet string) | |||
Name: "openshift-sdn", | |||
Type: "openshift-sdn", | |||
IPAM: &hostLocalIPAM{ | |||
Type: "host-local", | |||
Type: "host-local", | |||
DataDir: hostLocalDataDir, |
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 hostLocalIPAM.DataDir used?
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.
@pravisankar it's serialized into JSON and passed to the host-local plugin, which then puts its IPAM data there instead of the default. In reality hostLocalDataDir is already the same as the host-local plugin default so no change. But the path will be consistent now.
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.
host-local plugin bin dir path "/opt/cni/bin" is used in createIPAMArgs, ipamAdd and ipamDel methods. May be we could define hostLocalBinDir="/opt/cni/bin"
?
Rest of the changes looks good.
Instead of defining things in a couple places, just use the Kubelet CNI driver conf dir define. If that's overridden via the kubelet --cni-conf-dir argument, use that instead. Also pass a known IPAM data dir to the host-local plugin, and use that in the metrics code, to protect against upstream changes to the defaults.
89afcf3
to
10c212d
Compare
@pravisankar done |
@@ -42,6 +43,7 @@ import ( | |||
|
|||
const ( | |||
podInterfaceName = knetwork.DefaultInterfaceName | |||
cniBinPath = kcni.DefaultCNIDir |
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 a follow up, we could add a validation to check kubeletArguments["cni-bin-path"] is not set when openshift network plugin is used.
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.
Addressed in #18464
/lgtm |
/retest |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dcbw, pravisankar The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
/test all [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue. |
Data directory passed to the CNI host-local delegate plugin should be /var/lib/cni/networks, but the original patch missed one place to append "/networks" (the one that mattered). Fix-up for openshift#18404 Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1549491
Automatic merge from submit-queue. sdn: fix CNI IPAM data dir Data directory passed to the CNI host-local delegate plugin should be /var/lib/cni/networks, but the original patch missed one place to append "/networks" (the one that mattered). Fix-up for #18404 Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1549491 @openshift/networking
Data directory passed to the CNI host-local delegate plugin should be /var/lib/cni/networks, but the original patch missed one place to append "/networks" (the one that mattered). Fix-up for openshift#18404 Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1549491
Data directory passed to the CNI host-local delegate plugin should be /var/lib/cni/networks, but the original patch missed one place to append "/networks" (the one that mattered). Fix-up for openshift/origin#18404 Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1549491
Remove un-needed kubelet flags and rationalize paths that kubelet and the SDN use.
@knobunc @openshift/networking @danwinship