Skip to content
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

k8splugin support manage_network_ns_lifecycle=true from crio #1150

Closed
wants to merge 2 commits into from
Closed

k8splugin support manage_network_ns_lifecycle=true from crio #1150

wants to merge 2 commits into from

Conversation

newtonjose
Copy link

@newtonjose newtonjose commented Aug 8, 2018

Description of the changes

Type of fix:

Bug fix

Fixes #

1054
Please describe:

  • changes made in the Pull request
    The cni 0.3 support the network namespace path can be /proc/[pid]/ns/net or a bind-mount/link(like /var/run/netns/cni-<something>) to it.
    So, when the flag manage_network_ns_lifecycle=true on the cri-o runtime, contiv return the bug contiv cni plugin is broken with cri-o runtime. #1054.
    I made some logical modifications to contiv run over buth net path. Some problems of permission on container, I can't execute the operation on the mounted path and that force me send part of the code to k8s_cni code.
    Modifications:

On the function addPod() of file driver.go of the k8splugin package
And put the same logical on the function addPodToContiv() of file k8s_cni.go of cniapi package

TODO

  • Tests
  • Documentation

@@ -95,15 +279,40 @@ func addPodToContiv(nc *clients.NWClient, pInfo *cniapi.CNIPodAttr) {
}
os.Exit(1)
}
log.Infof("EP created IP: %s\n", result.Attr.IPAddress)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change this function?
Why not change the
// addPod is the handler for pod additions
func addPod(w http.ResponseWriter, r *http.Request, vars map[string]string) (interface{}, error)

in \netplugin\mgmtfn\k8splugin\driver.go

Copy link
Author

@newtonjose newtonjose Aug 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When, the runtime send the pid process the operation inside the container is permitted, but when is the path of network namespace I have problems to exec same operation I get the error: RTNETLINK answers: Invalid argument, exit status 2

This is result inside the container contiv-netplugin running on k8s
ls -lha /var/run/netns/

-rw-r--r--  1 root root    0 Aug  9 18:41 cni-d5e070e5-08c4-46f0-96ee-4bb5e6c6e21a
lrwxrwxrwx  1 root root   55 Aug  9 18:41 k8s_contiv-blue-c1_default_01bc671d-9a69-11e8-a90e-000af70485d0_1-81a93eff -> /var/run/netns/cni-d5e070e5-08c4-46f0-96ee-4bb5e6c6e21a

So, the k8s_cni is part of the contivk8s plugin execute on the host.

I make some test to try maintain the logical on ./netplugin\mgmtfn\k8splugin\driver.go but no success.

@newtonjose newtonjose changed the title k8splugin support manager_networkmanage_network_ns_lifecycle=true from crio k8splugin support manage_network_ns_lifecycle=true from crio Aug 9, 2018
}
defer ns.Close()
return ns.Do(toRun)
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe these files can use vendor in the project?
https://github.com/containernetworking/plugins/tree/master/pkg/ns

@newtonjose
Copy link
Author

newtonjose commented Aug 17, 2018 via email

@newtonjose newtonjose closed this Aug 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants