Skip to content

Commit

Permalink
Merge pull request #16905 from danwinship/clusternetwork-3.6-vs-3.7-s…
Browse files Browse the repository at this point in the history
…tage

Automatic merge from submit-queue.

Fix defaulting of legacy ClusterNetwork fields

Backport of #16897
  • Loading branch information
openshift-merge-robot authored Oct 17, 2017
2 parents 71e69d4 + bcf9183 commit 0b34b04
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/network/master/master.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,16 @@ func Start(networkConfig osconfigapi.MasterNetworkConfig, networkClient networkc

var err error
var clusterNetworkEntries []networkapi.ClusterNetworkEntry
for _, cidr := range networkConfig.ClusterNetworks {
clusterNetworkEntries = append(clusterNetworkEntries, networkapi.ClusterNetworkEntry{CIDR: cidr.CIDR, HostSubnetLength: cidr.HostSubnetLength})
for _, entry := range networkConfig.ClusterNetworks {
clusterNetworkEntries = append(clusterNetworkEntries, networkapi.ClusterNetworkEntry{CIDR: entry.CIDR, HostSubnetLength: entry.HostSubnetLength})
}
master.networkInfo, err = common.ParseNetworkInfo(clusterNetworkEntries, networkConfig.ServiceNetworkCIDR)
if err != nil {
return err
}
if len(clusterNetworkEntries) == 0 {
panic("No ClusterNetworks set in networkConfig; should have been defaulted in if not configured")
}

configCN := &networkapi.ClusterNetwork{
TypeMeta: metav1.TypeMeta{Kind: "ClusterNetwork"},
Expand All @@ -69,6 +72,10 @@ func Start(networkConfig osconfigapi.MasterNetworkConfig, networkClient networkc
ClusterNetworks: clusterNetworkEntries,
ServiceNetwork: networkConfig.ServiceNetworkCIDR,
PluginName: networkConfig.NetworkPluginName,

// Need to set these for backward compat
Network: clusterNetworkEntries[0].CIDR,
HostSubnetLength: clusterNetworkEntries[0].HostSubnetLength,
}
osapivalidation.SetDefaultClusterNetwork(*configCN)

Expand Down

0 comments on commit 0b34b04

Please sign in to comment.