Skip to content

Commit

Permalink
disable frr by default and configure metallb images
Browse files Browse the repository at this point in the history
  • Loading branch information
neoaggelos committed Jun 25, 2024
1 parent 2251f54 commit 1688aa9
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src/k8s/pkg/k8sd/features/metallb/chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
25 changes: 24 additions & 1 deletion src/k8s/pkg/k8sd/features/metallb/loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
15 changes: 15 additions & 0 deletions src/k8s/pkg/k8sd/features/metallb/register.go
Original file line number Diff line number Diff line change
@@ -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),
)
}

0 comments on commit 1688aa9

Please sign in to comment.