@@ -18,19 +18,22 @@ func createNCRequestFromStaticNCHelper(nc v1alpha.NetworkContainer, primaryIPPre
1818 secondaryIPConfigs := map [string ]cns.SecondaryIPConfig {}
1919 ipFamilies := map [cns.IPFamily ]struct {}{}
2020
21- // iterate through all IP addresses in the subnet described by primaryPrefix and
22- // add them to the request as secondary IPConfigs.
23- for addr := primaryIPPrefix .Masked ().Addr (); primaryIPPrefix .Contains (addr ); addr = addr .Next () {
24- secondaryIPConfigs [addr .String ()] = cns.SecondaryIPConfig {
25- IPAddress : addr .String (),
26- NCVersion : int (nc .Version ),
21+ // in the case of vnet prefix on swift v2 the primary IP is a /32 and should not be added to secondary IP configs
22+ if ! primaryIPPrefix .IsSingleIP () {
23+ // iterate through all IP addresses in the subnet described by primaryPrefix and
24+ // add them to the request as secondary IPConfigs.
25+ for addr := primaryIPPrefix .Masked ().Addr (); primaryIPPrefix .Contains (addr ); addr = addr .Next () {
26+ secondaryIPConfigs [addr .String ()] = cns.SecondaryIPConfig {
27+ IPAddress : addr .String (),
28+ NCVersion : int (nc .Version ),
29+ }
30+ }
31+ // adds the IPFamily of the primary CIDR to the set
32+ if primaryIPPrefix .Addr ().Is4 () {
33+ ipFamilies [cns .IPv4Family ] = struct {}{}
34+ } else {
35+ ipFamilies [cns .IPv6Family ] = struct {}{}
2736 }
28- }
29- // adds the IPFamily of the primary CIDR to the set
30- if primaryIPPrefix .Addr ().Is4 () {
31- ipFamilies [cns .IPv4Family ] = struct {}{}
32- } else {
33- ipFamilies [cns .IPv6Family ] = struct {}{}
3437 }
3538
3639 // Add IPs from CIDR block to the secondary IPConfigs
0 commit comments