From 91e2a279872192f8c82bb753f7e44079c2c66e77 Mon Sep 17 00:00:00 2001 From: Guido Grazioli Date: Tue, 14 Nov 2023 11:38:50 +0100 Subject: [PATCH 1/4] update minimum ansible-core to 2.14+ linter Signed-off-by: Guido Grazioli --- README.md | 2 +- meta/runtime.yml | 2 +- plugins/inventory/kubevirt.py | 26 ++++++++------- plugins/modules/kubevirt_vm.py | 60 +++++++++++++++++----------------- 4 files changed, 47 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index 9963b1e..cb90fc6 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This repository hosts the `kubevirt.core` Ansible Collection, which provides vir ## Ansible version compatibility -This collection has been tested against following Ansible versions: **>=2.9.10**. +This collection has been tested against following Ansible versions: **>=2.14.0**. ## Included content diff --git a/meta/runtime.yml b/meta/runtime.yml index 3b2dfb0..be99ccf 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -1,2 +1,2 @@ --- -requires_ansible: '>=2.11.0' # Use '>= 2.9.10' instead, if needed +requires_ansible: '>=2.14.0' diff --git a/plugins/inventory/kubevirt.py b/plugins/inventory/kubevirt.py index fb96a27..5ae842a 100644 --- a/plugins/inventory/kubevirt.py +++ b/plugins/inventory/kubevirt.py @@ -131,34 +131,38 @@ requirements: EXAMPLES = """ # Filename must end with kubevirt.[yml|yaml] +--- # Authenticate with token, and return all VirtualMachineInstances for all accessible namespaces plugin: kubevirt.core.kubevirt connections: -- host: https://192.168.64.4:8443 - api_key: xxxxxxxxxxxxxxxx - validate_certs: false + - host: https://192.168.64.4:8443 + api_key: xxxxxxxxxxxxxxxx + validate_certs: false +--- # Use default config (~/.kube/config) file and active context, and return VirtualMachineInstances # from namespace testing with interfaces connected to network bridge-network plugin: kubevirt.core.kubevirt connections: -- namespaces: - - testing - network_name: bridge-network + - namespaces: + - testing + network_name: bridge-network +--- # Use default config (~/.kube/config) file and active context, and return VirtualMachineInstances # from namespace testing with label app=test plugin: kubevirt.core.kubevirt connections: -- namespaces: - - testing - label_selector: app=test + - namespaces: + - testing + label_selector: app=test +--- # Use a custom config file, and a specific context. plugin: kubevirt.core.kubevirt connections: -- kubeconfig: /path/to/config - context: 'awx/192-168-64-4:8443/developer' + - kubeconfig: /path/to/config + context: 'awx/192-168-64-4:8443/developer' """ from dataclasses import dataclass diff --git a/plugins/modules/kubevirt_vm.py b/plugins/modules/kubevirt_vm.py index 915771d..e2ccf4d 100644 --- a/plugins/modules/kubevirt_vm.py +++ b/plugins/modules/kubevirt_vm.py @@ -128,27 +128,27 @@ EXAMPLES = """ domain: devices: interfaces: - - name: default - masquerade: {} - - name: bridge-network - bridge: {} + - name: default + masquerade: {} + - name: bridge-network + bridge: {} networks: - - name: default - pod: {} - - name: bridge-network - multus: - networkName: kindexgw + - name: default + pod: {} + - name: bridge-network + multus: + networkName: kindexgw volumes: - - containerDisk: - image: quay.io/containerdisks/fedora:latest - name: containerdisk - - cloudInitNoCloud: - userData: |- - #cloud-config - # The default username is: fedora - ssh_authorized_keys: - - ssh-ed25519 AAAA... - name: cloudinit + - containerDisk: + image: quay.io/containerdisks/fedora:latest + name: containerdisk + - cloudInitNoCloud: + userData: |- + #cloud-config + # The default username is: fedora + ssh_authorized_keys: + - ssh-ed25519 AAAA... + name: cloudinit - name: Create a VirtualMachine with a DataVolume template kubevirt.core.kubevirt_vm: @@ -170,7 +170,7 @@ EXAMPLES = """ url: docker://quay.io/containerdisks/fedora:latest storage: accessModes: - - ReadWriteOnce + - ReadWriteOnce resources: requests: storage: 5Gi @@ -178,16 +178,16 @@ EXAMPLES = """ domain: devices: {} volumes: - - dataVolume: - name: testdv - name: datavolume - - cloudInitNoCloud: - userData: |- - #cloud-config - # The default username is: fedora - ssh_authorized_keys: - - ssh-ed25519 AAAA... - name: cloudinit + - dataVolume: + name: testdv + name: datavolume + - cloudInitNoCloud: + userData: |- + #cloud-config + # The default username is: fedora + ssh_authorized_keys: + - ssh-ed25519 AAAA... + name: cloudinit wait: yes - name: Delete a VirtualMachine From 8f8e7eda6e2e83e6fc4c6d296d768d7fa6dfa996 Mon Sep 17 00:00:00 2001 From: Guido Grazioli Date: Tue, 14 Nov 2023 11:48:42 +0100 Subject: [PATCH 2/4] update sanity/unit tests matrix Signed-off-by: Guido Grazioli --- .ansible-lint | 1 + .github/workflows/ci.yml | 116 ++++++---------------------------- plugins/inventory/kubevirt.py | 4 -- 3 files changed, 22 insertions(+), 99 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index 473975d..56a712b 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -27,6 +27,7 @@ warn_list: - run-once[task] - var-naming[no-role-prefix] - galaxy[version-incorrect] + - yaml[key-duplicates] skip_list: - jinja[spacing] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 74c95ad..0f5919b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,68 +49,27 @@ jobs: "ansible-version": "stable-2.9" }, { - "ansible-version": "stable-2.12", + "ansible-version": "stable-2.12" + }, + { + "ansible-version": "stable-2.13" + }, + { "python-version": "3.7" }, { - "ansible-version": "stable-2.12", - "python-version": "3.11" - }, - { - "ansible-version": "stable-2.13", - "python-version": "3.7" - }, - { - "ansible-version": "stable-2.13", - "python-version": "3.11" - }, - { - "ansible-version": "stable-2.14", - "python-version": "3.7" - }, - { - "ansible-version": "stable-2.14", "python-version": "3.8" }, { - "ansible-version": "stable-2.14", - "python-version": "3.11" - }, - { - "ansible-version": "stable-2.15", - "python-version": "3.7" - }, - { - "ansible-version": "stable-2.15", - "python-version": "3.8" - }, - { - "ansible-version": "stable-2.15", - "python-version": "3.11" - }, - { - "ansible-version": "milestone", - "python-version": "3.7" - }, - { - "ansible-version": "milestone", - "python-version": "3.8" - }, - { - "ansible-version": "milestone", "python-version": "3.9" }, { - "ansible-version": "devel", - "python-version": "3.7" + "ansible-version": "stable-2.14", + "python-version": "3.12" }, { - "ansible-version": "devel", - "python-version": "3.8" - }, - { - "ansible-version": "devel", - "python-version": "3.9" + "ansible-version": "stable-2.15", + "python-version": "3.12" } ] unit-source: @@ -121,63 +80,30 @@ jobs: matrix_exclude: >- [ { - "python-version": "3.11" + "python-version": "3.10" + }, + { + "ansible-version": "stable-2.12" + }, + { + "ansible-version": "stable-2.13" }, { - "ansible-version": "stable-2.12", "python-version": "3.7" }, { - "ansible-version": "stable-2.13", - "python-version": "3.7" - }, - { - "ansible-version": "stable-2.12", "python-version": "3.8" }, { - "ansible-version": "stable-2.13", - "python-version": "3.8" - }, - { - "ansible-version": "stable-2.14", - "python-version": "3.7" - }, - { - "ansible-version": "stable-2.14", - "python-version": "3.8" - }, - { - "ansible-version": "stable-2.15", - "python-version": "3.7" - }, - { - "ansible-version": "stable-2.15", - "python-version": "3.8" - }, - { - "ansible-version": "milestone", - "python-version": "3.7" - }, - { - "ansible-version": "milestone", - "python-version": "3.8" - }, - { - "ansible-version": "milestone", "python-version": "3.9" }, { - "ansible-version": "devel", - "python-version": "3.7" + "ansible-version": "stable-2.14", + "python-version": "3.12" }, { - "ansible-version": "devel", - "python-version": "3.8" - }, - { - "ansible-version": "devel", - "python-version": "3.9" + "ansible-version": "stable-2.15", + "python-version": "3.12" } ] collection_pre_install: '' diff --git a/plugins/inventory/kubevirt.py b/plugins/inventory/kubevirt.py index 5ae842a..6b4f4ea 100644 --- a/plugins/inventory/kubevirt.py +++ b/plugins/inventory/kubevirt.py @@ -131,7 +131,6 @@ requirements: EXAMPLES = """ # Filename must end with kubevirt.[yml|yaml] ---- # Authenticate with token, and return all VirtualMachineInstances for all accessible namespaces plugin: kubevirt.core.kubevirt connections: @@ -139,7 +138,6 @@ connections: api_key: xxxxxxxxxxxxxxxx validate_certs: false ---- # Use default config (~/.kube/config) file and active context, and return VirtualMachineInstances # from namespace testing with interfaces connected to network bridge-network plugin: kubevirt.core.kubevirt @@ -148,7 +146,6 @@ connections: - testing network_name: bridge-network ---- # Use default config (~/.kube/config) file and active context, and return VirtualMachineInstances # from namespace testing with label app=test plugin: kubevirt.core.kubevirt @@ -157,7 +154,6 @@ connections: - testing label_selector: app=test ---- # Use a custom config file, and a specific context. plugin: kubevirt.core.kubevirt connections: From 0586d919435dbc2b4e4a178d15729a30784f077f Mon Sep 17 00:00:00 2001 From: Guido Grazioli Date: Tue, 14 Nov 2023 12:03:06 +0100 Subject: [PATCH 3/4] integration tests: drop EOL versions Signed-off-by: Guido Grazioli --- .github/workflows/integration.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 7c848c8..dd3cd9d 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -111,15 +111,11 @@ jobs: matrix: test-target: ${{ fromJSON(inputs.ansible_test_targets) }} ansible-version: - - stable-2.9 - - stable-2.12 - stable-2.14 - stable-2.15 - milestone - devel python-version: - - "3.8" - - "3.9" - "3.11" exclude: ${{ fromJSON(inputs.matrix_exclude) }} include: ${{ fromJSON(inputs.matrix_include) }} From 44d8a4f64a376b88fd75e8ddad8dbeffdec4d8e1 Mon Sep 17 00:00:00 2001 From: Guido Grazioli Date: Wed, 29 Nov 2023 09:39:26 +0100 Subject: [PATCH 4/4] make sanity and unit matrix the same Signed-off-by: Guido Grazioli --- .github/workflows/ci.yml | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0f5919b..588e3e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,9 +45,6 @@ jobs: matrix_include: "[]" matrix_exclude: >- [ - { - "ansible-version": "stable-2.9" - }, { "ansible-version": "stable-2.12" }, @@ -64,11 +61,9 @@ jobs: "python-version": "3.9" }, { - "ansible-version": "stable-2.14", - "python-version": "3.12" + "python-version": "3.10" }, { - "ansible-version": "stable-2.15", "python-version": "3.12" } ] @@ -79,9 +74,6 @@ jobs: with: matrix_exclude: >- [ - { - "python-version": "3.10" - }, { "ansible-version": "stable-2.12" }, @@ -98,11 +90,9 @@ jobs: "python-version": "3.9" }, { - "ansible-version": "stable-2.14", - "python-version": "3.12" + "python-version": "3.10" }, { - "ansible-version": "stable-2.15", "python-version": "3.12" } ]