From e03254008466270120a5789e30c128857a172455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Krienb=C3=BChl?= Date: Fri, 12 Sep 2025 16:54:37 +0200 Subject: [PATCH] Fix LB name changes not being applied They were simply always kept as-is before. --- pkg/cloudscale_ccm/reconcile.go | 2 +- pkg/cloudscale_ccm/reconcile_test.go | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) 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"), }) }