Skip to content

create APIPA with DelegatedNICs #3595

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cni/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,10 @@ func (plugin *NetPlugin) Add(args *cniSkel.CmdArgs) error {
ifInfo := ipamAddResult.interfaceInfo[key]
logger.Info("Processing interfaceInfo:", zap.Any("ifInfo", ifInfo))

if ifInfo.NICType == cns.DelegatedVMNIC {
logger.Info("The NIC type is Delegated VM NIC, we will also create the APIPA endpoint")
}

natInfo := getNATInfo(nwCfg, options[network.SNATIPKey], enableSnatForDNS)
networkID, _ := plugin.getNetworkID(args.Netns, &ifInfo, nwCfg)

Expand Down
3 changes: 3 additions & 0 deletions cns/NetworkContainerContract.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ const (
// NodeNetworkInterfaceAccelnetFrontendNIC is a type of front-end nic that offers accelerated networking performance
NodeNetworkInterfaceAccelnetFrontendNIC NICType = "FrontendNIC_Accelnet"

// APIPA is the type of nic that is used for APIPA
NodeNetworkInterfaceAPIPANIC NICType = "APIPANIC"

// TODO: These two const are currently unused due to version compatibility with DNC. DelegatedVMNIC and NodeNetworkInterfaceBackendNIC should be renamed to align with the naming convention with DNC
// NodeNetworkInterfaceFrontendNIC is the new name for DelegatedVMNIC
NodeNetworkInterfaceFrontendNIC NICType = "FrontendNIC"
Expand Down
8 changes: 8 additions & 0 deletions network/endpoint_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,14 @@ func (nw *network) newEndpointImplHnsV2(cli apipaClient, epInfo *EndpointInfo) (
}
}()

// when using delegated nics, automatically allow inbound from nc to host
if (epInfo.NICType == cns.NodeNetworkInterfaceFrontendNIC || epInfo.NICType == cns.NodeNetworkInterfaceAPIPANIC) {
if !epInfo.AllowInboundFromNCToHost {
logger.Info("setting AllowInboundFromNCToHost to true since the NC has a delegated nic", zap.String("PODName", epInfo.PODName), zap.String("NetworkContainerID", epInfo.NetworkContainerID))
epInfo.AllowInboundFromNCToHost = true
}
}

// If the Host - container connectivity is requested, create endpoint in HostNCApipaNetwork
if epInfo.AllowInboundFromHostToNC || epInfo.AllowInboundFromNCToHost {
if err = nw.createHostNCApipaEndpoint(cli, epInfo); err != nil {
Expand Down