@@ -980,7 +980,7 @@ func (service *HTTPRestService) AssignDesiredIPConfigs(podInfo cns.PodInfo, desi
980980// Assigns an available IP from each NC on the NNC. If there is one NC then we expect to only have one IP return
981981// In the case of dualstack we would expect to have one IPv6 from one NC and one IPv4 from a second NC
982982func (service * HTTPRestService ) AssignAvailableIPConfigs (podInfo cns.PodInfo ) ([]cns.PodIpInfo , error ) {
983- // Gets the number of IPFamilies expected to be returned across all NCs
983+ // Map used to get the number of IPFamilies across all NCs
984984 ipFamilies := map [IPFamily ]struct {}{}
985985
986986 // checks to make sure we have at least one NC
@@ -1034,11 +1034,13 @@ func (service *HTTPRestService) AssignAvailableIPConfigs(podInfo cns.PodInfo) ([
10341034 // Checks to make sure we found one IP for each IPFamily
10351035 if len (ipsToAssign ) != numOfIPFamilies {
10361036 for ncID := range service .state .ContainerStatus {
1037- if _ , found := ipsToAssign [ncID ]; found {
1038- continue
1037+ for ipFamily := range service .state .ContainerStatus [ncID ].CreateNetworkContainerRequest .IPFamilies {
1038+ if _ , found := ipsToAssign [ipFamily ]; found {
1039+ continue
1040+ }
1041+ return podIPInfo , errors .Errorf ("not enough IPs available of type %s for %s, waiting on Azure CNS to allocate more with NC Status: %s" ,
1042+ ipFamily , ncID , string (service .state .ContainerStatus [ncID ].CreateNetworkContainerRequest .NCStatus ))
10391043 }
1040- return podIPInfo , errors .Errorf ("not enough IPs available for %s, waiting on Azure CNS to allocate more with NC Status: %s" ,
1041- ncID , string (service .state .ContainerStatus [ncID ].CreateNetworkContainerRequest .NCStatus ))
10421044 }
10431045 }
10441046
0 commit comments