cni icon indicating copy to clipboard operation
cni copied to clipboard

Spec fails to mention that the network namespace path is optional for a DEL command

Open MikeSpreitzer opened this issue 6 years ago • 3 comments

https://github.com/containernetworking/cni/blob/a700ea864b5f1852d179ce83e8bc169f0b4a0ef4/SPEC.md#parameters lists "network namespace path" as parameter for both ADD and DEL, with no notation about it being optional in either case. However, https://github.com/containernetworking/cni/blob/a700ea864b5f1852d179ce83e8bc169f0b4a0ef4/pkg/skel/skel.go#L84 says it is optional, and skel_test.go is consistent with this.

MikeSpreitzer avatar Apr 20 '18 20:04 MikeSpreitzer

You're correct, the spec should be changed.

The namespace was made optional to cope with the case that the container has gone away (so there is no namespace) but the caller still wants to release other resources such as the IP address.

bboreham avatar Apr 25 '18 15:04 bboreham

You're right. Some proposed language to fix this:

When CNI_NETNS is not provided, plugins should clean up as many resources as possible (e.g. releasing IPAM allocations) and return a successful response

squeed avatar Apr 25 '18 15:04 squeed

I would add first an explicit statement that CNI_NETNS is required for ADD and optional for DEL, then go on with the suggested text about what to do when CNI_NETNS is omitted in a DEL.

MikeSpreitzer avatar Apr 25 '18 20:04 MikeSpreitzer