diff --git a/pkg/cloudscale_ccm/reconcile.go b/pkg/cloudscale_ccm/reconcile.go index 501cdee..54ec025 100644 --- a/pkg/cloudscale_ccm/reconcile.go +++ b/pkg/cloudscale_ccm/reconcile.go @@ -464,7 +464,7 @@ func nextLbActions( // If the name of the lb is wrong, change it if desired.lb.Name != actual.lb.Name { - next = append(next, actions.RenameLb(actual.lb.UUID, actual.lb.Name)) + next = append(next, actions.RenameLb(actual.lb.UUID, desired.lb.Name)) } // All other changes are applied aggressively, as the customer would have diff --git a/pkg/cloudscale_ccm/reconcile_test.go b/pkg/cloudscale_ccm/reconcile_test.go index b8bd6f2..9d17569 100644 --- a/pkg/cloudscale_ccm/reconcile_test.go +++ b/pkg/cloudscale_ccm/reconcile_test.go @@ -397,16 +397,16 @@ func TestNextLbActions(t *testing.T) { // Rename lb if name changed. This is safe because the lbs have either // been acquired by name (in which case both will have the same name), // or by UUID through the service annotation. - one := &cloudscale.LoadBalancer{ + want := &cloudscale.LoadBalancer{ Name: "foo", } - two := &cloudscale.LoadBalancer{ + have := &cloudscale.LoadBalancer{ UUID: "2", Name: "bar", } - assertActions(&lbState{lb: one}, &lbState{lb: two}, []actions.Action{ - actions.AwaitLb(two), - actions.RenameLb("2", "bar"), + assertActions(&lbState{lb: want}, &lbState{lb: have}, []actions.Action{ + actions.AwaitLb(have), + actions.RenameLb("2", "foo"), }) }