mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-06 07:57:35 +00:00
Add v1.NodeLegacyHostIP to be consistent with the internal API;
Mark NodeLegacyHostIP will be deprecated in 1.7; Let cloudprovider that used to only set NodeLegacyHostIP set the IP as both InternalIP and ExternalIP, to allow dprecation in 1.7
This commit is contained in:
@@ -167,29 +167,6 @@ func TestVersion(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestFindExternalAddress verifies both pass and fail cases for the unexported
|
||||
// findExternalAddress function
|
||||
func TestFindExternalAddress(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
expectedIP := "172.0.0.1"
|
||||
|
||||
nodes := []*api.Node{new(api.Node), new(api.Node), new(api.Node)}
|
||||
nodes[0].Status.Addresses = []api.NodeAddress{{Type: "ExternalIP", Address: expectedIP}}
|
||||
nodes[1].Status.Addresses = []api.NodeAddress{{Type: "LegacyHostIP", Address: expectedIP}}
|
||||
nodes[2].Status.Addresses = []api.NodeAddress{{Type: "ExternalIP", Address: expectedIP}, {Type: "LegacyHostIP", Address: "172.0.0.2"}}
|
||||
|
||||
// Pass Case
|
||||
for _, node := range nodes {
|
||||
ip, err := findExternalAddress(node)
|
||||
assert.NoError(err, "error getting node external address")
|
||||
assert.Equal(expectedIP, ip, "expected ip to be %s, but was %s", expectedIP, ip)
|
||||
}
|
||||
|
||||
// Fail case
|
||||
_, err := findExternalAddress(new(api.Node))
|
||||
assert.Error(err, "expected findExternalAddress to fail on a node with missing ip information")
|
||||
}
|
||||
|
||||
type fakeEndpointReconciler struct{}
|
||||
|
||||
func (*fakeEndpointReconciler) ReconcileEndpoints(serviceName string, ip net.IP, endpointPorts []api.EndpointPort, reconcilePorts bool) error {
|
||||
|
||||
Reference in New Issue
Block a user