Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Introduction
This feature adds the ability to create multiple vlan interfaces out of a container namespace interface created by another CNI.
It is greatly inspired from PR #903 proposing a similar feature on macvlan.
Problem
I need to have an interface in a pod, and create as many vlan interfaces as I want on that master interface, with a different IPAM configuration on each one.
Proposal
The idea is to relay on the vlan plugin to create such configuration, since creating a vlan interface and using IPAM on is exactly what it is for.
An obvious solution is to chain vlan plugin after the plugin creating master interface, and to use the linkInContainer option to target a master interface in the container namespace.
But the limitation is that it's hard to know the master interface in advance to reuse it in the chained vlan plugin.
The proposal is then use an empty master in the vlan plugin netconf combined with the linkInContainer parameter to ask the plugin to use the CNI_IF_NAME argument as master interface, and to name the new interface as the master with a dot vlanID notation at the end.
Here is a netconf example with a master interface created by the "my-main-plugin", and then the VLAN interfaces 3 and 4 created out of it :