Repository navigation
Conversation
| bridge=$1 | ||
| mtu=$2 | ||
|
|
||
| DOCKER_NETWORK_OPTIONS="-b=${bridge} --mtu=${mtu}" |
There was a problem hiding this comment.
This causes docker to set the correct MTU on the veths. You need to add that functionality somewhere else if docker isn't going to do it any more.
There was a problem hiding this comment.
It gets done by the CNI plugin now:
err = ns.WithNetNSPath(args.Netns, func(hostNS ns.NetNS) error {
hostVeth, contVeth, err = ip.SetupVeth(interfaceName, int(netInfo.MTU), hostNS)
if err != nil {
return fmt.Errorf("Failed to create container veth: %v", err)
}|
@danwinship PTAL, thanks! |
| } | ||
|
|
||
| router.NotFoundHandler = http.HandlerFunc(http.NotFound) | ||
| router.Methods("GET").Path("/network").HandlerFunc(s.getNetwork) |
There was a problem hiding this comment.
I am really uncomfortable about creating a new API here (which is what this is) and also not happy to see a new set of API definitions that don't overlap with our existing objects being created. I need to dive into this more and understand the tradeoffs, but like to see a quick writeup of what options you considered and why you chose this approach.
One question I was surprised by - why does the CNI interface not pass enough information down to the network plugin to make a decision there?
There was a problem hiding this comment.
@smarterclayton I would not consider the podinfoserver new API; it's private IPC between the openshift-sdn CNI plugin, and the openshift-sdn node plugin. It is not intended to be public in any way, and we would reserve the right to change it at any time.
The options:
- root-only private unix domain socket: advantages include a very small amount of well-understood code doing very specific things, which closely follows other examples like Docker's API server and client pattern. Authentication and security are protected by simple, common Unix mechanisms like filesystem permissions, and we could additionally protect it through peer credentials if we wanted to. The private API exposed by this socket is small and easily extendable if/when the SDN plugin needs to extend it, but we do not expect or support any other consumers of this API than openshift-sdn.
- talk to api-server: this would require a larger amount of code in the CNI plugin to create Kube and OpenShift clients and find/read the Pod, VNID, HostSubnet, and other objects the CNI plugin requires. The openshift-sdn node process already has this information because it must track it for other reasons. Furthermore, this would require passing authentication information into the CNI plugin, including any certificates required and the apiserver IP address/hostname.
One question I was surprised by - why does the CNI interface not pass enough information down to the network plugin to make a decision there?
CNI can only pass information that kubelet has; that will soon be extended to pass the PodSpec via containernetworking/cni#247. But that doesn't help openshift-sdn specific stuff like the HostSubnet and the VNID, which still need to be read out-of-band from CNI.
There was a problem hiding this comment.
Talked this over with Jordan and David. I think from a security perspective I can live with an API and a unix domain socket. Some things that need to change / happen in order to merge it:
- The handlers and structs sent back and forth need to be more strictly versioned and handled. I.e., the path needs to be prefixed with a version
/v1/and the objects should be in a versioned API packagesdn/localserver/api/v1package and well documented - I want to nuke the watches from the SDN server component - it should use a kube client that is passed in (by the openshift node process) to make calls to the server, and potentially add an LRU cache (access control is going to be strictly enforced, much more so in the future)
- I would recommend factoring your plugin as an http.Handler that is going to be instantiated by the node code (not directly used from inside openshift-sdn) for now
- Use the existing Kube
RESTClientclient instead of inventing your own - that handles rate limiting, etc - We'll have to sort through the unix domain socket and how it interacts with packaging, but at least for step 1 we are still going to run openshift node with both kubelet and SDN plugin (turned on) - the node process will boot the server, and the expectation the SDN sub binary will run inside of the node container.
- We'll deal with splitting into a separate binary later.
|
Do you guys have a design doc / writeup / proposal to cover this work? |
Yes, I'll mail you a link. |
726c67c to
d830a92
Compare
Leave docker configuration alone. Instead, let docker do whatever it wants to do, then pull the interface out of the docker bridge, clear the docker assigned addresses and routes, and allocate an address with the CNI 'host-local' plugin from the node subnet. NOTE: this breaks HostPort functionality for two reasons; first because not restarting docker exposes issues like docker #16816 and second because nothing yet replaces the iptables rules docker adds.
We won't need it in there soon, once the plugin moves to CNI.
|
@smarterclayton after prototyping using the kube/openshift clients in the CNI plugin and discussing with @danwinship, I've decided to drop the podinfo server for now. We may need it in the future if things become more complicated or contacting the apiserver becomes a performance issue. I agree with your points (2) and (4) in #320 (comment); the other points are moot with the latest commits. We'll work on making those changes. In the mean time, PTAL and let me know what you think. Thanks! |
|
@smarterclayton any thoughts on this approach? One issue with not having communication between the CNI plugin and the openshift node process is that it somewhat complicates hostport/containerport redirect functionality (eg, like docker's "-p host:container" functionality) since the long-lived node process doesn't know when pods start/stop since the CNI plugin is now using its own k/os clients. |
There's obviously a race between when the CNI plugin creates the infra container and when openshift-node gets the apiserver update of the PodIP. But something has to keep the host port open to ensure nothing else tries to use it.
Based off @danwinship's plugin reorg branch, so start with the "Use CNI for IPAM instead of docker" commit. Not quite ready for merge yet, but I'd love feedback on the approach, especially the pod info server parts.
cc @pravisankar @rajatchopra @smarterclayton