Skip to content

Commit

Permalink
Merge pull request #3175 from detiber/backport-3057-v1.18
Browse files Browse the repository at this point in the history
[CA-1.18] #3057 cherry-pick: CAPI: Do not normalize Node IDs outside of CAPI provider
k8s-ci-robot authored Jun 4, 2020
2 parents f7aa0e9 + 9738adb commit adb7b42
Showing 3 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -965,7 +965,7 @@ func TestControllerMachineSetNodeNamesUsingProviderID(t *testing.T) {
})

for i := range testConfig.nodes {
if nodeNames[i].Id != string(normalizedProviderString(testConfig.nodes[i].Spec.ProviderID)) {
if nodeNames[i].Id != testConfig.nodes[i].Spec.ProviderID {
t.Fatalf("expected %q, got %q", testConfig.nodes[i].Spec.ProviderID, nodeNames[i].Id)
}
}
@@ -1013,7 +1013,7 @@ func TestControllerMachineSetNodeNamesUsingStatusNodeRefName(t *testing.T) {
})

for i := range testConfig.nodes {
if nodeNames[i].Id != string(normalizedProviderString(testConfig.nodes[i].Spec.ProviderID)) {
if nodeNames[i].Id != testConfig.nodes[i].Spec.ProviderID {
t.Fatalf("expected %q, got %q", testConfig.nodes[i].Spec.ProviderID, nodeNames[i].Id)
}
}
Original file line number Diff line number Diff line change
@@ -195,10 +195,14 @@ func (ng *nodegroup) Nodes() ([]cloudprovider.Instance, error) {
return nil, err
}

// Nodes do not have normalized IDs, so do not normalize the ID here.
// The IDs returned here are used to check if a node is registered or not and
// must match the ID on the Node object itself.
// https://github.com/kubernetes/autoscaler/blob/a973259f1852303ba38a3a61eeee8489cf4e1b13/cluster-autoscaler/clusterstate/clusterstate.go#L967-L985
instances := make([]cloudprovider.Instance, len(nodes))
for i := range nodes {
instances[i] = cloudprovider.Instance{
Id: string(normalizedProviderString(nodes[i])),
Id: nodes[i],
}
}

Original file line number Diff line number Diff line change
@@ -659,7 +659,7 @@ func TestNodeGroupDeleteNodes(t *testing.T) {
})

for i := 0; i < len(nodeNames); i++ {
if nodeNames[i].Id != string(normalizedProviderString(testConfig.nodes[i].Spec.ProviderID)) {
if nodeNames[i].Id != testConfig.nodes[i].Spec.ProviderID {
t.Fatalf("expected %q, got %q", testConfig.nodes[i].Spec.ProviderID, nodeNames[i].Id)
}
}
@@ -844,7 +844,7 @@ func TestNodeGroupDeleteNodesTwice(t *testing.T) {
})

for i := 0; i < len(nodeNames); i++ {
if nodeNames[i].Id != string(normalizedProviderString(testConfig.nodes[i].Spec.ProviderID)) {
if nodeNames[i].Id != testConfig.nodes[i].Spec.ProviderID {
t.Fatalf("expected %q, got %q", testConfig.nodes[i].Spec.ProviderID, nodeNames[i].Id)
}
}
@@ -998,7 +998,7 @@ func TestNodeGroupWithFailedMachine(t *testing.T) {
nodeIndex = i
}

if nodeNames[i].Id != string(normalizedProviderString(testConfig.nodes[nodeIndex].Spec.ProviderID)) {
if nodeNames[i].Id != testConfig.nodes[nodeIndex].Spec.ProviderID {
t.Fatalf("expected %q, got %q", testConfig.nodes[nodeIndex].Spec.ProviderID, nodeNames[i].Id)
}
}

0 comments on commit adb7b42

Please sign in to comment.