Skip to content

Commit a5efba5

Browse files
authored
feat: Updating the NNC with the HomeAz details from the homeAzMonitor Cache
1 parent 1702b3e commit a5efba5

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

cns/restserver/internalapi.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,3 +633,11 @@ func (service *HTTPRestService) CreateOrUpdateNetworkContainerInternal(req *cns.
633633
func (service *HTTPRestService) SetVFForAccelnetNICs() error {
634634
return service.setVFForAccelnetNICs()
635635
}
636+
637+
// GetHomeAz - Get the Home Az for the Node where CNS is running.
638+
func (service *HTTPRestService) GetHomeAz() (homeAzResponse cns.GetHomeAzResponse) {
639+
service.RLock()
640+
homeAzResponse = service.homeAzMonitor.GetHomeAz(context.TODO())
641+
service.RUnlock()
642+
return
643+
}

cns/service/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,6 +1307,8 @@ func InitializeCRDState(ctx context.Context, httpRestService cns.HTTPService, cn
13071307
if cnsconfig.EnableHomeAz {
13081308
// Create Node Network Config CRD and update the Home Az field with the cache value from the HomeAz Monitor
13091309
nnc = createBaseNNC(node)
1310+
homeAzResponse := httpRestServiceImplementation.GetHomeAz()
1311+
nnc.Spec.AvailabilityZone = strconv.FormatUint(uint64(homeAzResponse.HomeAzResponse.HomeAz), 10)
13101312
}
13111313

13121314
if err = directcli.Create(ctx, &nnc); err != nil {

0 commit comments

Comments
 (0)