@@ -71,6 +71,8 @@ func (service *HTTPRestService) requestIPConfigHandlerHelper(ctx context.Context
7171 }
7272 }
7373
74+ logger .Printf ("[requestIPConfigHandlerHelper][Himel] podIPInfoResult: %+v" , podIPInfoResult )
75+
7476 // record a pod requesting an IP
7577 service .podsPendingIPAssignment .Push (podInfo .Key ())
7678 podIPInfo , err := requestIPConfigsHelper (service , ipconfigsRequest ) //nolint:contextcheck // appease linter for revert PR
@@ -84,6 +86,8 @@ func (service *HTTPRestService) requestIPConfigHandlerHelper(ctx context.Context
8486 }, err
8587 }
8688
89+ logger .Printf ("[requestIPConfigHandlerHelper][Himel] podIPInfo: %+v" , podIPInfo )
90+
8791 // record a pod assigned an IP
8892 defer func () {
8993 // observe IP assignment wait time
@@ -128,6 +132,9 @@ func (service *HTTPRestService) requestIPConfigHandlerHelperStandalone(ctx conte
128132 }, errors .New ("failed to validate ip config request or unmarshal orchestratorContext" )
129133 }
130134
135+ logger .Printf ("[requestIPConfigHandlerHelperStandalone][Himel] podInfo: %+v" , podInfo )
136+ logger .Printf ("[requestIPConfigHandlerHelperStandalone][Himel] ipconfigsRequest: %+v" , ipconfigsRequest )
137+
131138 orchestratorContext , err := podInfo .OrchestratorContext ()
132139 if err != nil {
133140 return & cns.IPConfigsResponse {}, fmt .Errorf ("error getting orchestrator context from PodInfo %w" , err )
@@ -137,7 +144,7 @@ func (service *HTTPRestService) requestIPConfigHandlerHelperStandalone(ctx conte
137144 // IMPORTANT: although SwiftV2 reuses the concept of NCs, NMAgent doesn't program NCs for SwiftV2, but
138145 // instead programs NICs. When getting SwiftV2 NCs, we want the NIC type and MAC address of the NCs.
139146 // TODO: we need another way to verify and sync NMAgent's NIC programming status. pending new NMAgent API or NIC programming status to be passed in the SwiftV2 create NC request.
140- resp := service .getAllNetworkContainerResponses (cnsRequest ) //nolint:contextcheck // not passed in any methods, appease linter
147+ resp , respCreateRequest := service .getAllNetworkContainerResponsesHimel (cnsRequest ) //nolint:contextcheck // not passed in any methods, appease linter
141148 // return err if returned list has no NCs
142149 if len (resp ) == 0 {
143150 return & cns.IPConfigsResponse {
@@ -148,6 +155,9 @@ func (service *HTTPRestService) requestIPConfigHandlerHelperStandalone(ctx conte
148155 }, ErrGetAllNCResponseEmpty
149156 }
150157
158+ logger .Printf ("[requestIPConfigHandlerHelperStandalone][Himel] resp: %+v" , resp )
159+ logger .Printf ("[requestIPConfigHandlerHelperStandalone][Himel] respCreateRequest: %+v" , respCreateRequest )
160+
151161 // assign NICType and MAC Address for SwiftV2. we assume that there won't be any SwiftV1 NCs here
152162 podIPInfoList := make ([]cns.PodIpInfo , 0 , len (resp ))
153163 for i := range resp {
@@ -156,10 +166,13 @@ func (service *HTTPRestService) requestIPConfigHandlerHelperStandalone(ctx conte
156166 MacAddress : resp [i ].NetworkInterfaceInfo .MACAddress ,
157167 NICType : resp [i ].NetworkInterfaceInfo .NICType ,
158168 NetworkContainerPrimaryIPConfig : resp [i ].IPConfiguration ,
169+ SecondaryIPConfigs : respCreateRequest [i ].SecondaryIPConfigs ,
159170 }
160171 podIPInfoList = append (podIPInfoList , podIPInfo )
161172 }
162173
174+ logger .Printf ("[requestIPConfigHandlerHelperStandalone][Himel] podIPInfoList: %+v" , podIPInfoList )
175+
163176 ipConfigsResp := & cns.IPConfigsResponse {
164177 Response : cns.Response {
165178 ReturnCode : types .Success ,
@@ -176,6 +189,9 @@ func (service *HTTPRestService) requestIPConfigHandlerHelperStandalone(ctx conte
176189 },
177190 }, err
178191 }
192+
193+ logger .Printf ("[requestIPConfigHandlerHelperStandalone][Himel] ipConfigsResp: %+v" , ipConfigsResp )
194+
179195 return ipConfigsResp , nil
180196}
181197
@@ -283,23 +299,31 @@ func (service *HTTPRestService) RequestIPConfigsHandler(w http.ResponseWriter, r
283299 }
284300 var ipConfigsResp * cns.IPConfigsResponse
285301
302+ logger .Printf ("[RequestIPConfigsHandler][Himel] ipconfigsRequest: %+v" , ipconfigsRequest )
303+ logger .Printf ("[RequestIPConfigsHandler][Himel] service: %+v" , service )
304+
286305 // Check if IPConfigsHandlerMiddleware is set
287306 if service .IPConfigsHandlerMiddleware != nil {
307+ logger .Printf ("Himel testing middleware:" )
288308 // Wrap the default datapath handlers with the middleware depending on middleware type
289309 var wrappedHandler cns.IPConfigsHandlerFunc
290310 switch service .IPConfigsHandlerMiddleware .Type () {
291311 case cns .K8sSWIFTV2 :
292312 wrappedHandler = service .IPConfigsHandlerMiddleware .IPConfigsRequestHandlerWrapper (service .requestIPConfigHandlerHelper , service .ReleaseIPConfigHandlerHelper )
293313 // this middleware is used for standalone swiftv2 secenario where a different helper is invoked as the PodInfo is read from cns state
294314 case cns .StandaloneSWIFTV2 :
315+ logger .Printf ("Himel testing middleware standalone" )
295316 wrappedHandler = service .IPConfigsHandlerMiddleware .IPConfigsRequestHandlerWrapper (service .requestIPConfigHandlerHelperStandalone , nil )
296317 }
297318
298319 ipConfigsResp , err = wrappedHandler (r .Context (), ipconfigsRequest )
299320 } else {
321+ logger .Printf ("Himel testing no middleware:" )
300322 ipConfigsResp , err = service .requestIPConfigHandlerHelper (r .Context (), ipconfigsRequest ) // nolint:contextcheck // appease linter
301323 }
302324
325+ logger .Printf ("[RequestIPConfigsHandler][Himel] ipConfigsResp: %+v" , ipConfigsResp )
326+
303327 if err != nil {
304328 w .Header ().Set (cnsReturnCode , ipConfigsResp .Response .ReturnCode .String ())
305329 err = common .Encode (w , & ipConfigsResp )
@@ -1002,6 +1026,9 @@ func (service *HTTPRestService) AssignAvailableIPConfigs(podInfo cns.PodInfo) ([
10021026
10031027 // Get the actual IP families map for validation
10041028 ncIPFamilies := service .getIPFamiliesMap ()
1029+ logger .Printf ("[AssignAvailableIPConfigs][Himel] ncIPFamilies: %+v" , ncIPFamilies )
1030+ logger .Printf ("[AssignAvailableIPConfigs][Himel] numberOfIPs: %+v" , numberOfIPs )
1031+ logger .Printf ("[AssignAvailableIPConfigs][Himel] service.PodIPConfigState: %+v" , service .PodIPConfigState )
10051032
10061033 service .Lock ()
10071034 defer service .Unlock ()
@@ -1371,6 +1398,9 @@ func (service *HTTPRestService) getIPFamiliesMap() map[cns.IPFamily]struct{} {
13711398 if len (ncIPFamilies ) == 2 {
13721399 break
13731400 }
1401+
1402+ logger .Printf ("[getIPFamiliesMap][Himel] secIPConfig: %+v" , secIPConfig )
1403+
13741404 addr , err := netip .ParseAddr (secIPConfig .IPAddress )
13751405 if err != nil {
13761406 continue
0 commit comments