mirror of
https://github.com/techno-tim/k3s-ansible.git
synced 2025-12-29 04:02:38 +01:00
Compare commits
4 Commits
096e62ad7b
...
cb55257925
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cb55257925 | ||
|
|
7239c927de | ||
|
|
15e97bad1d | ||
|
|
4bee4230de |
@@ -6,7 +6,7 @@
|
|||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
# See:
|
# See:
|
||||||
# https://github.com/flannel-io/flannel/blob/67d603aaf45ef80f5dd39f43714fc5e6f8a637eb/Documentation/troubleshooting.md#Vagrant
|
# https://github.com/flannel-io/flannel/blob/67d603aaf45ef80f5dd39f43714fc5e6f8a637eb/Documentation/troubleshooting.md#Vagrant
|
||||||
cilium_iface: eth1
|
cilium_iface: eth0
|
||||||
|
|
||||||
# The test VMs might be a bit slow, so we give them more time to join the cluster:
|
# The test VMs might be a bit slow, so we give them more time to join the cluster:
|
||||||
retry_count: 45
|
retry_count: 45
|
||||||
|
|||||||
@@ -221,10 +221,9 @@
|
|||||||
- name: Configure Cilium BGP
|
- name: Configure Cilium BGP
|
||||||
when: cilium_bgp
|
when: cilium_bgp
|
||||||
block:
|
block:
|
||||||
|
|
||||||
- name: Copy BGP manifests to first master
|
- name: Copy BGP manifests to first master
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: "cilium.crs.j2"
|
src: "cilium-bgp.crs.j2"
|
||||||
dest: /tmp/k3s/cilium-bgp.yaml
|
dest: /tmp/k3s/cilium-bgp.yaml
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
@@ -247,6 +246,37 @@
|
|||||||
ansible.builtin.command: "{{ item }}"
|
ansible.builtin.command: "{{ item }}"
|
||||||
loop:
|
loop:
|
||||||
- k3s kubectl get CiliumBGPPeeringPolicy.cilium.io
|
- k3s kubectl get CiliumBGPPeeringPolicy.cilium.io
|
||||||
|
changed_when: false
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item }}"
|
||||||
|
|
||||||
|
- name: Configure Cilium Load Balancer
|
||||||
|
when: cilium_iface
|
||||||
|
block:
|
||||||
|
- name: Copy Load Balancer manifests to first master
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: "cilium-lb.crs.j2"
|
||||||
|
dest: /tmp/k3s/cilium-lb.yaml
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0755
|
||||||
|
|
||||||
|
- name: Apply LB manifests
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: kubectl apply -f /tmp/k3s/cilium-lb.yaml
|
||||||
|
register: apply_cr
|
||||||
|
changed_when: "'configured' in apply_cr.stdout or 'created' in apply_cr.stdout"
|
||||||
|
failed_when: "'is invalid' in apply_cr.stderr"
|
||||||
|
ignore_errors: true
|
||||||
|
|
||||||
|
- name: Print error message if LB manifests application fails
|
||||||
|
ansible.builtin.debug:
|
||||||
|
msg: "{{ apply_cr.stderr }}"
|
||||||
|
when: "'is invalid' in apply_cr.stderr"
|
||||||
|
|
||||||
|
- name: Test for LB config resources
|
||||||
|
ansible.builtin.command: "{{ item }}"
|
||||||
|
loop:
|
||||||
- k3s kubectl get CiliumLoadBalancerIPPool.cilium.io
|
- k3s kubectl get CiliumLoadBalancerIPPool.cilium.io
|
||||||
changed_when: false
|
changed_when: false
|
||||||
loop_control:
|
loop_control:
|
||||||
|
|||||||
@@ -19,16 +19,3 @@ spec: # CiliumBGPPeeringPolicySpec
|
|||||||
serviceSelector:
|
serviceSelector:
|
||||||
matchExpressions:
|
matchExpressions:
|
||||||
- {key: somekey, operator: NotIn, values: ['never-used-value']}
|
- {key: somekey, operator: NotIn, values: ['never-used-value']}
|
||||||
---
|
|
||||||
apiVersion: "cilium.io/v2alpha1"
|
|
||||||
kind: CiliumLoadBalancerIPPool
|
|
||||||
metadata:
|
|
||||||
name: "01-lb-pool"
|
|
||||||
spec:
|
|
||||||
blocks:
|
|
||||||
{% if "/" in cilium_bgp_lb_cidr %}
|
|
||||||
- cidr: {{ cilium_bgp_lb_cidr }}
|
|
||||||
{% else %}
|
|
||||||
- start: {{ cilium_bgp_lb_cidr.split('-')[0] }}
|
|
||||||
stop: {{ cilium_bgp_lb_cidr.split('-')[1] }}
|
|
||||||
{% endif %}
|
|
||||||
13
roles/k3s_server_post/templates/cilium-lb.crs.j2
Normal file
13
roles/k3s_server_post/templates/cilium-lb.crs.j2
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
apiVersion: "cilium.io/v2alpha1"
|
||||||
|
kind: CiliumLoadBalancerIPPool
|
||||||
|
metadata:
|
||||||
|
name: "01-lb-pool"
|
||||||
|
spec:
|
||||||
|
blocks:
|
||||||
|
{% if "/" in cilium_bgp_lb_cidr %}
|
||||||
|
- cidr: {{ cilium_bgp_lb_cidr }}
|
||||||
|
{% else %}
|
||||||
|
- start: {{ cilium_bgp_lb_cidr.split('-')[0] }}
|
||||||
|
stop: {{ cilium_bgp_lb_cidr.split('-')[1] }}
|
||||||
|
{% endif %}
|
||||||
Reference in New Issue
Block a user