@@ -54,13 +54,16 @@ func Start(networkConfig osconfigapi.MasterNetworkConfig, networkClient networkc
54
54
55
55
var err error
56
56
var clusterNetworkEntries []networkapi.ClusterNetworkEntry
57
- for _ , cidr := range networkConfig .ClusterNetworks {
58
- clusterNetworkEntries = append (clusterNetworkEntries , networkapi.ClusterNetworkEntry {CIDR : cidr .CIDR , HostSubnetLength : cidr .HostSubnetLength })
57
+ for _ , entry := range networkConfig .ClusterNetworks {
58
+ clusterNetworkEntries = append (clusterNetworkEntries , networkapi.ClusterNetworkEntry {CIDR : entry .CIDR , HostSubnetLength : entry .HostSubnetLength })
59
59
}
60
60
master .networkInfo , err = common .ParseNetworkInfo (clusterNetworkEntries , networkConfig .ServiceNetworkCIDR )
61
61
if err != nil {
62
62
return err
63
63
}
64
+ if len (clusterNetworkEntries ) == 0 {
65
+ panic ("No ClusterNetworks set in networkConfig; should have been defaulted in if not configured" )
66
+ }
64
67
65
68
configCN := & networkapi.ClusterNetwork {
66
69
TypeMeta : metav1.TypeMeta {Kind : "ClusterNetwork" },
@@ -69,6 +72,10 @@ func Start(networkConfig osconfigapi.MasterNetworkConfig, networkClient networkc
69
72
ClusterNetworks : clusterNetworkEntries ,
70
73
ServiceNetwork : networkConfig .ServiceNetworkCIDR ,
71
74
PluginName : networkConfig .NetworkPluginName ,
75
+
76
+ // Need to set these for backward compat
77
+ Network : clusterNetworkEntries [0 ].CIDR ,
78
+ HostSubnetLength : clusterNetworkEntries [0 ].HostSubnetLength ,
72
79
}
73
80
osapivalidation .SetDefaultClusterNetwork (* configCN )
74
81
0 commit comments