Skip to content

Commit d14b638

Browse files
author
Riya
committed
added logic to fix cns bug for overlay subnet expansion
1 parent 73f6733 commit d14b638

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

cns/NetworkContainerContract.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ type CreateNetworkContainerRequest struct {
129129
EndpointPolicies []NetworkContainerRequestPolicies
130130
NCStatus v1alpha.NCStatus
131131
NetworkInterfaceInfo NetworkInterfaceInfo //nolint // introducing new field for backendnic, to be used later by cni code
132+
Scenario v1alpha.NCType //nolint // introducing new field for nnc reconciler
132133
}
133134

134135
func (req *CreateNetworkContainerRequest) Validate() error {

cns/kubecontroller/nodenetworkconfig/conversion.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ func CreateNCRequestFromDynamicNC(nc v1alpha.NetworkContainer) (*cns.CreateNetwo
6767
GatewayIPAddress: nc.DefaultGateway,
6868
},
6969
NCStatus: nc.Status,
70+
Scenario: nc.Type,
7071
}, nil
7172
}
7273

cns/kubecontroller/nodenetworkconfig/conversion_linux.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,6 @@ func createNCRequestFromStaticNCHelper(nc v1alpha.NetworkContainer, primaryIPPre
6363
NetworkInterfaceInfo: cns.NetworkInterfaceInfo{
6464
MACAddress: nc.MacAddress,
6565
},
66+
Scenario: nc.Type,
6667
}, nil
6768
}

cns/restserver/internalapi.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -630,13 +630,15 @@ func (service *HTTPRestService) CreateOrUpdateNetworkContainerInternal(req *cns.
630630
if ok {
631631
existingReq := existingNCInfo.CreateNetworkContainerRequest
632632
if !reflect.DeepEqual(existingReq.IPConfiguration.IPSubnet, req.IPConfiguration.IPSubnet) {
633-
logger.Errorf("[Azure CNS] Error. PrimaryCA is not same, NCId %s, old CA %s/%d, new CA %s/%d",
634-
req.NetworkContainerid,
635-
existingReq.IPConfiguration.IPSubnet.IPAddress,
636-
existingReq.IPConfiguration.IPSubnet.PrefixLength,
637-
req.IPConfiguration.IPSubnet.IPAddress,
638-
req.IPConfiguration.IPSubnet.PrefixLength)
639-
return types.PrimaryCANotSame
633+
if req.Scenario != v1alpha.Overlay { // if overlay -> potentially an overlay subnet expansion is occuring, skip this check
634+
logger.Errorf("[Azure CNS] Error. PrimaryCA is not same, NCId %s, old CA %s/%d, new CA %s/%d",
635+
req.NetworkContainerid,
636+
existingReq.IPConfiguration.IPSubnet.IPAddress,
637+
existingReq.IPConfiguration.IPSubnet.PrefixLength,
638+
req.IPConfiguration.IPSubnet.IPAddress,
639+
req.IPConfiguration.IPSubnet.PrefixLength)
640+
return types.PrimaryCANotSame
641+
}
640642
}
641643
}
642644

cns/restserver/util.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ func (service *HTTPRestService) saveNetworkContainerGoalState(req cns.CreateNetw
174174
// Remove the auth token before saving the containerStatus to cns json file
175175
createNetworkContainerRequest := req
176176
createNetworkContainerRequest.AuthorizationToken = ""
177-
178177
service.state.ContainerStatus[req.NetworkContainerid] = containerstatus{
179178
ID: req.NetworkContainerid,
180179
VMVersion: req.Version,

0 commit comments

Comments
 (0)