From 43fceebdd3d065e9d81c30824fadb7d94c775c99 Mon Sep 17 00:00:00 2001 From: Max Gautier Date: Fri, 14 Mar 2025 15:15:57 +0100 Subject: [PATCH] CI: convert vagrant jobs to kubevirt Vagrant jobs needs a big cache which makes them slow / sometimes stuck completely. Using the kubevirt provisionning playbook is now significantly faster, so do just that. Having only one provisionner in CI will also allows us to remove some of the custom runners executors we use for vagrant, and more generally reduce the CI maintenance. Our kubevirt CI platform does not support ivp6 yet, so we keep the relevant jobs in vagrant, but we'll migrate them as well as soon as possible. --- .gitlab-ci/kubevirt.yml | 6 +++ .gitlab-ci/vagrant.yml | 51 +++---------------- tests/files/fedora39-kube-router.yml | 7 +++ tests/files/ubuntu20-flannel-collection.yml | 8 +++ tests/files/ubuntu20-flannel.yml | 1 + tests/files/ubuntu20-kube-router-sep.yml | 7 +++ .../files/ubuntu20-kube-router-svc-proxy.yml | 10 ++++ ...stack.rb => ubuntu24-calico-dual-stack.rb} | 0 ...ack.yml => ubuntu24-calico-dual-stack.yml} | 0 ...k.rb => ubuntu24-calico-ipv6only-stack.rb} | 0 ...yml => ubuntu24-calico-ipv6only-stack.yml} | 0 tests/files/vagrant_fedora39-kube-router.rb | 15 ------ tests/files/vagrant_fedora39-kube-router.yml | 6 --- .../vagrant_ubuntu20-flannel-collection.rb | 9 ---- .../vagrant_ubuntu20-flannel-collection.yml | 3 -- tests/files/vagrant_ubuntu20-flannel.rb | 8 --- tests/files/vagrant_ubuntu20-flannel.yml | 4 -- .../files/vagrant_ubuntu20-kube-router-sep.rb | 15 ------ .../vagrant_ubuntu20-kube-router-sep.yml | 8 --- .../vagrant_ubuntu20-kube-router-svc-proxy.rb | 10 ---- ...vagrant_ubuntu20-kube-router-svc-proxy.yml | 10 ---- 21 files changed, 47 insertions(+), 131 deletions(-) create mode 100644 tests/files/fedora39-kube-router.yml create mode 100644 tests/files/ubuntu20-flannel-collection.yml create mode 120000 tests/files/ubuntu20-flannel.yml create mode 100644 tests/files/ubuntu20-kube-router-sep.yml create mode 100644 tests/files/ubuntu20-kube-router-svc-proxy.yml rename tests/files/{vagrant_ubuntu24-calico-dual-stack.rb => ubuntu24-calico-dual-stack.rb} (100%) rename tests/files/{vagrant_ubuntu24-calico-dual-stack.yml => ubuntu24-calico-dual-stack.yml} (100%) rename tests/files/{vagrant_ubuntu24-calico-ipv6only-stack.rb => ubuntu24-calico-ipv6only-stack.rb} (100%) rename tests/files/{vagrant_ubuntu24-calico-ipv6only-stack.yml => ubuntu24-calico-ipv6only-stack.yml} (100%) delete mode 100644 tests/files/vagrant_fedora39-kube-router.rb delete mode 100644 tests/files/vagrant_fedora39-kube-router.yml delete mode 100644 tests/files/vagrant_ubuntu20-flannel-collection.rb delete mode 100644 tests/files/vagrant_ubuntu20-flannel-collection.yml delete mode 100644 tests/files/vagrant_ubuntu20-flannel.rb delete mode 100644 tests/files/vagrant_ubuntu20-flannel.yml delete mode 100644 tests/files/vagrant_ubuntu20-kube-router-sep.rb delete mode 100644 tests/files/vagrant_ubuntu20-kube-router-sep.yml delete mode 100644 tests/files/vagrant_ubuntu20-kube-router-svc-proxy.rb delete mode 100644 tests/files/vagrant_ubuntu20-kube-router-svc-proxy.yml diff --git a/.gitlab-ci/kubevirt.yml b/.gitlab-ci/kubevirt.yml index ceec118ec..d11e0cc7e 100644 --- a/.gitlab-ci/kubevirt.yml +++ b/.gitlab-ci/kubevirt.yml @@ -42,12 +42,17 @@ pr: - debian11-calico-collection - debian11-macvlan - debian12-cilium + - fedora39-kube-router + # FIXME: this test if broken (perma-failing) - openeuler24-calico - opensuse15-6-calico - rockylinux8-calico - rockylinux9-cilium - ubuntu20-calico-all-in-one-hardening - ubuntu20-cilium-sep + - ubuntu20-flannel-collection + - ubuntu20-kube-router-sep + - ubuntu20-kube-router-svc-proxy - ubuntu22-calico-all-in-one - ubuntu22-calico-all-in-one-upgrade - ubuntu24-calico-etcd-datastore @@ -120,6 +125,7 @@ pr_extended: - opensuse15-6-docker-cilium - rockylinux9-calico - ubuntu20-calico-etcd-kubeadm + - ubuntu20-flannel - ubuntu22-all-in-one-docker - ubuntu24-all-in-one-docker - ubuntu24-calico-all-in-one diff --git a/.gitlab-ci/vagrant.yml b/.gitlab-ci/vagrant.yml index af2739676..a40bbb2ee 100644 --- a/.gitlab-ci/vagrant.yml +++ b/.gitlab-ci/vagrant.yml @@ -1,13 +1,13 @@ --- -.vagrant: - extends: .testcases +vagrant: + extends: .job-moderated needs: - ci-not-authorized variables: CI_PLATFORM: "vagrant" SSH_USER: "vagrant" VAGRANT_DEFAULT_PROVIDER: "libvirt" - KUBESPRAY_VAGRANT_CONFIG: tests/files/${CI_JOB_NAME}.rb + KUBESPRAY_VAGRANT_CONFIG: tests/files/${TESTCASE}.rb DOCKER_NAME: vagrant VAGRANT_ANSIBLE_TAGS: facts VAGRANT_HOME: "$CI_PROJECT_DIR/.vagrant.d" @@ -35,47 +35,12 @@ - .vagrant.d/boxes - .cache/pip policy: pull-push # TODO: change to "pull" when not on main - -vagrant_ubuntu24-calico-dual-stack: stage: deploy-extended - extends: .vagrant rules: - if: $PR_LABELS =~ /.*(ci-extended|ci-full).*/ when: on_success - allow_failure: false - -vagrant_ubuntu24-calico-ipv6only-stack: - stage: deploy-extended - extends: .vagrant - rules: - - if: $PR_LABELS =~ /.*(ci-extended|ci-full).*/ - when: on_success - allow_failure: false - -vagrant_ubuntu20-flannel: - stage: deploy-part1 - extends: .vagrant - when: on_success - allow_failure: false - -vagrant_ubuntu20-flannel-collection: - stage: deploy-extended - extends: .vagrant - when: manual - -vagrant_ubuntu20-kube-router-sep: - stage: deploy-extended - extends: .vagrant - when: manual - -# Service proxy test fails connectivity testing -vagrant_ubuntu20-kube-router-svc-proxy: - stage: deploy-extended - extends: .vagrant - when: manual - -vagrant_fedora39-kube-router: - stage: deploy-extended - extends: .vagrant - when: manual -# FIXME: this test if broken (perma-failing) + parallel: + matrix: + - TESTCASE: + - ubuntu24-calico-dual-stack + - ubuntu24-calico-ipv6only-stack diff --git a/tests/files/fedora39-kube-router.yml b/tests/files/fedora39-kube-router.yml new file mode 100644 index 000000000..06905b9f5 --- /dev/null +++ b/tests/files/fedora39-kube-router.yml @@ -0,0 +1,7 @@ +--- +cloud_image: fedora-39 +cluster_layout: + - node_groups: ['kube_control_plane', 'etcd', 'kube_node'] + - node_groups: ['kube_node'] + +kube_network_plugin: "kube-router" diff --git a/tests/files/ubuntu20-flannel-collection.yml b/tests/files/ubuntu20-flannel-collection.yml new file mode 100644 index 000000000..b5d0ba57b --- /dev/null +++ b/tests/files/ubuntu20-flannel-collection.yml @@ -0,0 +1,8 @@ +--- +cloud_image: ubuntu-2004 +cluster_layout: + - node_groups: ['kube_control_plane', 'etcd', 'kube_node'] + - node_groups: ['kube_control_plane', 'etcd', 'kube_node'] + - node_groups: ['etcd', 'kube_node'] + +kube_network_plugin: flannel diff --git a/tests/files/ubuntu20-flannel.yml b/tests/files/ubuntu20-flannel.yml new file mode 120000 index 000000000..ba939279e --- /dev/null +++ b/tests/files/ubuntu20-flannel.yml @@ -0,0 +1 @@ +ubuntu20-flannel-collection.yml \ No newline at end of file diff --git a/tests/files/ubuntu20-kube-router-sep.yml b/tests/files/ubuntu20-kube-router-sep.yml new file mode 100644 index 000000000..ca34c88a6 --- /dev/null +++ b/tests/files/ubuntu20-kube-router-sep.yml @@ -0,0 +1,7 @@ +--- +cloud_image: ubuntu-2004 +cluster_layout: + - node_groups: ['kube_control_plane', 'etcd', 'kube_node'] + - node_groups: ['kube_node'] + +kube_network_plugin: "kube-router" diff --git a/tests/files/ubuntu20-kube-router-svc-proxy.yml b/tests/files/ubuntu20-kube-router-svc-proxy.yml new file mode 100644 index 000000000..b2739b793 --- /dev/null +++ b/tests/files/ubuntu20-kube-router-svc-proxy.yml @@ -0,0 +1,10 @@ +--- +cloud_image: ubuntu-2004 +cluster_layout: + - node_groups: ['kube_control_plane', 'etcd', 'kube_node'] + - node_groups: ['kube_control_plane', 'etcd', 'kube_node'] + - node_groups: ['etcd', 'kube_node'] + +kube_network_plugin: "kube-router" + +kube_router_run_service_proxy: true diff --git a/tests/files/vagrant_ubuntu24-calico-dual-stack.rb b/tests/files/ubuntu24-calico-dual-stack.rb similarity index 100% rename from tests/files/vagrant_ubuntu24-calico-dual-stack.rb rename to tests/files/ubuntu24-calico-dual-stack.rb diff --git a/tests/files/vagrant_ubuntu24-calico-dual-stack.yml b/tests/files/ubuntu24-calico-dual-stack.yml similarity index 100% rename from tests/files/vagrant_ubuntu24-calico-dual-stack.yml rename to tests/files/ubuntu24-calico-dual-stack.yml diff --git a/tests/files/vagrant_ubuntu24-calico-ipv6only-stack.rb b/tests/files/ubuntu24-calico-ipv6only-stack.rb similarity index 100% rename from tests/files/vagrant_ubuntu24-calico-ipv6only-stack.rb rename to tests/files/ubuntu24-calico-ipv6only-stack.rb diff --git a/tests/files/vagrant_ubuntu24-calico-ipv6only-stack.yml b/tests/files/ubuntu24-calico-ipv6only-stack.yml similarity index 100% rename from tests/files/vagrant_ubuntu24-calico-ipv6only-stack.yml rename to tests/files/ubuntu24-calico-ipv6only-stack.yml diff --git a/tests/files/vagrant_fedora39-kube-router.rb b/tests/files/vagrant_fedora39-kube-router.rb deleted file mode 100644 index e69a10b63..000000000 --- a/tests/files/vagrant_fedora39-kube-router.rb +++ /dev/null @@ -1,15 +0,0 @@ -$num_instances = 2 -$vm_memory ||= 2048 -$os = "fedora39" - -$control_plane_instances = 1 -$etcd_instances = 1 - -# For CI we are not worried about data persistence across reboot -$libvirt_volume_cache = "unsafe" - -# Checking for box update can trigger API rate limiting -# https://www.vagrantup.com/docs/vagrant-cloud/request-limits.html -$box_check_update = false - -$network_plugin = "kube-router" diff --git a/tests/files/vagrant_fedora39-kube-router.yml b/tests/files/vagrant_fedora39-kube-router.yml deleted file mode 100644 index b09c4889f..000000000 --- a/tests/files/vagrant_fedora39-kube-router.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -# Instance settings -cloud_image: fedora-39 - -# Kubespray settings -kube_network_plugin: kube-router diff --git a/tests/files/vagrant_ubuntu20-flannel-collection.rb b/tests/files/vagrant_ubuntu20-flannel-collection.rb deleted file mode 100644 index 55daa19e3..000000000 --- a/tests/files/vagrant_ubuntu20-flannel-collection.rb +++ /dev/null @@ -1,9 +0,0 @@ -$os = "ubuntu2004" - -# For CI we are not worries about data persistence across reboot -$libvirt_volume_cache = "unsafe" - -# Checking for box update can trigger API rate limiting -# https://www.vagrantup.com/docs/vagrant-cloud/request-limits.html -$box_check_update = false -$vm_cpus = 2 diff --git a/tests/files/vagrant_ubuntu20-flannel-collection.yml b/tests/files/vagrant_ubuntu20-flannel-collection.yml deleted file mode 100644 index 6f8916feb..000000000 --- a/tests/files/vagrant_ubuntu20-flannel-collection.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -# Kubespray settings -kube_network_plugin: flannel diff --git a/tests/files/vagrant_ubuntu20-flannel.rb b/tests/files/vagrant_ubuntu20-flannel.rb deleted file mode 100644 index d8bf563a3..000000000 --- a/tests/files/vagrant_ubuntu20-flannel.rb +++ /dev/null @@ -1,8 +0,0 @@ -$os = "ubuntu2004" - -# For CI we are not worries about data persistence across reboot -$libvirt_volume_cache = "unsafe" -# Checking for box update can trigger API rate limiting -# https://www.vagrantup.com/docs/vagrant-cloud/request-limits.html -$box_check_update = false -$vm_cpus = 2 diff --git a/tests/files/vagrant_ubuntu20-flannel.yml b/tests/files/vagrant_ubuntu20-flannel.yml deleted file mode 100644 index 43ec54c6a..000000000 --- a/tests/files/vagrant_ubuntu20-flannel.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -# Kubespray settings -kube_network_plugin: flannel -ansible_ssh_private_key: .vagrant.d/insecure_private_key diff --git a/tests/files/vagrant_ubuntu20-kube-router-sep.rb b/tests/files/vagrant_ubuntu20-kube-router-sep.rb deleted file mode 100644 index 2b16f2043..000000000 --- a/tests/files/vagrant_ubuntu20-kube-router-sep.rb +++ /dev/null @@ -1,15 +0,0 @@ -$num_instances = 2 -$vm_memory ||= 2048 -$os = "ubuntu2004" - -$control_plane_instances = 1 -$etcd_instances = 1 - -# For CI we are not worried about data persistence across reboot -$libvirt_volume_cache = "unsafe" - -# Checking for box update can trigger API rate limiting -# https://www.vagrantup.com/docs/vagrant-cloud/request-limits.html -$box_check_update = false - -$network_plugin = "kube-router" diff --git a/tests/files/vagrant_ubuntu20-kube-router-sep.yml b/tests/files/vagrant_ubuntu20-kube-router-sep.yml deleted file mode 100644 index d17b627a7..000000000 --- a/tests/files/vagrant_ubuntu20-kube-router-sep.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -# Instance settings -cloud_image: ubuntu-2004 -mode: separate - -# Kubespray settings -bootstrap_os: ubuntu -kube_network_plugin: kube-router diff --git a/tests/files/vagrant_ubuntu20-kube-router-svc-proxy.rb b/tests/files/vagrant_ubuntu20-kube-router-svc-proxy.rb deleted file mode 100644 index 29f6e8166..000000000 --- a/tests/files/vagrant_ubuntu20-kube-router-svc-proxy.rb +++ /dev/null @@ -1,10 +0,0 @@ -$os = "ubuntu2004" - -# For CI we are not worried about data persistence across reboot -$libvirt_volume_cache = "unsafe" - -# Checking for box update can trigger API rate limiting -# https://www.vagrantup.com/docs/vagrant-cloud/request-limits.html -$box_check_update = false - -$network_plugin = "kube-router" diff --git a/tests/files/vagrant_ubuntu20-kube-router-svc-proxy.yml b/tests/files/vagrant_ubuntu20-kube-router-svc-proxy.yml deleted file mode 100644 index faa30d068..000000000 --- a/tests/files/vagrant_ubuntu20-kube-router-svc-proxy.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -# Instance settings -cloud_image: ubuntu-2004 -mode: separate - -# Kubespray settings -bootstrap_os: ubuntu -kube_network_plugin: kube-router - -kube_router_run_service_proxy: true