From 5e5560294adef0d966983065a350de3b8c37ec62 Mon Sep 17 00:00:00 2001 From: Kshitija Murudi Date: Tue, 12 Sep 2023 23:32:08 -0700 Subject: [PATCH 1/7] add a new container type for l1vh singularity container request --- cns/NetworkContainerContract.go | 1 + cns/restserver/util.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cns/NetworkContainerContract.go b/cns/NetworkContainerContract.go index 5e45e0261b..b2b7a6fae9 100644 --- a/cns/NetworkContainerContract.go +++ b/cns/NetworkContainerContract.go @@ -51,6 +51,7 @@ const ( Basic = "Basic" JobObject = "JobObject" COW = "COW" // Container on Windows + BackendNIC = "BackendNIC" ) // Orchestrator Types diff --git a/cns/restserver/util.go b/cns/restserver/util.go index 1f6fe6b23c..e008535945 100644 --- a/cns/restserver/util.go +++ b/cns/restserver/util.go @@ -177,7 +177,7 @@ func (service *HTTPRestService) saveNetworkContainerGoalState( fallthrough case cns.AzureFirstParty: fallthrough - case cns.WebApps: // todo: Is WebApps an OrchastratorType or ContainerType? + case cns.WebApps, cns.BackendNIC: // todo: Is WebApps an OrchastratorType or ContainerType? podInfo, err := cns.UnmarshalPodInfo(req.OrchestratorContext) if err != nil { errBuf := fmt.Sprintf("Unmarshalling %s failed with error %v", req.NetworkContainerType, err) From dce1b3f3322300b18c8acbaab618573d1ec592bc Mon Sep 17 00:00:00 2001 From: Kshitija Murudi Date: Thu, 14 Sep 2023 10:18:13 -0700 Subject: [PATCH 2/7] feat: adding fields required for backendnetworkinterface NC Request --- cns/NetworkContainerContract.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cns/NetworkContainerContract.go b/cns/NetworkContainerContract.go index b2b7a6fae9..9070071bf8 100644 --- a/cns/NetworkContainerContract.go +++ b/cns/NetworkContainerContract.go @@ -107,6 +107,8 @@ type CreateNetworkContainerRequest struct { AllowNCToHostCommunication bool EndpointPolicies []NetworkContainerRequestPolicies NCStatus v1alpha.NCStatus + BackendNetworkInterfaceID string + MACAddress string } // CreateNetworkContainerRequest implements fmt.Stringer for logging From ad6e0baec8a831aeebf779f85ba165a66afbdda8 Mon Sep 17 00:00:00 2001 From: Kshitija Murudi Date: Tue, 3 Oct 2023 17:13:31 -0700 Subject: [PATCH 3/7] fix: add nctype-case to outer switch statement --- cns/restserver/util.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cns/restserver/util.go b/cns/restserver/util.go index e008535945..da81a063ea 100644 --- a/cns/restserver/util.go +++ b/cns/restserver/util.go @@ -165,6 +165,8 @@ func (service *HTTPRestService) saveNetworkContainerGoalState( fallthrough case cns.COW: fallthrough + case cns.BackendNIC: + fallthrough case cns.WebApps: switch service.state.OrchestratorType { case cns.Kubernetes: From 9cf5863f378997b7d9e986507b0510c85f0b671c Mon Sep 17 00:00:00 2001 From: Kshitija Murudi Date: Thu, 12 Oct 2023 15:30:42 -0700 Subject: [PATCH 4/7] feat: new struct to store nicInfo sent by DNC to CNS to support l1vh --- cns/NetworkContainerContract.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cns/NetworkContainerContract.go b/cns/NetworkContainerContract.go index 9070071bf8..cc18b0d640 100644 --- a/cns/NetworkContainerContract.go +++ b/cns/NetworkContainerContract.go @@ -107,8 +107,7 @@ type CreateNetworkContainerRequest struct { AllowNCToHostCommunication bool EndpointPolicies []NetworkContainerRequestPolicies NCStatus v1alpha.NCStatus - BackendNetworkInterfaceID string - MACAddress string + backendNICInfo BackendNICInfo } // CreateNetworkContainerRequest implements fmt.Stringer for logging @@ -320,6 +319,12 @@ type MultiTenancyInfo struct { ID int // This can be vlanid, vxlanid, gre-key etc. (depends on EnacapType). } +type BackendNICInfo struct { + NICType string + BackendNetworkInterfaceID string + MACAddress string +} + // IPConfiguration contains details about ip config to provision in the VM. type IPConfiguration struct { IPSubnet IPSubnet From 05f6f103d667c35ccde8937b097adeb4ede7bf68 Mon Sep 17 00:00:00 2001 From: Kshitija Murudi Date: Wed, 18 Oct 2023 23:35:45 -0700 Subject: [PATCH 5/7] fix: nolint for 2 cases, remove backendnic-id from config --- cns/NetworkContainerContract.go | 7 +++---- cns/restserver/util.go | 4 +--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/cns/NetworkContainerContract.go b/cns/NetworkContainerContract.go index cc18b0d640..810489771b 100644 --- a/cns/NetworkContainerContract.go +++ b/cns/NetworkContainerContract.go @@ -107,7 +107,7 @@ type CreateNetworkContainerRequest struct { AllowNCToHostCommunication bool EndpointPolicies []NetworkContainerRequestPolicies NCStatus v1alpha.NCStatus - backendNICInfo BackendNICInfo + backendNICInfo BackendNICInfo //nolint // introducing new field for backendnic, to be used later by cni code } // CreateNetworkContainerRequest implements fmt.Stringer for logging @@ -320,9 +320,8 @@ type MultiTenancyInfo struct { } type BackendNICInfo struct { - NICType string - BackendNetworkInterfaceID string - MACAddress string + NICType string + MACAddress string } // IPConfiguration contains details about ip config to provision in the VM. diff --git a/cns/restserver/util.go b/cns/restserver/util.go index da81a063ea..1f8b25130c 100644 --- a/cns/restserver/util.go +++ b/cns/restserver/util.go @@ -163,9 +163,7 @@ func (service *HTTPRestService) saveNetworkContainerGoalState( fallthrough case cns.JobObject: fallthrough - case cns.COW: - fallthrough - case cns.BackendNIC: + case cns.COW, cns.BackendNIC: fallthrough case cns.WebApps: switch service.state.OrchestratorType { From fc7974fa8493c57aa930bc786eaba52793cb5930 Mon Sep 17 00:00:00 2001 From: Kshitija Murudi Date: Thu, 19 Oct 2023 13:14:18 -0700 Subject: [PATCH 6/7] fix: refactor networkInterfaceInfo --- cns/NetworkContainerContract.go | 10 ++++++---- cns/restserver/util.go | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/cns/NetworkContainerContract.go b/cns/NetworkContainerContract.go index 810489771b..8f444e6f90 100644 --- a/cns/NetworkContainerContract.go +++ b/cns/NetworkContainerContract.go @@ -51,7 +51,7 @@ const ( Basic = "Basic" JobObject = "JobObject" COW = "COW" // Container on Windows - BackendNIC = "BackendNIC" + BackendNICNC = "BackendNICNC" ) // Orchestrator Types @@ -78,6 +78,8 @@ const ( InfraNIC NICType = "InfraNIC" // Delegated VM NICs are projected from VM to container network namespace DelegatedVMNIC NICType = "DelegatedVMNIC" + // BackendNIC NICs are used for infiniband nics on a VM + BackendNIC NICType = "BackendNIC" ) // ChannelMode :- CNS channel modes @@ -107,7 +109,7 @@ type CreateNetworkContainerRequest struct { AllowNCToHostCommunication bool EndpointPolicies []NetworkContainerRequestPolicies NCStatus v1alpha.NCStatus - backendNICInfo BackendNICInfo //nolint // introducing new field for backendnic, to be used later by cni code + networkInterfaceInfo NetworkInterfaceInfo //nolint // introducing new field for backendnic, to be used later by cni code } // CreateNetworkContainerRequest implements fmt.Stringer for logging @@ -319,7 +321,7 @@ type MultiTenancyInfo struct { ID int // This can be vlanid, vxlanid, gre-key etc. (depends on EnacapType). } -type BackendNICInfo struct { +type NetworkInterfaceInfo struct { NICType string MACAddress string } @@ -422,7 +424,7 @@ type PodIpInfo struct { PodIPConfig IPSubnet NetworkContainerPrimaryIPConfig IPConfiguration HostPrimaryIPInfo HostIPInfo - // NICType defines whether NIC is InfraNIC or DelegatedVMNIC + // NICType defines whether NIC is InfraNIC or DelegatedVMNIC or BackendNIC NICType NICType InterfaceName string // MacAddress of interface diff --git a/cns/restserver/util.go b/cns/restserver/util.go index 1f8b25130c..46b6f4e8b4 100644 --- a/cns/restserver/util.go +++ b/cns/restserver/util.go @@ -163,7 +163,7 @@ func (service *HTTPRestService) saveNetworkContainerGoalState( fallthrough case cns.JobObject: fallthrough - case cns.COW, cns.BackendNIC: + case cns.COW, cns.BackendNICNC: fallthrough case cns.WebApps: switch service.state.OrchestratorType { @@ -177,7 +177,7 @@ func (service *HTTPRestService) saveNetworkContainerGoalState( fallthrough case cns.AzureFirstParty: fallthrough - case cns.WebApps, cns.BackendNIC: // todo: Is WebApps an OrchastratorType or ContainerType? + case cns.WebApps, cns.BackendNICNC: // todo: Is WebApps an OrchastratorType or ContainerType? podInfo, err := cns.UnmarshalPodInfo(req.OrchestratorContext) if err != nil { errBuf := fmt.Sprintf("Unmarshalling %s failed with error %v", req.NetworkContainerType, err) From 8467aada9b7e303d5696b233979912ceca7af5e3 Mon Sep 17 00:00:00 2001 From: Kshitija Murudi Date: Sun, 22 Oct 2023 17:17:14 -0700 Subject: [PATCH 7/7] feat:add NetworkInterfaceInfo details to getallNCResponse in cns, to be used by CNI ADD net-plugin --- cns/NetworkContainerContract.go | 10 ++++++---- cns/restserver/util.go | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cns/NetworkContainerContract.go b/cns/NetworkContainerContract.go index 8f444e6f90..d1c9329fd3 100644 --- a/cns/NetworkContainerContract.go +++ b/cns/NetworkContainerContract.go @@ -109,7 +109,7 @@ type CreateNetworkContainerRequest struct { AllowNCToHostCommunication bool EndpointPolicies []NetworkContainerRequestPolicies NCStatus v1alpha.NCStatus - networkInterfaceInfo NetworkInterfaceInfo //nolint // introducing new field for backendnic, to be used later by cni code + NetworkInterfaceInfo NetworkInterfaceInfo //nolint // introducing new field for backendnic, to be used later by cni code } // CreateNetworkContainerRequest implements fmt.Stringer for logging @@ -117,9 +117,10 @@ func (req *CreateNetworkContainerRequest) String() string { return fmt.Sprintf("CreateNetworkContainerRequest"+ "{Version: %s, NetworkContainerType: %s, NetworkContainerid: %s, PrimaryInterfaceIdentifier: %s, "+ "LocalIPConfiguration: %+v, IPConfiguration: %+v, SecondaryIPConfigs: %+v, MultitenancyInfo: %+v, "+ - "AllowHostToNCCommunication: %t, AllowNCToHostCommunication: %t, NCStatus: %s}", + "AllowHostToNCCommunication: %t, AllowNCToHostCommunication: %t, NCStatus: %s, NetworkInterfaceInfo: %+v}", req.Version, req.NetworkContainerType, req.NetworkContainerid, req.PrimaryInterfaceIdentifier, req.LocalIPConfiguration, - req.IPConfiguration, req.SecondaryIPConfigs, req.MultiTenancyInfo, req.AllowHostToNCCommunication, req.AllowNCToHostCommunication, string(req.NCStatus)) + req.IPConfiguration, req.SecondaryIPConfigs, req.MultiTenancyInfo, req.AllowHostToNCCommunication, req.AllowNCToHostCommunication, + string(req.NCStatus), req.NetworkInterfaceInfo) } // NetworkContainerRequestPolicies - specifies policies associated with create network request @@ -322,7 +323,7 @@ type MultiTenancyInfo struct { } type NetworkInterfaceInfo struct { - NICType string + NICType NICType MACAddress string } @@ -418,6 +419,7 @@ type GetNetworkContainerResponse struct { Response Response AllowHostToNCCommunication bool AllowNCToHostCommunication bool + NetworkInterfaceInfo NetworkInterfaceInfo } type PodIpInfo struct { diff --git a/cns/restserver/util.go b/cns/restserver/util.go index 46b6f4e8b4..094fe49872 100644 --- a/cns/restserver/util.go +++ b/cns/restserver/util.go @@ -501,6 +501,7 @@ func (service *HTTPRestService) getAllNetworkContainerResponses( LocalIPConfiguration: savedReq.LocalIPConfiguration, AllowHostToNCCommunication: savedReq.AllowHostToNCCommunication, AllowNCToHostCommunication: savedReq.AllowNCToHostCommunication, + NetworkInterfaceInfo: savedReq.NetworkInterfaceInfo, } // If the NC version check wasn't skipped, take into account the VFP programming status when returning the response