File tree Expand file tree Collapse file tree 2 files changed +4
-12
lines changed Expand file tree Collapse file tree 2 files changed +4
-12
lines changed Original file line number Diff line number Diff line change 88 "fmt"
99 "math/rand"
1010 "net"
11- "net/netip"
1211 "os"
1312 "reflect"
1413 "strconv"
@@ -914,16 +913,6 @@ func generateNetworkContainerRequest(secondaryIps map[string]cns.SecondaryIPConf
914913 ipSubnet .IPAddress = primaryIP
915914 ipSubnet .PrefixLength = subnetPrfixLength
916915 ipConfig .IPSubnet = ipSubnet
917- ipFamilies := map [cns.IPFamily ]struct {}{}
918-
919- for _ , secIPConfig := range secondaryIps {
920- IP , _ := netip .ParseAddr (secIPConfig .IPAddress )
921- if IP .Is4 () {
922- ipFamilies [cns .IPv4Family ] = struct {}{}
923- } else {
924- ipFamilies [cns .IPv6Family ] = struct {}{}
925- }
926- }
927916
928917 req := cns.CreateNetworkContainerRequest {
929918 NetworkContainerType : dockerContainerType ,
Original file line number Diff line number Diff line change 2525 ErrStoreEmpty = errors .New ("empty endpoint state store" )
2626 ErrParsePodIPFailed = errors .New ("failed to parse pod's ip" )
2727 ErrNoNCs = errors .New ("no NCs found in the CNS internal state" )
28- ErrNoIPFamilies = errors .New ("No IP Families found on NCs" )
2928 ErrOptManageEndpointState = errors .New ("CNS is not set to manage the endpoint state" )
3029 ErrEndpointStateNotFound = errors .New ("endpoint state could not be found in the statefile" )
3130 ErrGetAllNCResponseEmpty = errors .New ("failed to get NC responses from statefile" )
@@ -1002,6 +1001,10 @@ func (service *HTTPRestService) AssignAvailableIPConfigs(podInfo cns.PodInfo) ([
10021001
10031002 // Gets the IPFamilies from all NCs and store them in a map. This will be used to determine the number of IPs to return
10041003 for ncID := range service .state .ContainerStatus {
1004+ if len (ipFamilies ) == 2 {
1005+ break
1006+ }
1007+
10051008 for _ , secIPConfig := range service .state .ContainerStatus [ncID ].CreateNetworkContainerRequest .SecondaryIPConfigs {
10061009 if len (ipFamilies ) == 2 {
10071010 break
You can’t perform that action at this time.
0 commit comments