@@ -47,7 +47,7 @@ func (k *K8sSWIFTv2Middleware) GetPodInfoForIPConfigsRequest(ctx context.Context
4747 isSwiftv2 := ValidateSwiftv2Pod (pod )
4848
4949 var mtpnc v1alpha1.MultitenantPodNetworkConfig
50- // if swiftv2 is enabled, check if mtpnc is ready
50+ // if swiftv2 is enabled, get mtpnc
5151 if isSwiftv2 {
5252 mtpnc , respCode , message = k .getMTPNC (ctx , podInfo )
5353 if respCode != types .Success {
@@ -179,17 +179,15 @@ func (k *K8sSWIFTv2Middleware) GetPodInfo(ctx context.Context, req *cns.IPConfig
179179
180180// validates if pod is multitenant by checking the pod labels, used in SWIFT V2 AKS scenario.
181181func ValidateSwiftv2Pod (pod v1.Pod ) bool {
182- // check the pod labels for Swift V2, set the request's SecondaryInterfaceSet flag to true and check if its MTPNC CRD is ready
182+ // check the pod labels for Swift V2
183183 _ , swiftV2PodNetworkLabel := pod .Labels [configuration .LabelPodSwiftV2 ]
184184 _ , swiftV2PodNetworkInstanceLabel := pod .Labels [configuration .LabelPodNetworkInstanceSwiftV2 ]
185- // check if mtpnc is nil here, if not nil then proceed
186185 if swiftV2PodNetworkLabel || swiftV2PodNetworkInstanceLabel {
187186 return true
188187 }
189188 return false
190189}
191190
192- // checks if MTPNC is ready
193191func (k * K8sSWIFTv2Middleware ) getMTPNC (ctx context.Context , podInfo cns.PodInfo ) (mtpncResource v1alpha1.MultitenantPodNetworkConfig , respCode types.ResponseCode , message string ) {
194192 // Check if the MTPNC CRD exists for the pod, if not, return error
195193 mtpnc := v1alpha1.MultitenantPodNetworkConfig {}
0 commit comments