@@ -991,7 +991,7 @@ func (service *HTTPRestService) AssignDesiredIPConfigs(podInfo cns.PodInfo, desi
991991// Assigns an available IP from each NC on the NNC. If there is one NC then we expect to only have one IP return
992992// In the case of dualstack we would expect to have one IPv6 from one NC and one IPv4 from a second NC
993993func (service * HTTPRestService ) AssignAvailableIPConfigs (podInfo cns.PodInfo ) ([]cns.PodIpInfo , error ) {
994- // Gets the number of IPFamilies expected to be returned across all NCs
994+ // Map used to get the number of IPFamilies across all NCs
995995 ipFamilies := map [IPFamily ]struct {}{}
996996
997997 // checks to make sure we have at least one NC
@@ -1045,11 +1045,13 @@ func (service *HTTPRestService) AssignAvailableIPConfigs(podInfo cns.PodInfo) ([
10451045 // Checks to make sure we found one IP for each IPFamily
10461046 if len (ipsToAssign ) != numOfIPFamilies {
10471047 for ncID := range service .state .ContainerStatus {
1048- if _ , found := ipsToAssign [ncID ]; found {
1049- continue
1048+ for ipFamily := range service .state .ContainerStatus [ncID ].CreateNetworkContainerRequest .IPFamilies {
1049+ if _ , found := ipsToAssign [ipFamily ]; found {
1050+ continue
1051+ }
1052+ return podIPInfo , errors .Errorf ("not enough IPs available of type %s for %s, waiting on Azure CNS to allocate more with NC Status: %s" ,
1053+ ipFamily , ncID , string (service .state .ContainerStatus [ncID ].CreateNetworkContainerRequest .NCStatus ))
10501054 }
1051- return podIPInfo , errors .Errorf ("not enough IPs available for %s, waiting on Azure CNS to allocate more with NC Status: %s" ,
1052- ncID , string (service .state .ContainerStatus [ncID ].CreateNetworkContainerRequest .NCStatus ))
10531055 }
10541056 }
10551057
0 commit comments