Skip to content

Commit

Permalink
Add internal-network-name networking option
Browse files Browse the repository at this point in the history
This will help in case of multi-nic k8s node deployments.
Previously, cloud provider was assigning all addresses in random
order and k8s was selecting only one of them. But usually,
multi-nic scenario requires to specify which network is
"control" and admins want to bind kubelet listening address only
to that "control" net.

This commit will not affect previous logic until
internal-network-name is specified in cloud-config file.

Related to: kubernetes#407

Change-Id: I1e4076b853b12020c47529b0590f21523b9d26a8
  • Loading branch information
Vladimir Jigulin committed Jan 19, 2019
1 parent 893ed5f commit 3a16e98
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/cloudprovider/providers/openstack/openstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ type BlockStorageOpts struct {
type NetworkingOpts struct {
IPv6SupportDisabled bool `gcfg:"ipv6-support-disabled"`
PublicNetworkName string `gcfg:"public-network-name"`
InternalNetworkName string `gcfg:"internal-network-name"`
}

// RouterOpts is used for Neutron routes
Expand Down Expand Up @@ -544,7 +545,12 @@ func nodeAddresses(srv *servers.Server, networkingOpts NetworkingOpts) ([]v1.Nod
if props.IPType == "floating" || network == networkingOpts.PublicNetworkName {
addressType = v1.NodeExternalIP
} else {
addressType = v1.NodeInternalIP
if networkingOpts.InternalNetworkName == "" || network == networkingOpts.InternalNetworkName {
addressType = v1.NodeInternalIP
} else {
klog.V(5).Infof("Node '%s' address '%s' ignored due to 'internal-network-name' option", srv.Name, props.Addr)
continue
}
}

isIPv6 := net.ParseIP(props.Addr).To4() == nil
Expand Down

0 comments on commit 3a16e98

Please sign in to comment.