From 754a379d42fd56aef8b04f98dddc9d4c9663477d Mon Sep 17 00:00:00 2001 From: Leo Date: Thu, 3 Oct 2024 21:53:19 +0200 Subject: [PATCH 1/2] feat(k3s): Add option to set MetalLB interfaces --- roles/k3s_server_post/defaults/main.yml | 1 + roles/k3s_server_post/templates/metallb.crs.j2 | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/roles/k3s_server_post/defaults/main.yml b/roles/k3s_server_post/defaults/main.yml index 578e55711..ec4d74d36 100644 --- a/roles/k3s_server_post/defaults/main.yml +++ b/roles/k3s_server_post/defaults/main.yml @@ -30,3 +30,4 @@ metal_lb_mode: layer2 metal_lb_available_timeout: 240s metal_lb_controller_tag_version: v0.14.3 metal_lb_ip_range: 192.168.30.80-192.168.30.90 +metal_lb_interfaces: diff --git a/roles/k3s_server_post/templates/metallb.crs.j2 b/roles/k3s_server_post/templates/metallb.crs.j2 index 562f561fa..0cf917a06 100644 --- a/roles/k3s_server_post/templates/metallb.crs.j2 +++ b/roles/k3s_server_post/templates/metallb.crs.j2 @@ -21,6 +21,13 @@ kind: L2Advertisement metadata: name: default namespace: metallb-system +{% if metal_lb_interfaces %} +spec: + interfaces: + {% for interface in metal_lb_interfaces %} + - {{ interface }} + {% endfor %} +{% endif %} {% endif %} {% if metal_lb_mode == "bgp" %} --- From ed82eb71dda042a4764e0bc4aad2bed41e2c24fd Mon Sep 17 00:00:00 2001 From: Leo Date: Sun, 24 Nov 2024 09:56:01 +0100 Subject: [PATCH 2/2] feat(k3s): Add documentation for MetalLB interfaces value --- roles/k3s_server_post/meta/main.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/roles/k3s_server_post/meta/main.yml b/roles/k3s_server_post/meta/main.yml index f9fc83d5f..b48130eed 100644 --- a/roles/k3s_server_post/meta/main.yml +++ b/roles/k3s_server_post/meta/main.yml @@ -129,6 +129,10 @@ argument_specs: description: MetalLB ip range for load balancer default: 192.168.30.80-192.168.30.90 + metal_lb_interfaces: + description: MetalLB interfaces to announce on. By default, announces on all interfaces. + default: + metal_lb_controller_tag_version: description: Image tag for MetalLB default: v0.14.3