mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2025-12-14 13:54:37 +03:00
CI: use VirtualMachineInstance for VMs
VMI in Kubevirt are the abstraction below VirtualMachine. - We don't really need the extra abstraction of VirtualMachine objects - Convert the waiting for VMs ip address to use kubernetes.core.k8s_info and no shell pipeline
This commit is contained in:
@@ -20,19 +20,19 @@
|
||||
changed_when: false
|
||||
loop: "{{ vms_files }}"
|
||||
|
||||
- name: Wait for vms to have ipaddress assigned
|
||||
shell: "set -o pipefail && kubectl get vmis -n {{ test_name }} instance-{{ vm_id }} -o json | jq '.status.interfaces[].ipAddress' | tr -d '\"'"
|
||||
args:
|
||||
executable: /bin/bash
|
||||
changed_when: false
|
||||
register: vm_ips
|
||||
loop: "{{ range(1, vm_count | int + 1, 1) | list }}"
|
||||
loop_control:
|
||||
index_var: vm_id
|
||||
retries: 20
|
||||
delay: 15
|
||||
until:
|
||||
- vm_ips.stdout | ansible.utils.ipaddr
|
||||
- name: Wait for vms to have IP addresses
|
||||
kubernetes.core.k8s_info:
|
||||
api_version: kubevirt.io/v1
|
||||
kind: VirtualMachineInstance
|
||||
label_selectors:
|
||||
- "ci_job_id={{ ci_job_id }}"
|
||||
namespace: "{{ pod_namespace }}"
|
||||
register: vmis
|
||||
until: vmis.resources
|
||||
| map(attribute='status.interfaces.0')
|
||||
| rejectattr('ipAddress', 'defined') == []
|
||||
retries: 30
|
||||
delay: 10
|
||||
|
||||
- name: "Create inventory for CI test in file /tmp/{{ test_name }}/inventory"
|
||||
template:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
apiVersion: kubevirt.io/v1
|
||||
kind: VirtualMachine
|
||||
kind: VirtualMachineInstance
|
||||
metadata:
|
||||
generateName: test-vm-
|
||||
namespace: {{ pod_namespace }}
|
||||
@@ -8,6 +8,8 @@ metadata:
|
||||
kubespray.com/ci.template-path: "tests/cloud_playbooks/roles/packet-ci/templates/vm.yml.j2"
|
||||
labels:
|
||||
kubevirt.io/os: {{ cloud_image }}
|
||||
kubevirt.io/size: small
|
||||
kubevirt.io/domain: "{{ test_name }}"
|
||||
ci_job_id: "{{ ci_job_id }}"
|
||||
ci_job_name: "{{ ci_job_name }}"
|
||||
# leverage the Kubernetes GC for resources cleanup
|
||||
@@ -17,13 +19,6 @@ metadata:
|
||||
name: "{{ pod_name }}"
|
||||
uid: "{{ pod_uid }}"
|
||||
spec:
|
||||
running: true
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
kubevirt.io/size: small
|
||||
kubevirt.io/domain: "{{ test_name }}"
|
||||
spec:
|
||||
domain:
|
||||
devices:
|
||||
blockMultiQueue: true
|
||||
|
||||
Reference in New Issue
Block a user