mirror of https://github.com/k3s-io/k3s
remove deprecated NodeLegacyHostIP
parent
35159f9c45
commit
7d00e5cfb6
|
@ -102,8 +102,6 @@ func NewServerRunOptions() *ServerRunOptions {
|
|||
// external, preferring DNS if reported
|
||||
string(api.NodeExternalDNS),
|
||||
string(api.NodeExternalIP),
|
||||
|
||||
string(api.NodeLegacyHostIP),
|
||||
},
|
||||
EnableHttps: true,
|
||||
HTTPTimeout: time.Duration(5) * time.Second,
|
||||
|
|
|
@ -483,7 +483,6 @@ func createService(clientset client.Interface, namespace, svcName, federationNam
|
|||
func getClusterNodeIPs(clientset client.Interface) ([]string, error) {
|
||||
preferredAddressTypes := []api.NodeAddressType{
|
||||
api.NodeExternalIP,
|
||||
api.NodeLegacyHostIP,
|
||||
}
|
||||
nodeList, err := clientset.Core().Nodes().List(metav1.ListOptions{})
|
||||
if err != nil {
|
||||
|
|
|
@ -2904,16 +2904,12 @@ type NodeCondition struct {
|
|||
|
||||
type NodeAddressType string
|
||||
|
||||
// These are valid address types of node. NodeLegacyHostIP is used to transit
|
||||
// from out-dated HostIP field to NodeAddress.
|
||||
const (
|
||||
// Deprecated: NodeLegacyHostIP will be removed in 1.7.
|
||||
NodeLegacyHostIP NodeAddressType = "LegacyHostIP"
|
||||
NodeHostName NodeAddressType = "Hostname"
|
||||
NodeExternalIP NodeAddressType = "ExternalIP"
|
||||
NodeInternalIP NodeAddressType = "InternalIP"
|
||||
NodeExternalDNS NodeAddressType = "ExternalDNS"
|
||||
NodeInternalDNS NodeAddressType = "InternalDNS"
|
||||
NodeHostName NodeAddressType = "Hostname"
|
||||
NodeExternalIP NodeAddressType = "ExternalIP"
|
||||
NodeInternalIP NodeAddressType = "InternalIP"
|
||||
NodeExternalDNS NodeAddressType = "ExternalDNS"
|
||||
NodeInternalDNS NodeAddressType = "InternalDNS"
|
||||
)
|
||||
|
||||
type NodeAddress struct {
|
||||
|
|
|
@ -3345,13 +3345,11 @@ type NodeAddressType string
|
|||
|
||||
// These are valid address type of node.
|
||||
const (
|
||||
// Deprecated: NodeLegacyHostIP will be removed in 1.7.
|
||||
NodeLegacyHostIP NodeAddressType = "LegacyHostIP"
|
||||
NodeHostName NodeAddressType = "Hostname"
|
||||
NodeExternalIP NodeAddressType = "ExternalIP"
|
||||
NodeInternalIP NodeAddressType = "InternalIP"
|
||||
NodeExternalDNS NodeAddressType = "ExternalDNS"
|
||||
NodeInternalDNS NodeAddressType = "InternalDNS"
|
||||
NodeHostName NodeAddressType = "Hostname"
|
||||
NodeExternalIP NodeAddressType = "ExternalIP"
|
||||
NodeInternalIP NodeAddressType = "InternalIP"
|
||||
NodeExternalDNS NodeAddressType = "ExternalDNS"
|
||||
NodeInternalDNS NodeAddressType = "InternalDNS"
|
||||
)
|
||||
|
||||
// NodeAddress contains information for the node's address.
|
||||
|
|
|
@ -6244,7 +6244,7 @@ func TestValidateNode(t *testing.T) {
|
|||
},
|
||||
Status: api.NodeStatus{
|
||||
Addresses: []api.NodeAddress{
|
||||
{Type: api.NodeLegacyHostIP, Address: "something"},
|
||||
{Type: api.NodeExternalIP, Address: "something"},
|
||||
},
|
||||
Capacity: api.ResourceList{
|
||||
api.ResourceName(api.ResourceCPU): resource.MustParse("10"),
|
||||
|
@ -6262,7 +6262,7 @@ func TestValidateNode(t *testing.T) {
|
|||
},
|
||||
Status: api.NodeStatus{
|
||||
Addresses: []api.NodeAddress{
|
||||
{Type: api.NodeLegacyHostIP, Address: "something"},
|
||||
{Type: api.NodeExternalIP, Address: "something"},
|
||||
},
|
||||
Capacity: api.ResourceList{
|
||||
api.ResourceName(api.ResourceCPU): resource.MustParse("10"),
|
||||
|
@ -6279,7 +6279,7 @@ func TestValidateNode(t *testing.T) {
|
|||
},
|
||||
Status: api.NodeStatus{
|
||||
Addresses: []api.NodeAddress{
|
||||
{Type: api.NodeLegacyHostIP, Address: "something"},
|
||||
{Type: api.NodeExternalIP, Address: "something"},
|
||||
},
|
||||
Capacity: api.ResourceList{
|
||||
api.ResourceName(api.ResourceCPU): resource.MustParse("10"),
|
||||
|
@ -6318,7 +6318,7 @@ func TestValidateNode(t *testing.T) {
|
|||
},
|
||||
Status: api.NodeStatus{
|
||||
Addresses: []api.NodeAddress{
|
||||
{Type: api.NodeLegacyHostIP, Address: "something"},
|
||||
{Type: api.NodeExternalIP, Address: "something"},
|
||||
},
|
||||
Capacity: api.ResourceList{
|
||||
api.ResourceName(api.ResourceCPU): resource.MustParse("10"),
|
||||
|
@ -6406,7 +6406,7 @@ func TestValidateNode(t *testing.T) {
|
|||
},
|
||||
Status: api.NodeStatus{
|
||||
Addresses: []api.NodeAddress{
|
||||
{Type: api.NodeLegacyHostIP, Address: "something"},
|
||||
{Type: api.NodeExternalIP, Address: "something"},
|
||||
},
|
||||
Capacity: api.ResourceList{
|
||||
api.ResourceName(api.ResourceCPU): resource.MustParse("10"),
|
||||
|
@ -6425,7 +6425,7 @@ func TestValidateNode(t *testing.T) {
|
|||
},
|
||||
Status: api.NodeStatus{
|
||||
Addresses: []api.NodeAddress{
|
||||
{Type: api.NodeLegacyHostIP, Address: "something"},
|
||||
{Type: api.NodeExternalIP, Address: "something"},
|
||||
},
|
||||
Capacity: api.ResourceList{
|
||||
api.ResourceName(api.ResourceCPU): resource.MustParse("10"),
|
||||
|
@ -6444,7 +6444,7 @@ func TestValidateNode(t *testing.T) {
|
|||
},
|
||||
Status: api.NodeStatus{
|
||||
Addresses: []api.NodeAddress{
|
||||
{Type: api.NodeLegacyHostIP, Address: "something"},
|
||||
{Type: api.NodeExternalIP, Address: "something"},
|
||||
},
|
||||
Capacity: api.ResourceList{
|
||||
api.ResourceName(api.ResourceCPU): resource.MustParse("10"),
|
||||
|
@ -6687,7 +6687,7 @@ func TestValidateNodeUpdate(t *testing.T) {
|
|||
},
|
||||
Status: api.NodeStatus{
|
||||
Addresses: []api.NodeAddress{
|
||||
{Type: api.NodeLegacyHostIP, Address: "1.2.3.4"},
|
||||
{Type: api.NodeExternalIP, Address: "1.2.3.4"},
|
||||
},
|
||||
},
|
||||
}, api.Node{
|
||||
|
|
|
@ -909,8 +909,6 @@ func (c *Cloud) NodeAddresses(name types.NodeName) ([]v1.NodeAddress, error) {
|
|||
return nil, err
|
||||
}
|
||||
addresses = append(addresses, v1.NodeAddress{Type: v1.NodeInternalIP, Address: internalIP})
|
||||
// Legacy compatibility: the private ip was the legacy host ip
|
||||
addresses = append(addresses, v1.NodeAddress{Type: v1.NodeLegacyHostIP, Address: internalIP})
|
||||
|
||||
externalIP, err := c.metadata.GetMetadata("public-ipv4")
|
||||
if err != nil {
|
||||
|
@ -955,9 +953,6 @@ func (c *Cloud) NodeAddresses(name types.NodeName) ([]v1.NodeAddress, error) {
|
|||
return nil, fmt.Errorf("EC2 instance had invalid private address: %s (%s)", orEmpty(instance.InstanceId), ipAddress)
|
||||
}
|
||||
addresses = append(addresses, v1.NodeAddress{Type: v1.NodeInternalIP, Address: ip.String()})
|
||||
|
||||
// Legacy compatibility: the private ip was the legacy host ip
|
||||
addresses = append(addresses, v1.NodeAddress{Type: v1.NodeLegacyHostIP, Address: ip.String()})
|
||||
}
|
||||
|
||||
// TODO: Other IP addresses (multiple ips)?
|
||||
|
|
|
@ -599,11 +599,10 @@ func TestNodeAddresses(t *testing.T) {
|
|||
if err3 != nil {
|
||||
t.Errorf("Should not error when instance found")
|
||||
}
|
||||
if len(addrs3) != 5 {
|
||||
t.Errorf("Should return exactly 5 NodeAddresses")
|
||||
if len(addrs3) != 4 {
|
||||
t.Errorf("Should return exactly 4 NodeAddresses")
|
||||
}
|
||||
testHasNodeAddress(t, addrs3, v1.NodeInternalIP, "192.168.0.1")
|
||||
testHasNodeAddress(t, addrs3, v1.NodeLegacyHostIP, "192.168.0.1")
|
||||
testHasNodeAddress(t, addrs3, v1.NodeExternalIP, "1.2.3.4")
|
||||
testHasNodeAddress(t, addrs3, v1.NodeExternalDNS, "instance-same.ec2.external")
|
||||
testHasNodeAddress(t, addrs3, v1.NodeInternalDNS, "instance-same.ec2.internal")
|
||||
|
|
|
@ -298,7 +298,6 @@ func (c *MesosCloud) NodeAddresses(nodeName types.NodeName) ([]v1.NodeAddress, e
|
|||
return nil, err
|
||||
}
|
||||
return []v1.NodeAddress{
|
||||
{Type: v1.NodeLegacyHostIP, Address: ip.String()},
|
||||
{Type: v1.NodeInternalIP, Address: ip.String()},
|
||||
{Type: v1.NodeExternalIP, Address: ip.String()},
|
||||
}, nil
|
||||
|
|
|
@ -174,7 +174,6 @@ func (v *OVirtCloud) NodeAddresses(nodeName types.NodeName) ([]v1.NodeAddress, e
|
|||
}
|
||||
|
||||
return []v1.NodeAddress{
|
||||
{Type: v1.NodeLegacyHostIP, Address: address.String()},
|
||||
{Type: v1.NodeInternalIP, Address: address.String()},
|
||||
{Type: v1.NodeExternalIP, Address: address.String()},
|
||||
}, nil
|
||||
|
|
|
@ -381,7 +381,6 @@ func (i *Instances) NodeAddresses(nodeName types.NodeName) ([]v1.NodeAddress, er
|
|||
// net.ParseIP().String() is to maintain compatibility with the old code
|
||||
parsedIP := net.ParseIP(ip).String()
|
||||
return []v1.NodeAddress{
|
||||
{Type: v1.NodeLegacyHostIP, Address: parsedIP},
|
||||
{Type: v1.NodeInternalIP, Address: parsedIP},
|
||||
{Type: v1.NodeExternalIP, Address: parsedIP},
|
||||
}, nil
|
||||
|
|
|
@ -465,7 +465,6 @@ func (kl *Kubelet) setNodeAddress(node *v1.Node) error {
|
|||
return fmt.Errorf("can't get ip address of node %s. error: %v", node.Name, err)
|
||||
} else {
|
||||
node.Status.Addresses = []v1.NodeAddress{
|
||||
{Type: v1.NodeLegacyHostIP, Address: ipAddr.String()},
|
||||
{Type: v1.NodeInternalIP, Address: ipAddr.String()},
|
||||
{Type: v1.NodeHostName, Address: kl.GetHostname()},
|
||||
}
|
||||
|
|
|
@ -218,7 +218,6 @@ func TestUpdateNewNodeStatus(t *testing.T) {
|
|||
v1.ResourcePods: *resource.NewQuantity(0, resource.DecimalSI),
|
||||
},
|
||||
Addresses: []v1.NodeAddress{
|
||||
{Type: v1.NodeLegacyHostIP, Address: "127.0.0.1"},
|
||||
{Type: v1.NodeInternalIP, Address: "127.0.0.1"},
|
||||
{Type: v1.NodeHostName, Address: testKubeletHostname},
|
||||
},
|
||||
|
@ -455,7 +454,6 @@ func TestUpdateExistingNodeStatus(t *testing.T) {
|
|||
v1.ResourcePods: *resource.NewQuantity(0, resource.DecimalSI),
|
||||
},
|
||||
Addresses: []v1.NodeAddress{
|
||||
{Type: v1.NodeLegacyHostIP, Address: "127.0.0.1"},
|
||||
{Type: v1.NodeInternalIP, Address: "127.0.0.1"},
|
||||
{Type: v1.NodeHostName, Address: testKubeletHostname},
|
||||
},
|
||||
|
@ -739,7 +737,6 @@ func TestUpdateNodeStatusWithRuntimeStateError(t *testing.T) {
|
|||
v1.ResourcePods: *resource.NewQuantity(0, resource.DecimalSI),
|
||||
},
|
||||
Addresses: []v1.NodeAddress{
|
||||
{Type: v1.NodeLegacyHostIP, Address: "127.0.0.1"},
|
||||
{Type: v1.NodeInternalIP, Address: "127.0.0.1"},
|
||||
{Type: v1.NodeHostName, Address: testKubeletHostname},
|
||||
},
|
||||
|
|
|
@ -349,7 +349,6 @@ type nodeAddressProvider struct {
|
|||
func (n nodeAddressProvider) externalAddresses() ([]string, error) {
|
||||
preferredAddressTypes := []apiv1.NodeAddressType{
|
||||
apiv1.NodeExternalIP,
|
||||
apiv1.NodeLegacyHostIP,
|
||||
}
|
||||
nodes, err := n.nodeClient.List(metav1.ListOptions{})
|
||||
if err != nil {
|
||||
|
|
|
@ -205,16 +205,6 @@ func TestGetNodeAddresses(t *testing.T) {
|
|||
addrs, err = addressProvider.externalAddresses()
|
||||
assert.NoError(err, "addresses should not have returned an error.")
|
||||
assert.Equal([]string{"127.0.0.1", "127.0.0.1"}, addrs)
|
||||
|
||||
// Pass case with LegacyHost type IP
|
||||
nodes, _ = fakeNodeClient.List(metav1.ListOptions{})
|
||||
for index := range nodes.Items {
|
||||
nodes.Items[index].Status.Addresses = []apiv1.NodeAddress{{Type: apiv1.NodeLegacyHostIP, Address: "127.0.0.2"}}
|
||||
fakeNodeClient.Update(&nodes.Items[index])
|
||||
}
|
||||
addrs, err = addressProvider.externalAddresses()
|
||||
assert.NoError(err, "addresses failback should not have returned an error.")
|
||||
assert.Equal([]string{"127.0.0.2", "127.0.0.2"}, addrs)
|
||||
}
|
||||
|
||||
func decodeResponse(resp *http.Response, obj interface{}) error {
|
||||
|
|
|
@ -852,7 +852,6 @@ func TestPrintNodeExternalIP(t *testing.T) {
|
|||
node: api.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "foo3"},
|
||||
Status: api.NodeStatus{Addresses: []api.NodeAddress{
|
||||
{Type: api.NodeLegacyHostIP, Address: "1.1.1.1"},
|
||||
{Type: api.NodeExternalIP, Address: "2.2.2.2"},
|
||||
{Type: api.NodeInternalIP, Address: "3.3.3.3"},
|
||||
{Type: api.NodeExternalIP, Address: "4.4.4.4"},
|
||||
|
|
|
@ -75,7 +75,6 @@ func GetPreferredNodeAddress(node *v1.Node, preferredAddressTypes []v1.NodeAddre
|
|||
// GetNodeHostIP returns the provided node's IP, based on the priority:
|
||||
// 1. NodeInternalIP
|
||||
// 2. NodeExternalIP
|
||||
// 3. NodeLegacyHostIP
|
||||
func GetNodeHostIP(node *v1.Node) (net.IP, error) {
|
||||
addresses := node.Status.Addresses
|
||||
addressMap := make(map[v1.NodeAddressType][]v1.NodeAddress)
|
||||
|
@ -88,16 +87,12 @@ func GetNodeHostIP(node *v1.Node) (net.IP, error) {
|
|||
if addresses, ok := addressMap[v1.NodeExternalIP]; ok {
|
||||
return net.ParseIP(addresses[0].Address), nil
|
||||
}
|
||||
if addresses, ok := addressMap[v1.NodeLegacyHostIP]; ok {
|
||||
return net.ParseIP(addresses[0].Address), nil
|
||||
}
|
||||
return nil, fmt.Errorf("host IP unknown; known addresses: %v", addresses)
|
||||
}
|
||||
|
||||
// InternalGetNodeHostIP returns the provided node's IP, based on the priority:
|
||||
// 1. NodeInternalIP
|
||||
// 2. NodeExternalIP
|
||||
// 3. NodeLegacyHostIP
|
||||
func InternalGetNodeHostIP(node *api.Node) (net.IP, error) {
|
||||
addresses := node.Status.Addresses
|
||||
addressMap := make(map[api.NodeAddressType][]api.NodeAddress)
|
||||
|
@ -110,9 +105,6 @@ func InternalGetNodeHostIP(node *api.Node) (net.IP, error) {
|
|||
if addresses, ok := addressMap[api.NodeExternalIP]; ok {
|
||||
return net.ParseIP(addresses[0].Address), nil
|
||||
}
|
||||
if addresses, ok := addressMap[api.NodeLegacyHostIP]; ok {
|
||||
return net.ParseIP(addresses[0].Address), nil
|
||||
}
|
||||
return nil, fmt.Errorf("host IP unknown; known addresses: %v", addresses)
|
||||
}
|
||||
|
||||
|
|
|
@ -2904,16 +2904,12 @@ type NodeCondition struct {
|
|||
|
||||
type NodeAddressType string
|
||||
|
||||
// These are valid address types of node. NodeLegacyHostIP is used to transit
|
||||
// from out-dated HostIP field to NodeAddress.
|
||||
const (
|
||||
// Deprecated: NodeLegacyHostIP will be removed in 1.7.
|
||||
NodeLegacyHostIP NodeAddressType = "LegacyHostIP"
|
||||
NodeHostName NodeAddressType = "Hostname"
|
||||
NodeExternalIP NodeAddressType = "ExternalIP"
|
||||
NodeInternalIP NodeAddressType = "InternalIP"
|
||||
NodeExternalDNS NodeAddressType = "ExternalDNS"
|
||||
NodeInternalDNS NodeAddressType = "InternalDNS"
|
||||
NodeHostName NodeAddressType = "Hostname"
|
||||
NodeExternalIP NodeAddressType = "ExternalIP"
|
||||
NodeInternalIP NodeAddressType = "InternalIP"
|
||||
NodeExternalDNS NodeAddressType = "ExternalDNS"
|
||||
NodeInternalDNS NodeAddressType = "InternalDNS"
|
||||
)
|
||||
|
||||
type NodeAddress struct {
|
||||
|
|
|
@ -3345,13 +3345,11 @@ type NodeAddressType string
|
|||
|
||||
// These are valid address type of node.
|
||||
const (
|
||||
// Deprecated: NodeLegacyHostIP will be removed in 1.7.
|
||||
NodeLegacyHostIP NodeAddressType = "LegacyHostIP"
|
||||
NodeHostName NodeAddressType = "Hostname"
|
||||
NodeExternalIP NodeAddressType = "ExternalIP"
|
||||
NodeInternalIP NodeAddressType = "InternalIP"
|
||||
NodeExternalDNS NodeAddressType = "ExternalDNS"
|
||||
NodeInternalDNS NodeAddressType = "InternalDNS"
|
||||
NodeHostName NodeAddressType = "Hostname"
|
||||
NodeExternalIP NodeAddressType = "ExternalIP"
|
||||
NodeInternalIP NodeAddressType = "InternalIP"
|
||||
NodeExternalDNS NodeAddressType = "ExternalDNS"
|
||||
NodeInternalDNS NodeAddressType = "InternalDNS"
|
||||
)
|
||||
|
||||
// NodeAddress contains information for the node's address.
|
||||
|
|
|
@ -476,10 +476,7 @@ func (config *NetworkingTestConfig) setup(selector map[string]string) {
|
|||
ExpectNoError(WaitForAllNodesSchedulable(config.f.ClientSet, 10*time.Minute))
|
||||
nodeList := GetReadySchedulableNodesOrDie(config.f.ClientSet)
|
||||
config.ExternalAddrs = NodeAddresses(nodeList, v1.NodeExternalIP)
|
||||
if len(config.ExternalAddrs) < 2 {
|
||||
// fall back to legacy IPs
|
||||
config.ExternalAddrs = NodeAddresses(nodeList, v1.NodeLegacyHostIP)
|
||||
}
|
||||
|
||||
SkipUnlessNodeCountIsAtLeast(2)
|
||||
config.Nodes = nodeList.Items
|
||||
|
||||
|
|
|
@ -258,9 +258,6 @@ func GetNodePublicIps(c clientset.Interface) ([]string, error) {
|
|||
nodes := GetReadySchedulableNodesOrDie(c)
|
||||
|
||||
ips := CollectAddresses(nodes, v1.NodeExternalIP)
|
||||
if len(ips) == 0 {
|
||||
ips = CollectAddresses(nodes, v1.NodeLegacyHostIP)
|
||||
}
|
||||
return ips, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -1353,9 +1353,6 @@ var _ = framework.KubeDescribe("ESIPP [Slow]", func() {
|
|||
}
|
||||
|
||||
ips := framework.CollectAddresses(nodes, v1.NodeExternalIP)
|
||||
if len(ips) == 0 {
|
||||
ips = framework.CollectAddresses(nodes, v1.NodeLegacyHostIP)
|
||||
}
|
||||
|
||||
ingressIP := framework.GetIngressPoint(&svc.Status.LoadBalancer.Ingress[0])
|
||||
svcTCPPort := int(svc.Spec.Ports[0].Port)
|
||||
|
|
Loading…
Reference in New Issue