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

V2 API support for win-overlay CNI #725

Merged
merged 1 commit into from
Apr 14, 2022

Conversation

selansen
Copy link
Contributor

@selansen selansen commented Mar 31, 2022

This PR bring V2 API support into win-overlay CNI. With the current V1
API, only docker runtime works for win-overlay. By bringing new changes, we
should be able to use containerd as the runtime.Below are the key
points regarding this implementation.
1. Clear seperation for V1 & V2 API support in cmdAdd
2. New cni.conf sample that works for win-overlay
3. cmdDel handles HCN API changes for V2 API version

Signed-off-by: selansen esiva@redhat.com

@selansen selansen changed the title V2 API support for win-overlay CNI [WIP] V2 API support for win-overlay CNI Mar 31, 2022
@mansikulkarni96
Copy link

Fixes #713

@selansen selansen force-pushed the v2api-suuport-win-overlay branch 3 times, most recently from 71b88c5 to f30799f Compare April 6, 2022 19:12
@selansen selansen changed the title [WIP] V2 API support for win-overlay CNI V2 API support for win-overlay CNI Apr 6, 2022
@selansen
Copy link
Contributor Author

selansen commented Apr 6, 2022

@dcbw @JacobTanenbaum This is up for review. PTAL

@selansen
Copy link
Contributor Author

selansen commented Apr 7, 2022

Want feedback from Microsoft networking team: @daschott @Keith-Mange PTAL

Copy link
Contributor

@daschott daschott left a comment

Choose a reason for hiding this comment

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

Nice work. I can see that AddHcnEndpoint is calling AddNamespaceEndpoint and the CNI ADD call looks good to me.

For the deletion, I believe it is missing an attempt to detach from namespace. Deleting the endpoint without detaching from namespace is fine as a fallback if the namespace is not found, but ideally we should try to detach from namespace first and attempt to clean up properly.

}

networkName := n.Name
hnsNetwork, err := hcsshim.GetHNSNetworkByName(networkName)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit Feels like we should be able to avoid making a query to get network representation through HNS APIs since the result from HCN APIs should be sufficient... Or is there a reason we are getting the same network using both HCN and HNS?

Copy link
Contributor

Choose a reason for hiding this comment

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

To be clear, this is a nit-pick and not blocking.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@daschott I was running into an issue where I was not able to get the exact gateway IP from the HCN network object. The way win-bridge CNI gets the gateway IP address is returning me a "different IP" when I tried to use it in win-overlay. That is the only reason I am still using the HNS network object. I already discussed it with @mansikulkarni96 and will take it as a separate improvement PR. I need to dig and find the right way to get the default IP.
If you are aware of getting the correct gateway from the HCN network object, pls do let me know.

epInfo.NetworkName = n.Name
epInfo.EndpointName = hns.ConstructEndpointName(args.ContainerID, args.Netns, epInfo.NetworkName)

if n.IPAM.Type != "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

tip: FYI If desirable, we could expand this to fallback to HNS to provision an IP address and MAC address for you, instead of requiring on an IPAM plugin. This is just an FYI, it is also a perfectly valid decision to require IPAM.

Copy link
Contributor

Choose a reason for hiding this comment

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

To be clear, this is not blocking.

@mansikulkarni96 mansikulkarni96 force-pushed the v2api-suuport-win-overlay branch 3 times, most recently from 3d95ada to 75a5394 Compare April 12, 2022 15:37
@daschott
Copy link
Contributor

Thanks for updating the delete call. There are some minor improvements that could be done w.r.t. querying HNS, but that isn't blocking and can come in a future PR. LGTM

This PR bring V2 API support into win-overlay CNI. With the current V1
API, only docker runtime works for win-overlay. By bringing new changes, we
should be able to use containerd as the runtime.Below are the key
points regarding this implementation.
	1. Clear seperation for V1 & V2 API support
	2. New cni.conf sample that works for win-overlay

Signed-off-by: selansen <esiva@redhat.com>
Signed-off-by: mansikulkarni96 <mankulka@redhat.com>
@dcbw dcbw merged commit 0c39335 into containernetworking:main Apr 14, 2022
@ccamacho
Copy link

Folks, could you cut a new release so this change becomes available? Thanks!

@mansikulkarni96
Copy link

Included in release v1.2.0

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.

None yet

6 participants