diff --git a/src/k8s/pkg/k8sd/features/metallb/chart.go b/src/k8s/pkg/k8sd/features/metallb/chart.go index 8e166b4ba2..6be8021839 100644 --- a/src/k8s/pkg/k8sd/features/metallb/chart.go +++ b/src/k8s/pkg/k8sd/features/metallb/chart.go @@ -20,4 +20,22 @@ var ( Namespace: "metallb-system", ManifestPath: path.Join("charts", "ck-loadbalancer"), } + + // controllerImageRepo is the image to use for metallb-controller. + controllerImageRepo = "quay.io/metallb/controller" + + // controllerImageTag is the tag to use for metallb-controller. + controllerImageTag = "v0.14.5" + + // speakerImageRepo is the image to use for metallb-speaker. + speakerImageRepo = "quay.io/metallb/speaker" + + // speakerImageTag is the tag to use for metallb-speaker. + speakerImageTag = "v0.14.5" + + // frrImageRepo is the image to use for frrouting. + frrImageRepo = "quay.io/frrouting/frr" + + // frrImageTag is the tag to use for frrouting. + frrImageTag = "9.0.2" ) diff --git a/src/k8s/pkg/k8sd/features/metallb/loadbalancer.go b/src/k8s/pkg/k8sd/features/metallb/loadbalancer.go index f1543e71ac..e556a8984d 100644 --- a/src/k8s/pkg/k8sd/features/metallb/loadbalancer.go +++ b/src/k8s/pkg/k8sd/features/metallb/loadbalancer.go @@ -40,7 +40,30 @@ func disableLoadBalancer(ctx context.Context, snap snap.Snap, network types.Netw func enableLoadBalancer(ctx context.Context, snap snap.Snap, loadbalancer types.LoadBalancer, network types.Network) error { m := snap.HelmClient() - if _, err := m.Apply(ctx, chartMetalLB, helm.StatePresent, nil); err != nil { + metalLBValues := map[string]any{ + "controller": map[string]any{ + "image": map[string]any{ + "repository": controllerImageRepo, + "tag": controllerImageTag, + }, + }, + "speaker": map[string]any{ + "image": map[string]any{ + "repository": speakerImageRepo, + "tag": speakerImageTag, + }, + // TODO(neoaggelos): make frr enable/disable configurable through an annotation + // We keep it disabled by default + "frr": map[string]any{ + "enabled": false, + "image": map[string]any{ + "repository": frrImageRepo, + "tag": frrImageTag, + }, + }, + }, + } + if _, err := m.Apply(ctx, chartMetalLB, helm.StatePresent, metalLBValues); err != nil { return fmt.Errorf("failed to apply MetalLB configuration: %w", err) } diff --git a/src/k8s/pkg/k8sd/features/metallb/register.go b/src/k8s/pkg/k8sd/features/metallb/register.go new file mode 100644 index 0000000000..817f5408d4 --- /dev/null +++ b/src/k8s/pkg/k8sd/features/metallb/register.go @@ -0,0 +1,15 @@ +package metallb + +import ( + "fmt" + + "github.com/canonical/k8s/pkg/k8sd/images" +) + +func init() { + images.Register( + fmt.Sprintf("%s:%s", controllerImageRepo, controllerImageTag), + fmt.Sprintf("%s:%s", speakerImageRepo, speakerImageTag), + fmt.Sprintf("%s:%s", frrImageRepo, frrImageTag), + ) +}