Skip to content

Commit

Permalink
implement bgp
Browse files Browse the repository at this point in the history
  • Loading branch information
eaudetcobello committed Jun 6, 2024
1 parent 03e3af2 commit ce8fac0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,17 @@ spec:
peerPort: {{ .peerPort }}
{{- end }}

---

apiVersion: "metallb.io/v1beta1"
kind: BGPAdvertisement
metadata:
name: {{ include "ck-loadbalancer.fullname" $ }}
labels:
{{- include "ck-loadbalancer.labels" $ | nindent 4 }}
spec:
ipAddressPools:
- {{ include "ck-loadbalancer.fullname" . }}

{{- end }}
{{- end}}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.l2.enabled }}
{{- if (gt (len .Values.ipPool.cidrs) 0) }}
{{- if (eq .Values.driver "metallb") }}

apiVersion: "metallb.io/v1beta1"
Expand Down
11 changes: 6 additions & 5 deletions src/k8s/pkg/k8sd/features/metallb/loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func enableLoadBalancer(ctx context.Context, snap snap.Snap, loadbalancer types.
}

if err := waitForRequiredLoadBalancerCRDs(ctx, snap, loadbalancer.GetBGPMode()); err != nil {
return fmt.Errorf("failed to wait for required LoadBalancer CRDs: %w", err)
return fmt.Errorf("failed to wait for required MetalLB CRDs: %w", err)
}

cidrs := []string{}
Expand Down Expand Up @@ -101,10 +101,11 @@ func waitForRequiredLoadBalancerCRDs(ctx context.Context, snap snap.Snap, bgpMod
"ipaddresspools": {},
"l2advertisements": {},
}
// TODO
// if bgpMode {
// requiredCRDs["ciliumbgppeeringpolicies"] = struct{}{}
// }
if bgpMode {
requiredCRDs["bgppeers"] = struct{}{}
requiredCRDs["bgpadvertisements"] = struct{}{}
}

requiredCount := len(requiredCRDs)
for _, resource := range resources.APIResources {
if _, ok := requiredCRDs[resource.Name]; ok {
Expand Down

0 comments on commit ce8fac0

Please sign in to comment.