mirror of
https://github.com/techno-tim/k3s-ansible.git
synced 2025-12-29 04:02:38 +01:00
Compare commits
7 Commits
cb55257925
...
v1.30.2+k3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
668d7fb896 | ||
|
|
6cee0e9051 | ||
|
|
6823ad51d5 | ||
|
|
1a521ea0d9 | ||
|
|
e48bb6df26 | ||
|
|
36893c27fb | ||
|
|
e8cd10d49b |
2
.github/workflows/cache.yml
vendored
2
.github/workflows/cache.yml
vendored
@@ -16,7 +16,7 @@ jobs:
|
|||||||
ref: ${{ github.event.pull_request.head.sha }}
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
|
||||||
- name: Set up Python ${{ env.PYTHON_VERSION }}
|
- name: Set up Python ${{ env.PYTHON_VERSION }}
|
||||||
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # 5.1.0
|
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # 5.1.1
|
||||||
with:
|
with:
|
||||||
python-version: ${{ env.PYTHON_VERSION }}
|
python-version: ${{ env.PYTHON_VERSION }}
|
||||||
cache: 'pip' # caching pip dependencies
|
cache: 'pip' # caching pip dependencies
|
||||||
|
|||||||
4
.github/workflows/lint.yml
vendored
4
.github/workflows/lint.yml
vendored
@@ -16,7 +16,7 @@ jobs:
|
|||||||
ref: ${{ github.event.pull_request.head.sha }}
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
|
||||||
- name: Set up Python ${{ env.PYTHON_VERSION }}
|
- name: Set up Python ${{ env.PYTHON_VERSION }}
|
||||||
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # 5.1.0
|
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # 5.1.1
|
||||||
with:
|
with:
|
||||||
python-version: ${{ env.PYTHON_VERSION }}
|
python-version: ${{ env.PYTHON_VERSION }}
|
||||||
cache: 'pip' # caching pip dependencies
|
cache: 'pip' # caching pip dependencies
|
||||||
@@ -47,7 +47,7 @@ jobs:
|
|||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # 4.1.7
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # 4.1.7
|
||||||
- name: Ensure SHA pinned actions
|
- name: Ensure SHA pinned actions
|
||||||
uses: zgosalvez/github-actions-ensure-sha-pinned-actions@74606c30450304eee8660aae751818321754feb1 # 3.0.9
|
uses: zgosalvez/github-actions-ensure-sha-pinned-actions@b88cd0aad2c36a63e42c71f81cb1958fed95ac87 # 3.0.10
|
||||||
with:
|
with:
|
||||||
allowlist: |
|
allowlist: |
|
||||||
aws-actions/
|
aws-actions/
|
||||||
|
|||||||
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
@@ -59,7 +59,7 @@ jobs:
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
- name: Set up Python ${{ env.PYTHON_VERSION }}
|
- name: Set up Python ${{ env.PYTHON_VERSION }}
|
||||||
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # 5.1.0
|
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # 5.1.1
|
||||||
with:
|
with:
|
||||||
python-version: ${{ env.PYTHON_VERSION }}
|
python-version: ${{ env.PYTHON_VERSION }}
|
||||||
cache: 'pip' # caching pip dependencies
|
cache: 'pip' # caching pip dependencies
|
||||||
@@ -118,7 +118,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Upload log files
|
- name: Upload log files
|
||||||
if: always() # do this even if a step before has failed
|
if: always() # do this even if a step before has failed
|
||||||
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # 4.3.3
|
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # 4.3.4
|
||||||
with:
|
with:
|
||||||
name: logs
|
name: logs
|
||||||
path: |
|
path: |
|
||||||
|
|||||||
@@ -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: eth0
|
cilium_iface: eth1
|
||||||
|
|
||||||
# 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
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#
|
#
|
||||||
ansible-compat==4.1.11
|
ansible-compat==4.1.11
|
||||||
# via molecule
|
# via molecule
|
||||||
ansible-core==2.16.6
|
ansible-core==2.17.2
|
||||||
# via
|
# via
|
||||||
# -r requirements.in
|
# -r requirements.in
|
||||||
# ansible-compat
|
# ansible-compat
|
||||||
@@ -96,7 +96,7 @@ platformdirs==4.1.0
|
|||||||
# via virtualenv
|
# via virtualenv
|
||||||
pluggy==1.3.0
|
pluggy==1.3.0
|
||||||
# via molecule
|
# via molecule
|
||||||
pre-commit==3.7.1
|
pre-commit==3.8.0
|
||||||
# via -r requirements.in
|
# via -r requirements.in
|
||||||
pre-commit-hooks==4.6.0
|
pre-commit-hooks==4.6.0
|
||||||
# via -r requirements.in
|
# via -r requirements.in
|
||||||
|
|||||||
@@ -4,6 +4,9 @@
|
|||||||
# will determine the right interface automatically at runtime.
|
# will determine the right interface automatically at runtime.
|
||||||
kube_vip_iface: null
|
kube_vip_iface: null
|
||||||
|
|
||||||
|
# Enables ARP broadcasts from Leader
|
||||||
|
kube_vip_arp: true
|
||||||
|
|
||||||
# Name of the master group
|
# Name of the master group
|
||||||
group_name_master: master
|
group_name_master: master
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
- name: Deploy metallb manifest
|
- name: Deploy metallb manifest
|
||||||
include_tasks: metallb.yml
|
include_tasks: metallb.yml
|
||||||
tags: metallb
|
tags: metallb
|
||||||
when: kube_vip_lb_ip_range is not defined and (cilium_bgp is not defined or cilium_iface is not defined)
|
when: kube_vip_lb_ip_range is not defined and (not cilium_bgp or cilium_iface is not defined)
|
||||||
|
|
||||||
- name: Deploy kube-vip manifest
|
- name: Deploy kube-vip manifest
|
||||||
include_tasks: kube-vip.yml
|
include_tasks: kube-vip.yml
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ spec:
|
|||||||
- manager
|
- manager
|
||||||
env:
|
env:
|
||||||
- name: vip_arp
|
- name: vip_arp
|
||||||
value: "true"
|
value: "{{ 'true' if kube_vip_arp | bool else 'false' }}"
|
||||||
- name: port
|
- name: port
|
||||||
value: "6443"
|
value: "6443"
|
||||||
{% if kube_vip_iface %}
|
{% if kube_vip_iface %}
|
||||||
|
|||||||
@@ -221,9 +221,10 @@
|
|||||||
- 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-bgp.crs.j2"
|
src: "cilium.crs.j2"
|
||||||
dest: /tmp/k3s/cilium-bgp.yaml
|
dest: /tmp/k3s/cilium-bgp.yaml
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
@@ -246,37 +247,6 @@
|
|||||||
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:
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
- name: Deploy metallb pool
|
- name: Deploy metallb pool
|
||||||
include_tasks: metallb.yml
|
include_tasks: metallb.yml
|
||||||
tags: metallb
|
tags: metallb
|
||||||
when: kube_vip_lb_ip_range is not defined and (cilium_bgp is not defined or cilium_iface is not defined)
|
when: kube_vip_lb_ip_range is not defined and (not cilium_bgp or cilium_iface is not defined)
|
||||||
|
|
||||||
- name: Remove tmp directory used for manifests
|
- name: Remove tmp directory used for manifests
|
||||||
file:
|
file:
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
---
|
|
||||||
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 %}
|
|
||||||
@@ -19,3 +19,16 @@ 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 %}
|
||||||
Reference in New Issue
Block a user