Add the cilium network plugin to the kubernetes role, disabling servicelb, and collect the disabled k3s components in one disable list
This commit is contained in:
@@ -41,5 +41,10 @@
|
||||
when:
|
||||
- "kubernetes.network.plugin == 'calico'"
|
||||
|
||||
- name: Deploy cilium
|
||||
import_tasks: ./roles/kubernetes/tasks/install/server/network-plugin/deploy_cilium.yml
|
||||
when:
|
||||
- "kubernetes.network.plugin == 'cilium'"
|
||||
|
||||
- name: Deploy network-helpers
|
||||
import_tasks: ./roles/kubernetes/tasks/install/server/network-plugin/deploy_network_helper.yml
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
- name: Check if already installed in cluster
|
||||
command: "cilium status"
|
||||
register: cilium_status
|
||||
ignore_errors: true
|
||||
run_once: true
|
||||
|
||||
- name: Get Cilium CLI version
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- curl
|
||||
- -s
|
||||
- https://raw.githubusercontent.com/cilium/cilium-cli/main/stable.txt
|
||||
register: cilium_cli_version
|
||||
check_mode: no
|
||||
changed_when: false
|
||||
run_once: true
|
||||
|
||||
- name: Determine CLI architecture
|
||||
set_fact:
|
||||
cli_arch: "{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}"
|
||||
run_once: true
|
||||
|
||||
- name: Download and verify Cilium CLI
|
||||
block:
|
||||
- name: Download Cilium CLI tar.gz file
|
||||
get_url:
|
||||
url: "https://github.com/cilium/cilium-cli/releases/download/{{ cilium_cli_version.stdout }}/cilium-linux-{{ cli_arch }}.tar.gz"
|
||||
dest: "/tmp/cilium-linux-{{ cli_arch }}.tar.gz"
|
||||
checksum: "sha256:{{ lookup('url', 'https://github.com/cilium/cilium-cli/releases/download/' + cilium_cli_version.stdout + '/cilium-linux-' + cli_arch + '.tar.gz.sha256sum', wantlist=True)[0].split(' ')[0] }}"
|
||||
mode: '0755'
|
||||
|
||||
- name: Extract Cilium CLI tar.gz to /usr/local/bin
|
||||
unarchive:
|
||||
src: "/tmp/cilium-linux-{{ cli_arch }}.tar.gz"
|
||||
dest: "/usr/local/bin"
|
||||
remote_src: yes
|
||||
#extra_opts: ["--strip-components=1"]
|
||||
mode: 777
|
||||
when: cilium_cli_version.stdout is defined
|
||||
become: yes
|
||||
|
||||
- name: Clean up temporary files
|
||||
file:
|
||||
path: "/tmp/cilium-linux-{{ cli_arch }}.tar.gz"
|
||||
state: absent
|
||||
|
||||
# Install cilium via cli
|
||||
- block:
|
||||
- name: Install cilium
|
||||
command: >
|
||||
cilium install
|
||||
--set
|
||||
imap.mode=kubernetes,
|
||||
ipv6.enabled=true,
|
||||
#ipam.operator.clusterPoolIPv4PodCIDRList={{ kubernetes.ipPool.ipv4.cluster_cidr }},
|
||||
#ipam.operator.clusterPoolIPv6PodCIDRList={{ kubernetes.ipPool.ipv6.cluster_cidr }}
|
||||
|
||||
- name: Wait for cilium
|
||||
command: cilium status --wait
|
||||
changed_when: false
|
||||
run_once: true
|
||||
when:
|
||||
- cilium_status.rc != 0
|
||||
Reference in New Issue
Block a user