Compare commits

...

3 Commits

Author SHA1 Message Date
Christian Berendt
4c0b1ee8f3 k3s_server: add kube_vip_bgp_peers parameter (#599)
With the kube_vip_bgp_peers it is possible to define
multiple BGP peer ASN & address pairs for kube-vip.

Sample:

```
kube_vip_bgp_peers:
  - peer_address: 192.168.128.10
    peer_asn: 64512
  - peer_address: 192.168.128.11
    peer_asn: 64512
  - peer_address: 192.168.128.12
    peer_asn: 64512
```

It is possible to merge further lists with kube_vip_bgp_peers__*
parameters.

Sample:

```
kube_vip_bgp_peers__extra:
  - peer_address: 192.168.128.10
    peer_asn: 64512
kube_vip_bgp_peers:
  - peer_address: 192.168.128.11
    peer_asn: 64512
  - peer_address: 192.168.128.12
    peer_asn: 64512
```

This will result in the following list of BGP peer ASN & address pairs:

```
- peer_address: 192.168.128.10
  peer_asn: 64512
- peer_address: 192.168.128.11
  peer_asn: 64512
- peer_address: 192.168.128.12
  peer_asn: 64512
```

Signed-off-by: Christian Berendt <berendt@osism.tech>
Co-authored-by: Techno Tim <timothystewart6@gmail.com>
2024-10-27 20:15:48 +00:00
Christian Berendt
11f9505460 k3s_server_post: always set _cilium_bgp_neighbors (#597)
Related to eddbcbfb76

Signed-off-by: Christian Berendt <berendt@osism.tech>
Co-authored-by: Techno Tim <timothystewart6@gmail.com>
2024-10-27 17:08:40 +00:00
dependabot[bot]
850301fbc4 chore(deps): bump actions/cache from 4.1.0 to 4.1.2 (#596)
Bumps [actions/cache](https://github.com/actions/cache) from 4.1.0 to 4.1.2.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](2cdf405574...6849a64899)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-27 10:28:50 -05:00
8 changed files with 23 additions and 4 deletions

View File

@@ -23,7 +23,7 @@ jobs:
- name: Cache Vagrant boxes - name: Cache Vagrant boxes
id: cache-vagrant id: cache-vagrant
uses: actions/cache@2cdf405574d6ef1f33a1d12acccd3ae82f47b3f2 # 4.1.0 uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # 4.1.2
with: with:
lookup-only: true #if it exists, we don't need to restore and can skip the next step lookup-only: true #if it exists, we don't need to restore and can skip the next step
path: | path: |

View File

@@ -22,7 +22,7 @@ jobs:
cache: 'pip' # caching pip dependencies cache: 'pip' # caching pip dependencies
- name: Restore Ansible cache - name: Restore Ansible cache
uses: actions/cache/restore@2cdf405574d6ef1f33a1d12acccd3ae82f47b3f2 # 4.1.0 uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a # 4.1.2
with: with:
path: ~/.ansible/collections path: ~/.ansible/collections
key: ansible-${{ hashFiles('collections/requirements.yml') }} key: ansible-${{ hashFiles('collections/requirements.yml') }}

View File

@@ -65,7 +65,7 @@ jobs:
cache: 'pip' # caching pip dependencies cache: 'pip' # caching pip dependencies
- name: Restore vagrant Boxes cache - name: Restore vagrant Boxes cache
uses: actions/cache/restore@2cdf405574d6ef1f33a1d12acccd3ae82f47b3f2 # 4.1.0 uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a # 4.1.2
with: with:
path: ~/.vagrant.d/boxes path: ~/.vagrant.d/boxes
key: vagrant-boxes-${{ hashFiles('**/molecule.yml') }} key: vagrant-boxes-${{ hashFiles('**/molecule.yml') }}

View File

@@ -16,6 +16,9 @@ kube_vip_bgp_as: "64513"
kube_vip_bgp_peeraddress: 192.168.30.1 kube_vip_bgp_peeraddress: 192.168.30.1
kube_vip_bgp_peeras: "64512" 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_controller_tag_version: v0.14.3
metal_lb_speaker_tag_version: v0.14.3 metal_lb_speaker_tag_version: v0.14.3
metal_lb_type: native metal_lb_type: native

View File

@@ -62,6 +62,14 @@ argument_specs:
description: Defines the AS for the kube-vip BGP peer description: Defines the AS for the kube-vip BGP peer
default: "64512" 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: kube_vip_iface:
description: description:
- Explicitly define an interface that ALL control nodes - Explicitly define an interface that ALL control nodes

View File

@@ -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 - name: Create manifests directory on first master
ansible.builtin.file: ansible.builtin.file:
path: /var/lib/rancher/k3s/server/manifests path: /var/lib/rancher/k3s/server/manifests

View File

@@ -61,6 +61,10 @@ spec:
- name: bgp_routerid - name: bgp_routerid
value: "{{ kube_vip_bgp_routerid }}" value: "{{ kube_vip_bgp_routerid }}"
{% endif %} {% 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 %} {% if kube_vip_bgp_as is defined %}
- name: bgp_as - name: bgp_as
value: "{{ kube_vip_bgp_as }}" value: "{{ kube_vip_bgp_as }}"
@@ -73,6 +77,7 @@ spec:
- name: bgp_peeras - name: bgp_peeras
value: "{{ kube_vip_bgp_peeras }}" value: "{{ kube_vip_bgp_peeras }}"
{% endif %} {% endif %}
{% endif %}
{% endif %} {% endif %}
image: ghcr.io/kube-vip/kube-vip:{{ kube_vip_tag_version }} image: ghcr.io/kube-vip/kube-vip:{{ kube_vip_tag_version }}
imagePullPolicy: Always imagePullPolicy: Always

View File

@@ -224,7 +224,6 @@
- name: Set _cilium_bgp_neighbors fact - name: Set _cilium_bgp_neighbors fact
ansible.builtin.set_fact: ansible.builtin.set_fact:
_cilium_bgp_neighbors: "{{ lookup('community.general.merge_variables', '^cilium_bgp_neighbors__.+$', initial_value=cilium_bgp_neighbors, groups=cilium_bgp_neighbors_groups) }}" # yamllint disable-line rule:line-length _cilium_bgp_neighbors: "{{ lookup('community.general.merge_variables', '^cilium_bgp_neighbors__.+$', initial_value=cilium_bgp_neighbors, groups=cilium_bgp_neighbors_groups) }}" # yamllint disable-line rule:line-length
when: cilium_bgp_neighbors | length > 0
- name: Copy BGP manifests to first master - name: Copy BGP manifests to first master
ansible.builtin.template: ansible.builtin.template: