From 295971e94c20d8ff4b328da5b9852a93bd0fbb76 Mon Sep 17 00:00:00 2001 From: Stefan Majer Date: Thu, 10 Apr 2025 15:13:25 +0200 Subject: [PATCH] Prepare annotation migration --- pkg/controllers/loadbalancer/loadbalancer.go | 1 + pkg/resources/constants/constants.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/controllers/loadbalancer/loadbalancer.go b/pkg/controllers/loadbalancer/loadbalancer.go index c0d3bf2..8236606 100644 --- a/pkg/controllers/loadbalancer/loadbalancer.go +++ b/pkg/controllers/loadbalancer/loadbalancer.go @@ -336,6 +336,7 @@ func (l *LoadBalancerController) useIPInCluster(ctx context.Context, ip models.V func (l *LoadBalancerController) acquireIP(ctx context.Context, service *v1.Service) (string, error) { annotations := service.GetAnnotations() addressPool, ok := annotations[constants.MetalLBSpecificAddressPool] + deprecatedAddressPool, deprecatedok := annotations[constants.DeprecatedMetalLBSpecificAddressPool] if !ok { if l.defaultExternalNetworkID == "" { return "", fmt.Errorf(`no default network for ip acquisition specified, acquire an ip for your cluster's project and specify it directly in "spec.loadBalancerIP"`) diff --git a/pkg/resources/constants/constants.go b/pkg/resources/constants/constants.go index 5d04e10..9e00bd5 100644 --- a/pkg/resources/constants/constants.go +++ b/pkg/resources/constants/constants.go @@ -18,7 +18,8 @@ const ( ProviderName = "metal" // FIXME this annotation is deprecated metallb.io should be used instead - MetalLBSpecificAddressPool = "metallb.universe.tf/address-pool" + DeprecatedMetalLBSpecificAddressPool = "metallb.universe.tf/address-pool" + MetalLBSpecificAddressPool = "metallb.io/address-pool" IPPrefix = "metallb-"