From 2a560353d840557475a38fac2e19418aa3316a46 Mon Sep 17 00:00:00 2001 From: Vladimir Jigulin Date: Sat, 19 Jan 2019 08:18:15 +0400 Subject: [PATCH] Add internal-network-name networking option That will help in case of multi-nic k8s node deployments when cloud provider was reporting any of node ip addresses instead of kubelet listening ip address. Now you can specify network where cloud provider must select ip addresses from. This will not affect previous logic until admins will not specify internal-network-name option in cloud-config file. Related to: #407 Change-Id: Ifd576ded28f594f74ab45942a1bed11e223650c7 --- pkg/cloudprovider/providers/openstack/openstack.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/cloudprovider/providers/openstack/openstack.go b/pkg/cloudprovider/providers/openstack/openstack.go index 8c967ef1f2..4711199a2a 100644 --- a/pkg/cloudprovider/providers/openstack/openstack.go +++ b/pkg/cloudprovider/providers/openstack/openstack.go @@ -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 @@ -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