Skip to content

Commit

Permalink
test/e2e: allow overriding default cilium version.
Browse files Browse the repository at this point in the history
Add cni_release environment variable to allow overriding the
default CNI plugin version ('latest'). Implement picking the
correct download path when cni_plugin=cilium.

Signed-off-by: Krisztian Litkey <[email protected]>
  • Loading branch information
klihub authored and askervin committed Nov 15, 2023
1 parent cc0a631 commit 4c47aae
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 13 deletions.
2 changes: 2 additions & 0 deletions test/e2e/files/Vagrantfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ else
end

CNI_PLUGIN = "#{ENV['cni_plugin']}"
CNI_RELEASE = "#{ENV['cni_release']}"

NRI_RESOURCE_POLICY_SRC = "#{ENV['nri_resource_policy_src']}"
OUTPUT_DIR = "#{ENV['OUTPUT_DIR']}"
Expand Down Expand Up @@ -93,6 +94,7 @@ Vagrant.configure("2") do |config|
crio_release: CRIO_RELEASE,
crio_src: CRIO_SRC,
cni_plugin: CNI_PLUGIN,
cni_release: CNI_RELEASE,
nri_resource_policy_src: NRI_RESOURCE_POLICY_SRC,
outdir: OUTPUT_DIR,
}
Expand Down
38 changes: 25 additions & 13 deletions test/e2e/playbook/provision.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
- crio_tarball: "https://storage.googleapis.com/cri-o/artifacts/cri-o.amd64.v{{ crio_release }}.tar.gz"
- dns_nameserver: "{{ dns_nameserver }}"
- cni_plugin: "{{ cni_plugin }}"

- cni_release: "{{ cni_release }}"
- cilium_tarball: ""

tasks:
- set_fact:
Expand Down Expand Up @@ -334,19 +335,30 @@
- kubectl taint nodes --all node-role.kubernetes.io/control-plane- || true
- kubectl taint nodes --all node-role.kubernetes.io/master- || true

- block:
- name: Fetch and extract cilium (installer) release tarball
ansible.builtin.unarchive:
src: "https://github.com/cilium/cilium-cli/releases/latest/download/cilium-linux-amd64.tar.gz"
dest: /usr/local/bin
remote_src: yes

- name: Run cilium installer
ansible.builtin.shell: "{{ item }}"
with_items:
- cilium install --wait
- cilium status --wait
- name: Install cilium CNI plugin
when: cni_plugin == "cilium"
block:
- name: "Use irregular download path if cilium release is latest"
when: cni_release == "latest"
ansible.builtin.set_fact:
cilium_tarball: https://github.com/cilium/cilium-cli/releases/latest/download/cilium-linux-amd64.tar.gz

- name: "Use regular download path if cilium release is not latest"
when: cni_release != "latest"
ansible.builtin.set_fact:
cilium_tarball: https://github.com/cilium/cilium-cli/releases/download/{{ cni_release }}/cilium-linux-amd64.tar.gz

- name: "Fetch and extract {{ cni_release }} cilium (installer) release tarball"
ansible.builtin.unarchive:
src: "{{ cilium_tarball }}"
dest: /usr/local/bin
remote_src: true

- name: Run cilium installer
ansible.builtin.command: "{{ item }}"
with_items:
- cilium install --wait
- cilium status --wait

- block:
- name: Copy CNI bridge plugin configuration
Expand Down
1 change: 1 addition & 0 deletions test/e2e/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export COMMAND_OUTPUT_DIR="$TEST_OUTPUT_DIR"/commands
distro=${distro:-$DEFAULT_DISTRO}
export k8scri=${k8scri:-"containerd"}
export cni_plugin=${cni_plugin:-cilium}
export cni_release=${cni_release:-latest}
TOPOLOGY_DIR=${TOPOLOGY_DIR:=e2e}

source "$LIB_DIR"/vm.bash
Expand Down

0 comments on commit 4c47aae

Please sign in to comment.