From 83d945127fe566721111ad25af61e997b3e144e6 Mon Sep 17 00:00:00 2001 From: Maxime Guyot Date: Thu, 28 May 2020 09:46:02 +0200 Subject: [PATCH] Make vagrant CI normal (#6074) --- .gitlab-ci/vagrant.yml | 8 ++++---- Vagrantfile | 2 +- docs/ci.md | 2 +- tests/Makefile | 8 ++++++++ tests/files/vagrant_ubuntu18-flannel.rb | 3 ++- tests/files/vagrant_ubuntu18-flannel.yml | 7 +++++++ tests/files/vagrant_ubuntu18-weave-medium.rb | 1 + tests/files/vagrant_ubuntu18-weave-medium.yml | 7 +++++++ tests/testcases/040_check-network-adv.yml | 6 +++--- 9 files changed, 34 insertions(+), 10 deletions(-) create mode 100644 tests/files/vagrant_ubuntu18-flannel.yml create mode 100644 tests/files/vagrant_ubuntu18-weave-medium.yml diff --git a/.gitlab-ci/vagrant.yml b/.gitlab-ci/vagrant.yml index 65b486bc3..596e06be3 100644 --- a/.gitlab-ci/vagrant.yml +++ b/.gitlab-ci/vagrant.yml @@ -20,7 +20,7 @@ molecule_tests: extends: .testcases variables: CI_PLATFORM: "vagrant" - SSH_USER: "kubespray" + SSH_USER: "vagrant" VAGRANT_DEFAULT_PROVIDER: "libvirt" KUBESPRAY_VAGRANT_CONFIG: tests/files/${CI_JOB_NAME}.rb tags: [c3.small.x86] @@ -34,9 +34,9 @@ molecule_tests: - python -m pip install -r tests/requirements.txt - ./tests/scripts/vagrant_clean.sh script: - - vagrant up + - ./tests/scripts/testcases_run.sh after_script: - - vagrant destroy --force + - chronic ./tests/scripts/testcases_cleanup.sh vagrant_ubuntu18-flannel: stage: deploy-part2 @@ -46,4 +46,4 @@ vagrant_ubuntu18-flannel: vagrant_ubuntu18-weave-medium: stage: deploy-part2 extends: .vagrant - when: manual \ No newline at end of file + when: manual diff --git a/Vagrantfile b/Vagrantfile index 55954960f..517ffb5b7 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -69,7 +69,7 @@ $disk_size ||= "20GB" $local_path_provisioner_enabled ||= false $local_path_provisioner_claim_root ||= "/opt/local-path-provisioner/" -$playbook = "cluster.yml" +$playbook ||= "cluster.yml" host_vars = {} diff --git a/docs/ci.md b/docs/ci.md index 684b57fad..831bd159e 100644 --- a/docs/ci.md +++ b/docs/ci.md @@ -16,7 +16,7 @@ fedora31 | :x: | :x: | :x: | :x: | :white_check_mark: | :x: | :x: | :x: | :x: | opensuse | :x: | :white_check_mark: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | oracle7 | :x: | :white_check_mark: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | ubuntu16 | :x: | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | :x: | :white_check_mark: | -ubuntu18 | :white_check_mark: | :x: | :white_check_mark: | :x: | :x: | :x: | :x: | :x: | :x: | +ubuntu18 | :white_check_mark: | :x: | :white_check_mark: | :x: | :white_check_mark: | :x: | :x: | :x: | :white_check_mark: | ubuntu20 | :white_check_mark: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | ## crio diff --git a/tests/Makefile b/tests/Makefile index bc495d81a..2902e1ed4 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -72,3 +72,11 @@ delete-packet: -e @"files/${CI_JOB_NAME}.yml" \ -e test_id=$(TEST_ID) \ -e inventory_path=$(INVENTORY) + +create-vagrant: + vagrant up + find / -name vagrant_ansible_inventory + cp /builds/kargo-ci/kubernetes-sigs-kubespray/inventory/sample/vagrant_ansible_inventory $(INVENTORY) + +delete-vagrant: + vagrant destroy -f \ No newline at end of file diff --git a/tests/files/vagrant_ubuntu18-flannel.rb b/tests/files/vagrant_ubuntu18-flannel.rb index 95af989ce..25b86904c 100644 --- a/tests/files/vagrant_ubuntu18-flannel.rb +++ b/tests/files/vagrant_ubuntu18-flannel.rb @@ -3,4 +3,5 @@ $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 \ No newline at end of file +$box_check_update = false +$vm_cpus = 2 \ No newline at end of file diff --git a/tests/files/vagrant_ubuntu18-flannel.yml b/tests/files/vagrant_ubuntu18-flannel.yml new file mode 100644 index 000000000..e878a5e38 --- /dev/null +++ b/tests/files/vagrant_ubuntu18-flannel.yml @@ -0,0 +1,7 @@ +--- +# Kubespray settings + +kube_network_plugin: flannel + +deploy_netchecker: true +dns_min_replicas: 1 \ No newline at end of file diff --git a/tests/files/vagrant_ubuntu18-weave-medium.rb b/tests/files/vagrant_ubuntu18-weave-medium.rb index 16be3aa64..ae16510c3 100644 --- a/tests/files/vagrant_ubuntu18-weave-medium.rb +++ b/tests/files/vagrant_ubuntu18-weave-medium.rb @@ -4,3 +4,4 @@ $os = "ubuntu1804" $network_plugin = "weave" $kube_master_instances = 1 $etcd_instances = 1 +$playbook = "tests/cloud_playbooks/wait-for-ssh.yml" diff --git a/tests/files/vagrant_ubuntu18-weave-medium.yml b/tests/files/vagrant_ubuntu18-weave-medium.yml new file mode 100644 index 000000000..3c3647837 --- /dev/null +++ b/tests/files/vagrant_ubuntu18-weave-medium.yml @@ -0,0 +1,7 @@ +--- +# Kubespray settings + +kube_network_plugin: weave + +deploy_netchecker: true +dns_min_replicas: 1 diff --git a/tests/testcases/040_check-network-adv.yml b/tests/testcases/040_check-network-adv.yml index 91bfdac7f..3bdf9cce4 100644 --- a/tests/testcases/040_check-network-adv.yml +++ b/tests/testcases/040_check-network-adv.yml @@ -188,7 +188,7 @@ EOF when: - inventory_hostname == groups['kube-master'][0] - - kube_network_plugin_multus|default(false) + - kube_network_plugin_multus|bool|default(false) - name: Annotate pod with macvlan network # We cannot use only shell: below because Ansible will render the text @@ -212,7 +212,7 @@ EOF when: - inventory_hostname == groups['kube-master'][0] - - kube_network_plugin_multus|default(false) + - kube_network_plugin_multus|bool|default(false) - name: Check secondary macvlan interface shell: "{{ bin_dir }}/kubectl exec samplepod -- ip addr show dev net1" @@ -222,4 +222,4 @@ changed_when: false when: - inventory_hostname == groups['kube-master'][0] - - kube_network_plugin_multus|default(false) + - kube_network_plugin_multus|bool|default(false)