Skip to content

Commit dda7fe8

Browse files
authored
add a new container type for l1vh singularity container request (#2215)
* add a new container type for l1vh singularity container request * feat: adding fields required for backendnetworkinterface NC Request * fix: add nctype-case to outer switch statement * feat: new struct to store nicInfo sent by DNC to CNS to support l1vh * fix: nolint for 2 cases, remove backendnic-id from config * fix: refactor networkInterfaceInfo * feat:add NetworkInterfaceInfo details to getallNCResponse in cns, to be used by CNI ADD net-plugin
1 parent b65b051 commit dda7fe8

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

cns/NetworkContainerContract.go

+14-3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ const (
5151
Basic = "Basic"
5252
JobObject = "JobObject"
5353
COW = "COW" // Container on Windows
54+
BackendNICNC = "BackendNICNC"
5455
)
5556

5657
// Orchestrator Types
@@ -77,6 +78,8 @@ const (
7778
InfraNIC NICType = "InfraNIC"
7879
// Delegated VM NICs are projected from VM to container network namespace
7980
DelegatedVMNIC NICType = "DelegatedVMNIC"
81+
// BackendNIC NICs are used for infiniband nics on a VM
82+
BackendNIC NICType = "BackendNIC"
8083
)
8184

8285
// ChannelMode :- CNS channel modes
@@ -106,16 +109,18 @@ type CreateNetworkContainerRequest struct {
106109
AllowNCToHostCommunication bool
107110
EndpointPolicies []NetworkContainerRequestPolicies
108111
NCStatus v1alpha.NCStatus
112+
NetworkInterfaceInfo NetworkInterfaceInfo //nolint // introducing new field for backendnic, to be used later by cni code
109113
}
110114

111115
// CreateNetworkContainerRequest implements fmt.Stringer for logging
112116
func (req *CreateNetworkContainerRequest) String() string {
113117
return fmt.Sprintf("CreateNetworkContainerRequest"+
114118
"{Version: %s, NetworkContainerType: %s, NetworkContainerid: %s, PrimaryInterfaceIdentifier: %s, "+
115119
"LocalIPConfiguration: %+v, IPConfiguration: %+v, SecondaryIPConfigs: %+v, MultitenancyInfo: %+v, "+
116-
"AllowHostToNCCommunication: %t, AllowNCToHostCommunication: %t, NCStatus: %s}",
120+
"AllowHostToNCCommunication: %t, AllowNCToHostCommunication: %t, NCStatus: %s, NetworkInterfaceInfo: %+v}",
117121
req.Version, req.NetworkContainerType, req.NetworkContainerid, req.PrimaryInterfaceIdentifier, req.LocalIPConfiguration,
118-
req.IPConfiguration, req.SecondaryIPConfigs, req.MultiTenancyInfo, req.AllowHostToNCCommunication, req.AllowNCToHostCommunication, string(req.NCStatus))
122+
req.IPConfiguration, req.SecondaryIPConfigs, req.MultiTenancyInfo, req.AllowHostToNCCommunication, req.AllowNCToHostCommunication,
123+
string(req.NCStatus), req.NetworkInterfaceInfo)
119124
}
120125

121126
// NetworkContainerRequestPolicies - specifies policies associated with create network request
@@ -317,6 +322,11 @@ type MultiTenancyInfo struct {
317322
ID int // This can be vlanid, vxlanid, gre-key etc. (depends on EnacapType).
318323
}
319324

325+
type NetworkInterfaceInfo struct {
326+
NICType NICType
327+
MACAddress string
328+
}
329+
320330
// IPConfiguration contains details about ip config to provision in the VM.
321331
type IPConfiguration struct {
322332
IPSubnet IPSubnet
@@ -409,13 +419,14 @@ type GetNetworkContainerResponse struct {
409419
Response Response
410420
AllowHostToNCCommunication bool
411421
AllowNCToHostCommunication bool
422+
NetworkInterfaceInfo NetworkInterfaceInfo
412423
}
413424

414425
type PodIpInfo struct {
415426
PodIPConfig IPSubnet
416427
NetworkContainerPrimaryIPConfig IPConfiguration
417428
HostPrimaryIPInfo HostIPInfo
418-
// NICType defines whether NIC is InfraNIC or DelegatedVMNIC
429+
// NICType defines whether NIC is InfraNIC or DelegatedVMNIC or BackendNIC
419430
NICType NICType
420431
InterfaceName string
421432
// MacAddress of interface

cns/restserver/util.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ func (service *HTTPRestService) saveNetworkContainerGoalState(
163163
fallthrough
164164
case cns.JobObject:
165165
fallthrough
166-
case cns.COW:
166+
case cns.COW, cns.BackendNICNC:
167167
fallthrough
168168
case cns.WebApps:
169169
switch service.state.OrchestratorType {
@@ -177,7 +177,7 @@ func (service *HTTPRestService) saveNetworkContainerGoalState(
177177
fallthrough
178178
case cns.AzureFirstParty:
179179
fallthrough
180-
case cns.WebApps: // todo: Is WebApps an OrchastratorType or ContainerType?
180+
case cns.WebApps, cns.BackendNICNC: // todo: Is WebApps an OrchastratorType or ContainerType?
181181
podInfo, err := cns.UnmarshalPodInfo(req.OrchestratorContext)
182182
if err != nil {
183183
errBuf := fmt.Sprintf("Unmarshalling %s failed with error %v", req.NetworkContainerType, err)
@@ -501,6 +501,7 @@ func (service *HTTPRestService) getAllNetworkContainerResponses(
501501
LocalIPConfiguration: savedReq.LocalIPConfiguration,
502502
AllowHostToNCCommunication: savedReq.AllowHostToNCCommunication,
503503
AllowNCToHostCommunication: savedReq.AllowNCToHostCommunication,
504+
NetworkInterfaceInfo: savedReq.NetworkInterfaceInfo,
504505
}
505506

506507
// If the NC version check wasn't skipped, take into account the VFP programming status when returning the response

0 commit comments

Comments
 (0)