* Add ability to use Cilium CNI

---------

Co-authored-by: Michael McCulloch <mjm.gitlab@fastmail.com>
This commit is contained in:
Michael McCulloch 2023-12-30 09:39:42 -07:00 committed by GitHub
parent 25e782117c
commit fee7a74c79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 67 additions and 0 deletions

View File

@ -11,6 +11,7 @@ kubernetes_packages:
kubernetes_version: '1.25'
kubernetes_version_rhel_package: '1.25.1'
kubernetes_cilium_version: '1.14.5' # Set the default version of Cilium to install
kubernetes_role: control_plane
@ -70,3 +71,5 @@ kubernetes_flannel_manifest_file: https://raw.githubusercontent.com/flannel-io/f
# Calico config file.
kubernetes_calico_manifest_file: https://projectcalico.docs.tigera.io/manifests/calico.yaml

View File

@ -45,6 +45,68 @@
state: link
mode: 0644
- name: Taint nodes with cilium agent-not-ready
command: kubectl taint nodes --all node.cilium.io/agent-not-ready=true:NoExecute
when:
- kubernetes_pod_network.cni == 'cilium'
- not kubernetes_init_stat.stat.exists
- name: Check if Cilium CLI has already been Installed.
stat:
path: /usr/local/bin/cilium
register: cilium_init_stat
- name: Install Cilium CLI
when:
- kubernetes_pod_network.cni == 'cilium'
- not cilium_init_stat.stat.exists
block:
- name: Get Cilium CLI version
shell: curl -s https://raw.githubusercontent.com/cilium/cilium-cli/main/stable.txt
register: cilium_cli_version
changed_when: false
- name: Set CLI architecture
set_fact:
cli_arch: "{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}"
- name: Download Cilium CLI
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"
mode: '0644'
- name: Download Cilium CLI checksum
get_url:
url: "https://github.com/cilium/cilium-cli/releases/download/{{ cilium_cli_version.stdout }}/cilium-linux-{{ cli_arch }}.tar.gz.sha256sum"
dest: "/tmp/cilium-linux-{{ cli_arch }}.tar.gz.sha256sum"
mode: '0644'
- name: Verify Cilium CLI checksum
shell: sha256sum --check /tmp/cilium-linux-{{ cli_arch }}.tar.gz.sha256sum
args:
chdir: /tmp
- name: Extract Cilium CLI
unarchive:
src: "/tmp/cilium-linux-{{ cli_arch }}.tar.gz"
dest: /usr/local/bin
remote_src: yes
- name: Remove downloaded files
file:
path: "/tmp/cilium-linux-{{ cli_arch }}.tar.gz{{ item }}"
state: absent
loop:
- ''
- '.sha256sum'
- name: Configure Cilium networking
command: /usr/local/bin/cilium install --version {{ kubernetes_cilium_version }}
when:
- kubernetes_pod_network.cni == 'cilium'
- not kubernetes_init_stat.stat.exists
- name: Configure Flannel networking.
command: "kubectl apply -f {{ kubernetes_flannel_manifest_file }}"
register: flannel_result
@ -87,3 +149,5 @@
when:
- kubernetes_allow_pods_on_control_plane | bool
- not kubernetes_init_stat.stat.exists