Skip to content

Commit

Permalink
k3s_server_post: add backport-gh599.patch
Browse files Browse the repository at this point in the history
Can be removed again after merge of techno-tim/k3s-ansible#599

Signed-off-by: Christian Berendt <[email protected]>
  • Loading branch information
berendt committed Oct 24, 2024
1 parent e0841c6 commit f4dde0c
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions patches/k3s_server/backport-gh599.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -16,6 +16,9 @@ kube_vip_bgp_as: "64513"
kube_vip_bgp_peeraddress: 192.168.30.1
kube_vip_bgp_peeras: "64512"

+kube_vip_bgp_peers: []
+kube_vip_bgp_peers_groups: ['k3s_master']
+
metal_lb_controller_tag_version: v0.14.3
metal_lb_speaker_tag_version: v0.14.3
metal_lb_type: native
--- a/meta/main.yml
+++ b/meta/main.yml
@@ -62,6 +62,14 @@ argument_specs:
description: Defines the AS for the kube-vip BGP peer
default: "64512"

+ kube_vip_bgp_peers:
+ description: List of BGP peer ASN & address pairs
+ default: []
+
+ kube_vip_bgp_peers_groups:
+ description: Inventory group in which to search for additional kube_vip_bgp_peers parameters to merge.
+ default: ['k3s_master']
+
kube_vip_iface:
description:
- Explicitly define an interface that ALL control nodes
--- a/tasks/vip.yml
+++ b/tasks/vip.yml
@@ -1,4 +1,8 @@
---
+- name: Set _kube_vip_bgp_peers fact
+ ansible.builtin.set_fact:
+ _kube_vip_bgp_peers: "{{ lookup('community.general.merge_variables', '^kube_vip_bgp_peers__.+$', initial_value=kube_vip_bgp_peers, groups=kube_vip_bgp_peers_groups) }}" # yamllint disable-line rule:line-length
+
- name: Create manifests directory on first master
ansible.builtin.file:
path: /var/lib/rancher/k3s/server/manifests
--- a/templates/vip.yaml.j2
+++ b/templates/vip.yaml.j2
@@ -61,6 +61,10 @@ spec:
- name: bgp_routerid
value: "{{ kube_vip_bgp_routerid }}"
{% endif %}
+{% if _kube_vip_bgp_peers | length > 0 %}
+ - name: bgppeers
+ value: "{{ _kube_vip_bgp_peers | map(attribute='peer_address') | zip(_kube_vip_bgp_peers| map(attribute='peer_asn')) | map('join', ',') | join(':') }}" # yamllint disable-line rule:line-length
+{% else %}
{% if kube_vip_bgp_as is defined %}
- name: bgp_as
value: "{{ kube_vip_bgp_as }}"
@@ -73,6 +77,7 @@ spec:
- name: bgp_peeras
value: "{{ kube_vip_bgp_peeras }}"
{% endif %}
+{% endif %}
{% endif %}
image: ghcr.io/kube-vip/kube-vip:{{ kube_vip_tag_version }}
imagePullPolicy: Always

0 comments on commit f4dde0c

Please sign in to comment.