diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-26 06:22:16 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-26 06:22:16 +0000 |
commit | 0c70278249c356e314434985d3a92b4105c88872 (patch) | |
tree | f7e16f44fb8fc7a54f84d9977711c87d9e435666 /ansible_collections/kubernetes | |
parent | Adding debian version 10.0.1+dfsg-1. (diff) | |
download | ansible-0c70278249c356e314434985d3a92b4105c88872.tar.xz ansible-0c70278249c356e314434985d3a92b4105c88872.zip |
Merging upstream version 10.1.0+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/kubernetes')
16 files changed, 401 insertions, 21 deletions
diff --git a/ansible_collections/kubernetes/core/.ansible-lint-ignore b/ansible_collections/kubernetes/core/.ansible-lint-ignore new file mode 100644 index 000000000..b089a5a25 --- /dev/null +++ b/ansible_collections/kubernetes/core/.ansible-lint-ignore @@ -0,0 +1,2 @@ +# no-changed-when is not requried for examples +plugins/connection/kubectl.py no-changed-when diff --git a/ansible_collections/kubernetes/core/.github/workflows/integration-tests-kubevirt.yaml b/ansible_collections/kubernetes/core/.github/workflows/integration-tests-kubevirt.yaml new file mode 100644 index 000000000..aa6a1d548 --- /dev/null +++ b/ansible_collections/kubernetes/core/.github/workflows/integration-tests-kubevirt.yaml @@ -0,0 +1,127 @@ +name: Integration tests Kubevirt +on: + pull_request: + types: + - opened + - reopened + - synchronize + branches: + - main + - stable-* + +jobs: + splitter: + continue-on-error: true + env: + kubernetes: "./kubernetes" + kubevirt: "./kubevirt" + py_version: 3.9 + runs-on: ubuntu-latest + outputs: + test_targets: ${{ steps.splitter.outputs.kubevirt_targets }} + steps: + - name: Checkout kubernetes.core repository + uses: actions/checkout@v3 + with: + path: ${{ env.kubernetes }} + ref: ${{ github.event.pull_request.head.sha }} + + - name: Checkout the kubevirt.core collection + uses: actions/checkout@v3 + with: + repository: kubevirt/kubevirt.core + path: ${{ env.kubevirt }} + + - name: "Set up Python ${{ env.py_version }}" + uses: actions/setup-python@v4 + with: + python-version: "${{ env.py_version }}" + + - name: List targets from kubevirt.core collection + id: splitter + run: python ${{ env.kubernetes }}/tools/kubevirt_list_targets.py ${{ env.kubevirt }} + shell: bash + + integration: + if: ${{ needs.splitter.outputs.test_targets != '' }} + name: "integration-kubevirt-${{ matrix.test-target }}" + runs-on: ubuntu-latest + continue-on-error: true + needs: + - splitter + env: + kubernetes: "./kubernetes" + kubevirt: "./kubevirt" + ansible_version: milestone + python_version: 3.12 + strategy: + fail-fast: false + matrix: + test-target: ${{ fromJson(needs.splitter.outputs.test_targets) }} + steps: + - name: Checkout kubernetes.core repository + uses: actions/checkout@v4 + with: + path: ${{ env.kubernetes }} + ref: ${{ github.event.pull_request.head.sha }} + + - name: Checkout kubevirt.core repository + uses: actions/checkout@v4 + with: + repository: kubevirt/kubevirt.core + path: ${{ env.kubevirt }} + ref: main + + # Install ansible + - name: Install ansible-core (${{ env.ansible_version }}) + run: >- + python3 -m pip install + https://github.com/ansible/ansible/archive/${{ env.ansible_version }}.tar.gz + --disable-pip-version-check + shell: bash + + - name: Build and install kubevirt.core collection + id: install-kubevirt + uses: ansible-network/github_actions/.github/actions/build_install_collection@main + with: + install_python_dependencies: true + source_path: ${{ env.kubevirt }} + + - name: Build and install kubernetes.core collection + id: install-kubernetes + uses: ansible-network/github_actions/.github/actions/build_install_collection@main + with: + install_python_dependencies: true + source_path: ${{ env.kubernetes }} + + - name: Install kind / kubectl + uses: helm/kind-action@v1.9.0 + with: + version: v0.22.0 + install_only: true + + - name: Deploy kubevirt + run: >- + ${{ env.kubevirt }}/hack/e2e-setup.sh \ + -v \ + --configure-inotify-limits \ + --configure-secondary-network \ + --deploy-kubevirt \ + --deploy-kubevirt-cdi \ + --deploy-kubevirt-common-instancetypes \ + --deploy-cnao \ + --create-cluster \ + --create-nad + env: + KIND: kind + KUBECTL: kubectl + + - name: Run integration tests + uses: ansible-network/github_actions/.github/actions/ansible_test_integration@main + with: + collection_path: ${{ steps.install-kubevirt.outputs.collection_path }} + python_version: ${{ env.python_version }} + ansible_version: ${{ env.ansible_version }} + ansible_test_targets: ${{ matrix.test-target }} + env: + ANSIBLE_COLLECTIONS_PATHS: /home/runner/collections diff --git a/ansible_collections/kubernetes/core/CHANGELOG.rst b/ansible_collections/kubernetes/core/CHANGELOG.rst index f93c131fc..102ddcf74 100644 --- a/ansible_collections/kubernetes/core/CHANGELOG.rst +++ b/ansible_collections/kubernetes/core/CHANGELOG.rst @@ -4,6 +4,19 @@ Kubernetes Collection Release Notes .. contents:: Topics +v3.2.0 +====== + +Release Summary +--------------- +This release comes with documentation updates. + +Minor Changes +------------- + +- inventory/k8s.py - Defer removal of k8s inventory plugin to version 6.0.0 (https://github.com/ansible-collections/kubernetes.core/pull/734). +- connection/kubectl.py - Added an example of using the kubectl connection plugin to the documentation (https://github.com/ansible-collections/kubernetes.core/pull/741). + v3.1.0 ====== diff --git a/ansible_collections/kubernetes/core/FILES.json b/ansible_collections/kubernetes/core/FILES.json index 194bc9a29..498543b12 100644 --- a/ansible_collections/kubernetes/core/FILES.json +++ b/ansible_collections/kubernetes/core/FILES.json @@ -36,6 +36,13 @@ "format": 1 }, { + "name": ".github/workflows/integration-tests-kubevirt.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2dba23cfa19cfab6102648b679ad3d7129cb3658898110c304fbf39de2283788", + "format": 1 + }, + { "name": ".github/workflows/integration-tests.yaml", "ftype": "file", "chksum_type": "sha256", @@ -85,10 +92,31 @@ "format": 1 }, { + "name": "changelogs/fragments", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "changelogs/fragments/20240530-ansible-core-support-update.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "388f7f5ade9a2116bb1c3c83b188c842df1569faceca463687e067129ec26417", + "format": 1 + }, + { + "name": "changelogs/fragments/inventory-update_removal_date.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "696751970b01668168ca555359871e3b5c00ed6ebde834e318aea1b1c1c3be9b", + "format": 1 + }, + { "name": "changelogs/changelog.yaml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "a9dceb8816711232f8abe7c4507257d879f61468e572b7010c3f8f1f9f9a8bf2", + "chksum_sha256": "753b928c2066b441de64128abee4a313b60c8f94343b347abd1c443576a545b8", "format": 1 }, { @@ -263,7 +291,7 @@ "name": "docs/kubernetes.core.k8s_inventory.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "6d970818f092674dec18fdbbe88cce8c212ee6764a2d9682ccd16e82e6696023", + "chksum_sha256": "12710bd3a5b8fad92cb40b5932426e8224e0dee466a325ef37a566ac29e19784", "format": 1 }, { @@ -326,7 +354,7 @@ "name": "docs/kubernetes.core.kubectl_connection.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "9286d253650a63d78908c1525a78cca5adacdbbddbd41fc713302d3683724a9a", + "chksum_sha256": "f35da72b89833bb15d9791f4f229950749e16673febbc8ebca937abe50398095", "format": 1 }, { @@ -347,7 +375,7 @@ "name": "meta/runtime.yml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "7ea3ff6f907ecc449cbc9f2a327838184e129685588d9b9f4636c6448b35a7c8", + "chksum_sha256": "7a23c7787636e2cf2587c32356cd2ce1af9a84098d569673a28cf3b8b595f073", "format": 1 }, { @@ -487,7 +515,7 @@ "name": "plugins/connection/kubectl.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "08e05362470ad358e2f8336bf2d47bb91e841d4fb070e807b2e675b7a9ffeab2", + "chksum_sha256": "f612353a7be29507e8b54dcea222a95341596655e708b3934a092945578f1310", "format": 1 }, { @@ -592,7 +620,7 @@ "name": "plugins/inventory/k8s.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "27d1adb4227f2c07c9bd79d11909df1a7f577ad698340d5c9e956cf1b9e47293", + "chksum_sha256": "92b6c7ec15ffdd62f3f3f0f46284b03513ebc497408a5fac81aa3b4914b5bccc", "format": 1 }, { @@ -4796,6 +4824,20 @@ "format": 1 }, { + "name": "tools", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tools/kubevirt_list_targets.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "631f7ccaf6367b109574f3de3c344cf12120cf8689c59313ef8663a271b8a8c5", + "format": 1 + }, + { "name": ".ansible-lint", "ftype": "file", "chksum_type": "sha256", @@ -4803,6 +4845,13 @@ "format": 1 }, { + "name": ".ansible-lint-ignore", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4ac019f513db56ce83fc05ad85a0d5956642ce92c85936f5266dcc901dcb1025", + "format": 1 + }, + { "name": ".gitignore", "ftype": "file", "chksum_type": "sha256", @@ -4820,7 +4869,7 @@ "name": "CHANGELOG.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ab78cf4fb4f75175d5ddea647bf1e4a77c5ec5d0f204abb7ff7e06c08dca5c55", + "chksum_sha256": "9a446511a9384939b2dd0f404021372d07919164596ad7369289929939176ad9", "format": 1 }, { @@ -4841,7 +4890,7 @@ "name": "Makefile", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "72fce95837f17ca1375a1f2130a5b695e500f1ac1cb87942d51dd1a3ed99343b", + "chksum_sha256": "2a41ba68ffbb65f00cd8dce3df79f195cf78791159dc954f9b83b02805c9f89e", "format": 1 }, { @@ -4855,7 +4904,7 @@ "name": "README.md", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "690f7280c8733a5b793e7491c6234caaffae167e6a45637c416658fdd84fa0ec", + "chksum_sha256": "7a68d6074e036d0659f3f4dddaefc45c6c82a6f659c53ca99e89ca5838b6ad32", "format": 1 }, { diff --git a/ansible_collections/kubernetes/core/MANIFEST.json b/ansible_collections/kubernetes/core/MANIFEST.json index e4e7f12e9..6a42026e4 100644 --- a/ansible_collections/kubernetes/core/MANIFEST.json +++ b/ansible_collections/kubernetes/core/MANIFEST.json @@ -2,7 +2,7 @@ "collection_info": { "namespace": "kubernetes", "name": "core", - "version": "3.1.0", + "version": "3.2.0", "authors": [ "chouseknecht (https://github.com/chouseknecht)", "geerlingguy (https://www.jeffgeerling.com/)", @@ -36,7 +36,7 @@ "name": "FILES.json", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "497a265e1b9a279b5abb4fcb6acc3ad94db0ee0519969df4bf816c4a90b7b8cb", + "chksum_sha256": "d379854b52548bdd5dd202eb587c0b005e861f6e10f8d0120d34cfb61e789d06", "format": 1 }, "format": 1 diff --git a/ansible_collections/kubernetes/core/Makefile b/ansible_collections/kubernetes/core/Makefile index b76f3af50..23826b12c 100644 --- a/ansible_collections/kubernetes/core/Makefile +++ b/ansible_collections/kubernetes/core/Makefile @@ -1,5 +1,5 @@ # Also needs to be updated in galaxy.yml -VERSION = 3.0.0 +VERSION = 3.2.0 TEST_ARGS ?= "" PYTHON_VERSION ?= `python -c 'import platform; print(".".join(platform.python_version_tuple()[0:2]))'` diff --git a/ansible_collections/kubernetes/core/README.md b/ansible_collections/kubernetes/core/README.md index 67993a06e..f5a8d604d 100644 --- a/ansible_collections/kubernetes/core/README.md +++ b/ansible_collections/kubernetes/core/README.md @@ -93,7 +93,7 @@ You can also include it in a `requirements.yml` file and install it via `ansible --- collections: - name: kubernetes.core - version: 3.0.0 + version: 3.2.0 ``` ### Installing the Kubernetes Python Library diff --git a/ansible_collections/kubernetes/core/changelogs/changelog.yaml b/ansible_collections/kubernetes/core/changelogs/changelog.yaml index a6a689887..84adc471a 100644 --- a/ansible_collections/kubernetes/core/changelogs/changelog.yaml +++ b/ansible_collections/kubernetes/core/changelogs/changelog.yaml @@ -854,3 +854,14 @@ releases: - 652-fix-json-patch-action.yml - 654-helm-expand-user.yml release_date: '2024-05-16' + 3.2.0: + changes: + minor_changes: + - inventory/k8s.py - Defer removal of k8s inventory plugin to version 6.0.0 (https://github.com/ansible-collections/kubernetes.core/pull/734). + - connection/kubectl.py - Added an example of using the kubectl connection plugin to the documentation (https://github.com/ansible-collections/kubernetes.core/pull/741). + release_summary: This release comes with documentation updates. + fragments: + - 20240530-defer-removal-and-ansible-core-support-update.yaml + - 20240601-doc-example-of-using-kubectl.yaml + - 3.2.0.yml + release_date: '2024-06-14' diff --git a/ansible_collections/kubernetes/core/changelogs/fragments/20240530-ansible-core-support-update.yaml b/ansible_collections/kubernetes/core/changelogs/fragments/20240530-ansible-core-support-update.yaml new file mode 100644 index 000000000..2efafc042 --- /dev/null +++ b/ansible_collections/kubernetes/core/changelogs/fragments/20240530-ansible-core-support-update.yaml @@ -0,0 +1,3 @@ +--- +minor_changes: + - inventory/k8s.py - Defer removal of k8s inventory plugin to version 6.0.0 (https://github.com/ansible-collections/kubernetes.core/pull/734). diff --git a/ansible_collections/kubernetes/core/changelogs/fragments/inventory-update_removal_date.yml b/ansible_collections/kubernetes/core/changelogs/fragments/inventory-update_removal_date.yml new file mode 100644 index 000000000..3ef687d5e --- /dev/null +++ b/ansible_collections/kubernetes/core/changelogs/fragments/inventory-update_removal_date.yml @@ -0,0 +1,2 @@ +minor_changes: + - inventory/k8s.py - Defer removal of k8s inventory plugin to version 5.0 (https://github.com/ansible-collections/kubernetes.core/pull/723). diff --git a/ansible_collections/kubernetes/core/docs/kubernetes.core.k8s_inventory.rst b/ansible_collections/kubernetes/core/docs/kubernetes.core.k8s_inventory.rst index 7a8cfd62a..727027408 100644 --- a/ansible_collections/kubernetes/core/docs/kubernetes.core.k8s_inventory.rst +++ b/ansible_collections/kubernetes/core/docs/kubernetes.core.k8s_inventory.rst @@ -17,7 +17,7 @@ DEPRECATED ---------- :Removed in collection release after :Why: As discussed in https://github.com/ansible-collections/kubernetes.core/issues/31, we decided to -remove the k8s inventory plugin in release 4.0.0. +remove the k8s inventory plugin in release 6.0.0. :Alternative: Use :ref:`kubernetes.core.k8s_info <kubernetes.core.k8s_info_module>` and :ref:`ansible.builtin.add_host <ansible.builtin.add_host_module>` instead. @@ -357,7 +357,7 @@ Status ------ -- This inventory will be removed in version 4.0.0. *[deprecated]* +- This inventory will be removed in version 6.0.0. *[deprecated]* - For more information see `DEPRECATED`_. diff --git a/ansible_collections/kubernetes/core/docs/kubernetes.core.kubectl_connection.rst b/ansible_collections/kubernetes/core/docs/kubernetes.core.kubectl_connection.rst index 48db35992..97e60f9cd 100644 --- a/ansible_collections/kubernetes/core/docs/kubernetes.core.kubectl_connection.rst +++ b/ansible_collections/kubernetes/core/docs/kubernetes.core.kubectl_connection.rst @@ -365,6 +365,82 @@ Parameters +Examples +-------- + +.. code-block:: yaml + + - name: Run a command in a pod using local kubectl with kubeconfig file ~/.kube/config + hosts: localhost + gather_facts: no + vars: + ansible_connection: kubernetes.core.kubectl + ansible_kubectl_namespace: my-namespace + ansible_kubectl_pod: my-pod + ansible_kubectl_container: my-container + tasks: + # be aware that the command is executed as the user that started the container + # and requires python to be installed in the image + - name: Run a command in a pod + ansible.builtin.command: echo "Hello, World!" + + - name: Run a command in a pod using local kubectl with inventory variables + # Example inventory: + # k8s: + # hosts: + # foo.example.com: + # ansible_connection: kubernetes.core.kubectl + # ansible_kubectl_kubeconfig: /root/.kube/foo.example.com.config + # ansible_kubectl_pod: my-foo-pod + # ansible_kubectl_container: my-foo-container + # ansible_kubectl_namespace: my-foo-namespace + # bar.example.com: + # ansible_connection: kubernetes.core.kubectl + # ansible_kubectl_kubeconfig: /root/.kube/bar.example.com.config + # ansible_kubectl_pod: my-bar-pod + # ansible_kubectl_container: my-bar-container + # ansible_kubectl_namespace: my-bar-namespace + hosts: k8s + gather_facts: no + tasks: + # be aware that the command is executed as the user that started the container + # and requires python to be installed in the image + - name: Run a command in a pod + ansible.builtin.command: echo "Hello, World!" + + - name: Run a command in a pod using dynamic inventory + hosts: localhost + gather_facts: no + vars: + kubeconfig: /root/.kube/config + namespace: my-namespace + my_app: my-app + tasks: + - name: Get My App pod info based on label + kubernetes.core.k8s_info: + kubeconfig: "{{ kubeconfig }}" + namespace: "{{ namespace }}" + kind: Pod + label_selectors: app.kubernetes.io/name = "{{ my_app }}" + register: my_app_pod + + - name: Get My App pod name + ansible.builtin.set_fact: + my_app_pod_name: "{{ my_app_pod.resources[0].metadata.name }}" + + - name: Add My App pod to inventory + ansible.builtin.add_host: + name: "{{ my_app_pod_name }}" + ansible_connection: kubernetes.core.kubectl + ansible_kubectl_kubeconfig: "{{ kubeconfig }}" + ansible_kubectl_pod: "{{ my_app_pod_name }}" + ansible_kubectl_namespace: "{{ namespace }}" + + - name: Run a command in My App pod + # be aware that the command is executed as the user that started the container + # and requires python to be installed in the image + ansible.builtin.command: echo "Hello, World!" + delegate_to: "{{ my_app_pod_name }}" diff --git a/ansible_collections/kubernetes/core/meta/runtime.yml b/ansible_collections/kubernetes/core/meta/runtime.yml index 99134a2c3..d9cb09984 100644 --- a/ansible_collections/kubernetes/core/meta/runtime.yml +++ b/ansible_collections/kubernetes/core/meta/runtime.yml @@ -22,10 +22,10 @@ plugin_routing: redirect: community.okd.openshift k8s: deprecation: - removal_version: 4.0.0 + removal_version: 6.0.0 warning_text: >- The k8s inventory plugin has been deprecated and - will be removed in release 4.0.0. + will be removed in release 6.0.0. modules: k8s_auth: redirect: community.okd.k8s_auth diff --git a/ansible_collections/kubernetes/core/plugins/connection/kubectl.py b/ansible_collections/kubernetes/core/plugins/connection/kubectl.py index 2a5e1b988..47953845b 100644 --- a/ansible_collections/kubernetes/core/plugins/connection/kubectl.py +++ b/ansible_collections/kubernetes/core/plugins/connection/kubectl.py @@ -181,6 +181,81 @@ DOCUMENTATION = r""" aliases: [ kubectl_verify_ssl ] """ +EXAMPLES = r""" + +- name: Run a command in a pod using local kubectl with kubeconfig file ~/.kube/config + hosts: localhost + gather_facts: no + vars: + ansible_connection: kubernetes.core.kubectl + ansible_kubectl_namespace: my-namespace + ansible_kubectl_pod: my-pod + ansible_kubectl_container: my-container + tasks: + # be aware that the command is executed as the user that started the container + # and requires python to be installed in the image + - name: Run a command in a pod + ansible.builtin.command: echo "Hello, World!" + +- name: Run a command in a pod using local kubectl with inventory variables + # Example inventory: + # k8s: + # hosts: + # foo.example.com: + # ansible_connection: kubernetes.core.kubectl + # ansible_kubectl_kubeconfig: /root/.kube/foo.example.com.config + # ansible_kubectl_pod: my-foo-pod + # ansible_kubectl_container: my-foo-container + # ansible_kubectl_namespace: my-foo-namespace + # bar.example.com: + # ansible_connection: kubernetes.core.kubectl + # ansible_kubectl_kubeconfig: /root/.kube/bar.example.com.config + # ansible_kubectl_pod: my-bar-pod + # ansible_kubectl_container: my-bar-container + # ansible_kubectl_namespace: my-bar-namespace + hosts: k8s + gather_facts: no + tasks: + # be aware that the command is executed as the user that started the container + # and requires python to be installed in the image + - name: Run a command in a pod + ansible.builtin.command: echo "Hello, World!" + +- name: Run a command in a pod using dynamic inventory + hosts: localhost + gather_facts: no + vars: + kubeconfig: /root/.kube/config + namespace: my-namespace + my_app: my-app + tasks: + - name: Get My App pod info based on label + kubernetes.core.k8s_info: + kubeconfig: "{{ kubeconfig }}" + namespace: "{{ namespace }}" + kind: Pod + label_selectors: app.kubernetes.io/name = "{{ my_app }}" + register: my_app_pod + + - name: Get My App pod name + ansible.builtin.set_fact: + my_app_pod_name: "{{ my_app_pod.resources[0].metadata.name }}" + + - name: Add My App pod to inventory + ansible.builtin.add_host: + name: "{{ my_app_pod_name }}" + ansible_connection: kubernetes.core.kubectl + ansible_kubectl_kubeconfig: "{{ kubeconfig }}" + ansible_kubectl_pod: "{{ my_app_pod_name }}" + ansible_kubectl_namespace: "{{ namespace }}" + + - name: Run a command in My App pod + # be aware that the command is executed as the user that started the container + # and requires python to be installed in the image + ansible.builtin.command: echo "Hello, World!" + delegate_to: "{{ my_app_pod_name }}" +""" + import json import os import os.path diff --git a/ansible_collections/kubernetes/core/plugins/inventory/k8s.py b/ansible_collections/kubernetes/core/plugins/inventory/k8s.py index 1a6c5bfce..37ef90a15 100644 --- a/ansible_collections/kubernetes/core/plugins/inventory/k8s.py +++ b/ansible_collections/kubernetes/core/plugins/inventory/k8s.py @@ -20,10 +20,10 @@ DOCUMENTATION = """ - Uses k8s.(yml|yaml) YAML configuration file to set parameter values. deprecated: - removed_in: 4.0.0 + removed_in: 6.0.0 why: | As discussed in U(https://github.com/ansible-collections/kubernetes.core/issues/31), we decided to - remove the k8s inventory plugin in release 4.0.0. + remove the k8s inventory plugin in release 6.0.0. alternative: "Use M(kubernetes.core.k8s_info) and M(ansible.builtin.add_host) instead." options: @@ -164,8 +164,8 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): super(InventoryModule, self).parse(inventory, loader, path) self.display.deprecated( - "The 'k8s' inventory plugin has been deprecated and will be removed in release 4.0.0", - version="4.0.0", + "The 'k8s' inventory plugin has been deprecated and will be removed in release 6.0.0", + version="6.0.0", collection_name="kubernetes.core", ) cache_key = self._get_cache_prefix(path) diff --git a/ansible_collections/kubernetes/core/tools/kubevirt_list_targets.py b/ansible_collections/kubernetes/core/tools/kubevirt_list_targets.py new file mode 100644 index 000000000..0692cc348 --- /dev/null +++ b/ansible_collections/kubernetes/core/tools/kubevirt_list_targets.py @@ -0,0 +1,22 @@ +import os +import sys +from pathlib import PosixPath + + +def main(): + + src = sys.argv[1] + path = PosixPath(src) / PosixPath("tests/integration/targets/") + + def _is_disable(path): + flags = ("unsupported", "disabled", "unstable", "hidden") + aliases_path = path / PosixPath("aliases") + return (aliases_path.exists() and any((d.startswith(flags) for d in aliases_path.read_text().split("\n")))) + + targets = [i.stem for i in path.glob("*") if i.is_dir() and not _is_disable(i)] + with open(os.environ.get("GITHUB_OUTPUT"), "a", encoding="utf-8") as fw: + fw.write(f"kubevirt_targets={targets}\n") + + +if __name__ == "__main__": + main() |