Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix a segfault with cidr addresses and correct the creation of cluster network object #17076

Merged
merged 2 commits into from
Oct 29, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions pkg/network/master/master.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,22 @@ func Start(networkConfig osconfigapi.MasterNetworkConfig, networkClient networkc
panic("No ClusterNetworks set in networkConfig; should have been defaulted in if not configured")
}

var parsedClusterNetworkEntries []networkapi.ClusterNetworkEntry
for _, entry := range master.networkInfo.ClusterNetworks {
parsedClusterNetworkEntries = append(parsedClusterNetworkEntries, networkapi.ClusterNetworkEntry{CIDR: entry.ClusterCIDR.String(), HostSubnetLength: entry.HostSubnetLength})
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another reason for converting master.networkInfo.ClusterNetworks to []networkapi.ClusterNetworkEntry


configCN := &networkapi.ClusterNetwork{
TypeMeta: metav1.TypeMeta{Kind: "ClusterNetwork"},
ObjectMeta: metav1.ObjectMeta{Name: networkapi.ClusterNetworkDefault},

ClusterNetworks: clusterNetworkEntries,
ServiceNetwork: networkConfig.ServiceNetworkCIDR,
ClusterNetworks: parsedClusterNetworkEntries,
ServiceNetwork: master.networkInfo.ServiceNetwork.String(),
PluginName: networkConfig.NetworkPluginName,

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

Expand Down