-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
k3s_server_post: add backport-gh599.patch
Can be removed again after merge of techno-tim/k3s-ansible#599 Signed-off-by: Christian Berendt <[email protected]>
- Loading branch information
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |