Skip to content

Commit 69c671c

Browse files
author
Ashish Nair
committed
upadte: Fixing the type for the Availability zone for the NNC to int64 type
1 parent cfea771 commit 69c671c

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

cns/service/main.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,7 +1306,8 @@ func InitializeCRDState(ctx context.Context, httpRestService cns.HTTPService, cn
13061306
// Create the base NNC CRD if HomeAz is enabled
13071307
if cnsconfig.EnableHomeAz {
13081308
homeAzResponse := httpRestServiceImplementation.GetHomeAz(ctx)
1309-
logger.Printf("[Azure CNS] HomeAz: %s", strconv.FormatUint(uint64(homeAzResponse.HomeAzResponse.HomeAz), 10))
1309+
az := int64(homeAzResponse.HomeAzResponse.HomeAz)
1310+
logger.Printf("[Azure CNS] HomeAz: %s", strconv.FormatInt(az, 10))
13101311
// Create Node Network Config CRD and update the Home Az field with the cache value from the HomeAz Monitor
13111312
var nnc *v1alpha.NodeNetworkConfig
13121313
if nnc, err = directnnccli.Get(ctx, types.NamespacedName{Namespace: "kube-system", Name: nodeName}); err != nil {
@@ -1316,13 +1317,13 @@ func InitializeCRDState(ctx context.Context, httpRestService cns.HTTPService, cn
13161317
newNNC := createBaseNNC(node)
13171318
if nnc == nil {
13181319
logger.Printf("[Azure CNS] Creating new base NNC")
1319-
newNNC.Spec.AvailabilityZone = strconv.FormatUint(uint64(homeAzResponse.HomeAzResponse.HomeAz), 10)
1320+
newNNC.Spec.AvailabilityZone = az
13201321
if err = directcli.Create(ctx, newNNC); err != nil {
13211322
return errors.Wrap(err, "failed to create base NNC")
13221323
}
13231324
} else {
1324-
logger.Printf("[Azure CNS] Patching existing NNC with new Spec with HomeAz")
1325-
newNNC.Spec.AvailabilityZone = strconv.FormatUint(uint64(homeAzResponse.HomeAzResponse.HomeAz), 10)
1325+
logger.Printf("[Azure CNS] Patching existing NNC with new Spec with HomeAz %d", az)
1326+
newNNC.Spec.AvailabilityZone = az
13261327
newNNC.Spec.RequestedIPCount = nnc.Spec.RequestedIPCount
13271328
newNNC.Spec.IPsNotInUse = nnc.Spec.IPsNotInUse
13281329
newNNC.Status = nnc.Status

crd/nodenetworkconfig/api/v1alpha/nodenetworkconfig.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ type NodeNetworkConfigSpec struct {
4848
RequestedIPCount int64 `json:"requestedIPCount"`
4949
IPsNotInUse []string `json:"ipsNotInUse,omitempty"`
5050
// AvailabilityZone contains the Azure availability zone for the virtual machine where network containers are placed.
51+
// NMA returns an int value for the availability zone.
5152
// +kubebuilder:validation:Optional
52-
AvailabilityZone string `json:"availabilityZone,omitempty"`
53+
AvailabilityZone int64 `json:"availabilityZone,omitempty"`
5354
}
5455

5556
// Status indicates the NNC reconcile status

0 commit comments

Comments
 (0)