diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-18 05:52:22 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-18 05:52:22 +0000 |
commit | 38b7c80217c4e72b1d8988eb1e60bb6e77334114 (patch) | |
tree | 356e9fd3762877d07cde52d21e77070aeff7e789 /ansible_collections/kubernetes | |
parent | Adding upstream version 7.7.0+dfsg. (diff) | |
download | ansible-38b7c80217c4e72b1d8988eb1e60bb6e77334114.tar.xz ansible-38b7c80217c4e72b1d8988eb1e60bb6e77334114.zip |
Adding upstream version 9.4.0+dfsg.upstream/9.4.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/kubernetes')
36 files changed, 586 insertions, 302 deletions
diff --git a/ansible_collections/kubernetes/core/.ansible-lint b/ansible_collections/kubernetes/core/.ansible-lint new file mode 100644 index 000000000..f139e6a02 --- /dev/null +++ b/ansible_collections/kubernetes/core/.ansible-lint @@ -0,0 +1,7 @@ +--- +profile: production +skip_list: + - meta-runtime[unsupported-version] +exclude_paths: + - tests/integration + - tests/sanity diff --git a/ansible_collections/kubernetes/core/.github/stale.yml b/ansible_collections/kubernetes/core/.github/stale.yml index 230cf78a6..4c7afd27e 100644 --- a/ansible_collections/kubernetes/core/.github/stale.yml +++ b/ansible_collections/kubernetes/core/.github/stale.yml @@ -12,7 +12,6 @@ daysUntilClose: 30 # Only issues or pull requests with all of these labels are check if stale. # Defaults to `[]` (disabled) onlyLabels: [] - # Issues or Pull Requests with these labels will never be considered stale. Set # to `[]` to disable exemptLabels: diff --git a/ansible_collections/kubernetes/core/.github/workflows/changelog.yaml b/ansible_collections/kubernetes/core/.github/workflows/changelog.yaml new file mode 100644 index 000000000..b59768b41 --- /dev/null +++ b/ansible_collections/kubernetes/core/.github/workflows/changelog.yaml @@ -0,0 +1,21 @@ +--- +name: Changelog +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + pull_request: + types: + - opened + - reopened + - labeled + - unlabeled + - synchronize + branches: + - main + - stable-* + +jobs: + changelog: + uses: ansible-network/github_actions/.github/workflows/changelog.yml@main diff --git a/ansible_collections/kubernetes/core/.github/workflows/galaxy-import.yaml b/ansible_collections/kubernetes/core/.github/workflows/galaxy-import.yaml new file mode 100644 index 000000000..9c21824e3 --- /dev/null +++ b/ansible_collections/kubernetes/core/.github/workflows/galaxy-import.yaml @@ -0,0 +1,14 @@ +name: galaxy-import +concurrency: + group: ${{ github.head_ref }} + cancel-in-progress: true + +on: + pull_request: + branches: + - main + - stable-* + +jobs: + galaxy_importer: + uses: ansible-network/github_actions/.github/workflows/galaxy_importer.yml@main diff --git a/ansible_collections/kubernetes/core/.github/workflows/integration-tests.yaml b/ansible_collections/kubernetes/core/.github/workflows/integration-tests.yaml new file mode 100644 index 000000000..4323bf87d --- /dev/null +++ b/ansible_collections/kubernetes/core/.github/workflows/integration-tests.yaml @@ -0,0 +1,146 @@ +name: Integration tests +on: + pull_request: + types: + - opened + - reopened + - labeled + - unlabeled + - synchronize + branches: + - main + - stable-* + +jobs: + splitter: + env: + source_dir: "./source" + runs-on: ubuntu-latest + outputs: + test_targets: ${{ steps.splitter.outputs.test_targets }} + test_targets_json: ${{ steps.splitter.outputs.test_targets_json }} + test_jobs: ${{ steps.splitter.outputs.test_jobs }} + steps: + - name: Checkout the collection repository + uses: actions/checkout@v3 + with: + path: ${{ env.source_dir }} + fetch-depth: "0" + + - name: list changes for pull request + id: splitter + uses: ansible-network/github_actions/.github/actions/ansible_test_splitter@main + with: + collections_to_test: ${{ env.source_dir }} + total_jobs: 8 + + - name: Display splitter output + run: | + echo "test_targets=${{ steps.splitter.outputs.test_targets }}" + echo "test_targets_json=${{ steps.splitter.outputs.test_targets_json }}" + echo "test_jobs=${{ steps.splitter.outputs.test_jobs }}" + shell: bash + integration: + runs-on: ubuntu-latest + timeout-minutes: 60 + needs: + - splitter + if: ${{ needs.splitter.outputs.test_targets != '' }} + env: + source: "./source" + cloud_common: "./cloudcommon" + ansible_posix: "./ansible_posix" + strategy: + fail-fast: false + matrix: + ansible-version: + - milestone + python-version: + - "3.12" + enable-turbo-mode: + - true + - false + workflow-id: ${{ fromJson(needs.splitter.outputs.test_jobs) }} + name: "integration-py${{ matrix.python-version }}-${{ matrix.ansible-version }}-${{ matrix.workflow-id }}" + steps: + - name: Read target + id: read-targets + run: | + import json, os + with open(os.environ.get('GITHUB_OUTPUT'), "a", encoding="utf-8") as fh: + fh.write(f'ansible_test_targets={json.loads(os.environ.get("ALL_TEST_TARGETS")).get(os.environ.get("WORKFLOW_ID"))}\n') + shell: python + env: + ALL_TEST_TARGETS: ${{ needs.splitter.outputs.test_targets_json }} + WORKFLOW_ID: ${{ matrix.workflow-id }} + + - name: Display ansible test targets + run: | + echo "ansible_test_targets -> ${{ steps.read-targets.outputs.ansible_test_targets }}" + + - name: Checkout kubernetes.core repository + uses: actions/checkout@v3 + with: + path: ${{ env.source }} + ref: ${{ github.event.pull_request.head.sha }} + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + # install ansible + - name: Install ansible-core (${{ matrix.ansible-version }}) + run: >- + python3 -m pip install + https://github.com/ansible/ansible/archive/${{ matrix.ansible-version }}.tar.gz + --disable-pip-version-check + shell: bash + + - name: Build and install collection + id: install-src + uses: ansible-network/github_actions/.github/actions/build_install_collection@main + with: + install_python_dependencies: true + source_path: ${{ env.source }} + + - name: checkout ansible-collections/cloud.common + uses: ansible-network/github_actions/.github/actions/checkout_dependency@main + with: + repository: ansible-collections/cloud.common + path: ${{ env.cloud_common }} + ref: main + + - name: checkout ansible-collections/ansible.posix + uses: ansible-network/github_actions/.github/actions/checkout_dependency@main + with: + repository: ansible-collections/ansible.posix + path: ${{ env.ansible_posix }} + ref: main + + - name: install cloud.common collection + uses: ansible-network/github_actions/.github/actions/build_install_collection@main + with: + install_python_dependencies: true + source_path: ${{ env.cloud_common }} + + - name: install ansible.posix collection + uses: ansible-network/github_actions/.github/actions/build_install_collection@main + with: + install_python_dependencies: true + source_path: ${{ env.ansible_posix }} + + - name: create kubernetes cluster + uses: helm/kind-action@v1.8.0 + with: + node_image: "kindest/node:v1.29.2" + + - name: Run integration tests + uses: ansible-network/github_actions/.github/actions/ansible_test_integration@main + with: + collection_path: ${{ steps.install-src.outputs.collection_path }} + python_version: ${{ matrix.python-version }} + ansible_version: ${{ matrix.ansible-version }} + ansible_test_targets: ${{ steps.read-targets.outputs.ansible_test_targets }} + ansible_test_environment: | + ENABLE_TURBO_MODE=${{ matrix.enable-turbo-mode }} diff --git a/ansible_collections/kubernetes/core/.github/workflows/linters.yaml b/ansible_collections/kubernetes/core/.github/workflows/linters.yaml new file mode 100644 index 000000000..589bfa786 --- /dev/null +++ b/ansible_collections/kubernetes/core/.github/workflows/linters.yaml @@ -0,0 +1,24 @@ +--- +name: Linters +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + pull_request: + branches: + - main + - stable-* + tags: + - "*" + +jobs: + linters: + uses: ansible-network/github_actions/.github/workflows/tox-linters.yml@main + ansible-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Run ansible-lint + uses: ansible/ansible-lint@v6.21.0 diff --git a/ansible_collections/kubernetes/core/.github/workflows/sanity-tests.yaml b/ansible_collections/kubernetes/core/.github/workflows/sanity-tests.yaml new file mode 100644 index 000000000..044f6def1 --- /dev/null +++ b/ansible_collections/kubernetes/core/.github/workflows/sanity-tests.yaml @@ -0,0 +1,15 @@ +--- +name: Sanity tests +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + pull_request: + branches: + - main + - stable-* + +jobs: + sanity: + uses: ansible-network/github_actions/.github/workflows/sanity.yml@main diff --git a/ansible_collections/kubernetes/core/.github/workflows/unit-tests.yaml b/ansible_collections/kubernetes/core/.github/workflows/unit-tests.yaml new file mode 100644 index 000000000..3f4ed52cd --- /dev/null +++ b/ansible_collections/kubernetes/core/.github/workflows/unit-tests.yaml @@ -0,0 +1,15 @@ +--- +name: Unit tests +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + pull_request: + branches: + - main + - stable-* + +jobs: + unit-source: + uses: ansible-network/github_actions/.github/workflows/unit_source.yml@main diff --git a/ansible_collections/kubernetes/core/CHANGELOG.rst b/ansible_collections/kubernetes/core/CHANGELOG.rst index bfb1a1b1b..1cad02814 100644 --- a/ansible_collections/kubernetes/core/CHANGELOG.rst +++ b/ansible_collections/kubernetes/core/CHANGELOG.rst @@ -4,6 +4,26 @@ Kubernetes Collection Release Notes .. contents:: Topics +v2.4.2 +====== + +Release Summary +--------------- + +fix resource discovery when complex subresources present + +Bugfixes +-------- + +- Resolve Collections util resource discovery fails when complex subresources present (https://github.com/ansible-collections/kubernetes.core/pull/676). + +v2.4.1 +====== + +Release Summary +--------------- + +The kubernetes.core 2.4.1 release includes several trivial bug fixes related to code sanity. v2.4.0 ====== diff --git a/ansible_collections/kubernetes/core/FILES.json b/ansible_collections/kubernetes/core/FILES.json index edb69b206..df7a884ae 100644 --- a/ansible_collections/kubernetes/core/FILES.json +++ b/ansible_collections/kubernetes/core/FILES.json @@ -15,6 +15,55 @@ "format": 1 }, { + "name": ".github/workflows", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": ".github/workflows/changelog.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "182c1a38dcbc86b1c42de83fb0d10bd97291d9962cc49c1f7b28557296da6d17", + "format": 1 + }, + { + "name": ".github/workflows/galaxy-import.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "657326d88c57be4dfb276a9d7822ef5be081206aac5f01151e9ea83d206e7bd8", + "format": 1 + }, + { + "name": ".github/workflows/integration-tests.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "69096ca88a1e68ae3598bb99fe530f7070f20757e4c1a0866211bd59d82997dd", + "format": 1 + }, + { + "name": ".github/workflows/linters.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "079c550400fd4af5ae0bb846395300fb193163bcc9269a572bafd3e4bc8b2e06", + "format": 1 + }, + { + "name": ".github/workflows/sanity-tests.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "dca231b5e34e9bf61fb9bac10a94e1e8dabf9ebcf4189574fd43f953f60d1bbb", + "format": 1 + }, + { + "name": ".github/workflows/unit-tests.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "75fa5cf2ecf4f35b5b297c33fd1bd4ac17fcfff8061c784dcb4999190b7c1467", + "format": 1 + }, + { "name": ".github/patchback.yml", "ftype": "file", "chksum_type": "sha256", @@ -25,7 +74,7 @@ "name": ".github/stale.yml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "923b49f6fb8b325ea890d05a42537b3f9c5aaf26b64a704c0fef4b696aa6a4bb", + "chksum_sha256": "aa6e60574b9fcbe36ec409ac30cc81977a2d97f2ee40335144ca5303cca983d3", "format": 1 }, { @@ -39,14 +88,14 @@ "name": "changelogs/changelog.yaml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "e116a242c550ab4f2dde8c5d0db5f75085b34a39160cfa6c3ffd180d21b4c07e", + "chksum_sha256": "3393f1a989678a4b8583a8dcc30ff7d2c15374ebf48b676539a18ccc6fa5ec00", "format": 1 }, { "name": "changelogs/config.yaml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "2903835efadf1f03f8a05ba8428d1530259e322d039dcd3edbe707bcaea82e3d", + "chksum_sha256": "d32a71362725ba6d9cc3d550e9b7f5f338c6692e7840c052c87263d069a1afc4", "format": 1 }, { @@ -298,7 +347,7 @@ "name": "meta/runtime.yml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "234b418a0a39617e8ab74b92c221dddf0b8705b36fc755c0ba70d8e070809365", + "chksum_sha256": "84ea6841db16c04017807462ccb97131474b0a11d75d7b70233f3ae712983121", "format": 1 }, { @@ -522,7 +571,7 @@ "name": "plugins/filter/k8s.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "1732300a6c48e6e6e678ea2b1dffb4a22779c6c7fe04f9fe64fd397df08af7c1", + "chksum_sha256": "62fc604b3650ef08387c5127ec9f107d3e0bbd5019a3dcee49fdc77558bb59d1", "format": 1 }, { @@ -543,7 +592,7 @@ "name": "plugins/inventory/k8s.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "246cedb5fb08aa567cb266fcf9ac6513dffaa68ea75e33e8f2fa7e23cb12f9d5", + "chksum_sha256": "69faaca6259bbc1850c5efa053b84de457efc8b32e1ee8ce13cb0b815c8e52c8", "format": 1 }, { @@ -585,7 +634,7 @@ "name": "plugins/module_utils/client/discovery.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "9e91dfdcba133e090d1cba79f827ee09ed1a3915eee3e08b526e79ccdcac37c1", + "chksum_sha256": "f9af2ebc4962d187531400fb80e34168c9d35412b7045c8c27ab1330d59852cf", "format": 1 }, { @@ -774,7 +823,7 @@ "name": "plugins/modules/helm_info.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "5aa8e19162522752cd1625cd2953a2d4dfcad29dfb08607d28a62e0929aec8f8", + "chksum_sha256": "7f2140cb6d7a692eed5feb96859e0099e23b497cd377a91c51579e5dc361d182", "format": 1 }, { @@ -809,14 +858,14 @@ "name": "plugins/modules/helm_template.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "c9b5f60a07127da4cdf139bbd83fe728aa66320ae644a1906a39fb87a871502d", + "chksum_sha256": "fee5bdfcf7a99492b9b5dc4c86e62505b87d79c76450e09bbb323915aab5848f", "format": 1 }, { "name": "plugins/modules/k8s.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "efeb2745cafcf037d68b0a8b7594cd30e2743bddcaed073a864854ede685e162", + "chksum_sha256": "61802b08c5cebba766fb8a9f2d950aad7a8eff2489eb5958d6dd1d897884fc90", "format": 1 }, { @@ -837,7 +886,7 @@ "name": "plugins/modules/k8s_drain.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "c5aa3613e22210c8800b69cdf2dd6847d743efa9fde99a13df60f86a6c2068a1", + "chksum_sha256": "8501728be21a5dea5f91fd97ea5cc1f840a85d8a545899f026d2bc5971b306db", "format": 1 }, { @@ -851,7 +900,7 @@ "name": "plugins/modules/k8s_info.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "f1c5cefb218b7fc7887213a8905385a9627c02fd228b91238c72061ea6da0cf3", + "chksum_sha256": "b7b67467c41866e95eac0c74f914ce0f5c073d4fbb1c2ca93cfc310d31384049", "format": 1 }, { @@ -865,21 +914,21 @@ "name": "plugins/modules/k8s_log.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "4907cd48fae87e481961f29edea0dd460071d73513c3d5bae85dc63d882f4b5e", + "chksum_sha256": "d855aec3ee0be16af005b6371e2eb887f6eca8983af4d520d6a6733246540b53", "format": 1 }, { "name": "plugins/modules/k8s_rollback.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ee962569276d6117500f57ef2bac32e3dc75940855e2f351738318e6700ebd3a", + "chksum_sha256": "e9ff60598e33faa157b6c4c04e95002a162becd56286400cb9aaa7c5432f1cfe", "format": 1 }, { "name": "plugins/modules/k8s_scale.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "5486c6a62a1d27585485bef37fb5abde8a477543f7a37c6e42e5d4d65bcd8730", + "chksum_sha256": "c4a04c19741cd4834c8a1926790fc0d94e7fbea8c3e15daa42ac47da4bd63049", "format": 1 }, { @@ -1404,7 +1453,7 @@ "name": "tests/integration/targets/helm_kubeconfig/tasks/main.yml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "fed1323a4ae00ebe0c13dda54739ccf4d2188a901d5a27080594e9c54d16d498", + "chksum_sha256": "da6953ab37904ab1df2edee39e4c2c59e64b4540a56d2bccdf08bdc15a38de9d", "format": 1 }, { @@ -2710,10 +2759,17 @@ "format": 1 }, { + "name": "tests/integration/targets/k8s_info/tasks/discovery.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8c16d8f2445fe4b267729566f9a63211da7ddafb2bbf01ecd641132a1016d474", + "format": 1 + }, + { "name": "tests/integration/targets/k8s_info/tasks/main.yml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "f4b0280dda29909d09c166ef0a976a405593b8536cc158ea6bf75d4841369dc7", + "chksum_sha256": "885f11cd528e55717d031992fbeab92c6e11cd02736682cf405e3ff708482ff1", "format": 1 }, { @@ -3854,28 +3910,35 @@ "name": "tests/sanity/ignore-2.14.txt", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "c108894b090a50da8f307726409f3055b481d5ee255f2932c1d52bae72d50058", + "chksum_sha256": "42e419caf846ed0dcc02202e9a4b75591f31dabc45c730e182d4c5a3d915be82", "format": 1 }, { "name": "tests/sanity/ignore-2.15.txt", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "459348e18aabc4f5a164df89f028a7c736551ad166e14e24924a209cab0e52bf", + "chksum_sha256": "d3d41bd605b43a4f205532a2b699580a36949428e269d7ab38f0e117a8f6714b", "format": 1 }, { - "name": "tests/sanity/ignore-2.9.txt", + "name": "tests/sanity/ignore-2.16.txt", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "f81ba55b45ea34f4fe65ecaba048fb917867bd7b87b020069ddb83f145179391", + "chksum_sha256": "1dccc6da515a13558fab57a5c95645e064f7f2592db56bcb145d758e45991363", + "format": 1 + }, + { + "name": "tests/sanity/ignore-2.17.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "cabeaf26387322db20141d82f01d2718ea57b23b18fb71e493c837370a087e32", "format": 1 }, { - "name": "tests/sanity/refresh_ignore_files", + "name": "tests/sanity/ignore-2.9.txt", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "f4caf94f5cdc9e95d6761febbbd1a5b0632777c5fe1baf12e070c172da887d65", + "chksum_sha256": "f81ba55b45ea34f4fe65ecaba048fb917867bd7b87b020069ddb83f145179391", "format": 1 }, { @@ -4089,6 +4152,13 @@ "format": 1 }, { + "name": ".ansible-lint", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c7f042498988069158af67d1654477ba2897c44f7a54120aada6d2c3e5355628", + "format": 1 + }, + { "name": ".gitignore", "ftype": "file", "chksum_type": "sha256", @@ -4106,7 +4176,7 @@ "name": "CHANGELOG.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "e7d76b349ab603ebc12c9b49cf98017e88a9b8ba1bda3a26a00aa664b9fb2594", + "chksum_sha256": "7d39ea37e36b9eef78ec1515b8f4270b36e4847f58d0bee7fdd7bfa08abb0181", "format": 1 }, { @@ -4127,7 +4197,7 @@ "name": "Makefile", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "bec33eed95fe1d63e3fb0a9085318d6916c24eb6de43f0c34ed9dc4e3b678c50", + "chksum_sha256": "cc231a95d40d0f7a28d49ea378be431e9c0b046bdc70bc79fb34e2623aaf102c", "format": 1 }, { @@ -4141,7 +4211,7 @@ "name": "README.md", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "96e8d2d129338de73a45a8957e505822a152b8265c870fb6a92cd6e35bb4e30d", + "chksum_sha256": "4a5e2a68aa595990f3ca1921ee2a6140f065e71d1bfcc145c56de532e452124f", "format": 1 }, { @@ -4176,7 +4246,7 @@ "name": "test-requirements.txt", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "5f2d972c940f041edc9dd2affe30bf4dd1543e35a471125dafce1f5b64026767", + "chksum_sha256": "cef79683bee30761bfe5273e66a8545ffb3d8788037274ed986d17174f799c3e", "format": 1 }, { diff --git a/ansible_collections/kubernetes/core/MANIFEST.json b/ansible_collections/kubernetes/core/MANIFEST.json index 37be7493a..a965e0179 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": "2.4.0", + "version": "2.4.2", "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": "67908745863fefe0495eee77399178e88b89bb04a19fc728d2ac83a4d93abd1a", + "chksum_sha256": "ddf0469e4a5072f0670d71f80bac5f570bff4361f4db80f2b517e8ef2b7a7eb1", "format": 1 }, "format": 1 diff --git a/ansible_collections/kubernetes/core/Makefile b/ansible_collections/kubernetes/core/Makefile index 3f7a41843..77ca0d25f 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 = 2.4.0 +VERSION = 2.4.1 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 89f520795..95b0d05d3 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: 2.4.0 + version: 2.4.1 ``` ### Installing the Kubernetes Python Library diff --git a/ansible_collections/kubernetes/core/changelogs/changelog.yaml b/ansible_collections/kubernetes/core/changelogs/changelog.yaml index f070f5105..13f227875 100644 --- a/ansible_collections/kubernetes/core/changelogs/changelog.yaml +++ b/ansible_collections/kubernetes/core/changelogs/changelog.yaml @@ -762,3 +762,20 @@ releases: name: helm_pull namespace: '' release_date: '2023-01-24' + 2.4.1: + changes: + release_summary: The kubernetes.core 2.4.1 release includes several trivial + bug fixes related to sanity. + fragments: + - fix_sanity_errors.yml + release_date: '2024-02-06' + 2.4.2: + changes: + bugfixes: + - Resolve Collections util resource discovery fails when complex subresources + present (https://github.com/ansible-collections/kubernetes.core/pull/676). + release_summary: fix resource discovery when complex subresources present + fragments: + - 2.4.2.yml + - 20240222-Collections-util-resource-discovery-fails-when-complex-subresources-present.yml + release_date: '2024-03-01' diff --git a/ansible_collections/kubernetes/core/changelogs/config.yaml b/ansible_collections/kubernetes/core/changelogs/config.yaml index 69554b846..138225941 100644 --- a/ansible_collections/kubernetes/core/changelogs/config.yaml +++ b/ansible_collections/kubernetes/core/changelogs/config.yaml @@ -10,21 +10,21 @@ notesdir: fragments prelude_section_name: release_summary prelude_section_title: Release Summary sections: -- - major_changes - - Major Changes -- - minor_changes - - Minor Changes -- - breaking_changes - - Breaking Changes / Porting Guide -- - deprecated_features - - Deprecated Features -- - removed_features - - Removed Features (previously deprecated) -- - security_fixes - - Security Fixes -- - bugfixes - - Bugfixes -- - known_issues - - Known Issues + - - major_changes + - Major Changes + - - minor_changes + - Minor Changes + - - breaking_changes + - Breaking Changes / Porting Guide + - - deprecated_features + - Deprecated Features + - - removed_features + - Removed Features (previously deprecated) + - - security_fixes + - Security Fixes + - - bugfixes + - Bugfixes + - - known_issues + - Known Issues title: Kubernetes Collection trivial_section_name: trivial diff --git a/ansible_collections/kubernetes/core/meta/runtime.yml b/ansible_collections/kubernetes/core/meta/runtime.yml index 6b6ebf57a..b9a963766 100644 --- a/ansible_collections/kubernetes/core/meta/runtime.yml +++ b/ansible_collections/kubernetes/core/meta/runtime.yml @@ -1,5 +1,5 @@ --- -requires_ansible: '>=2.9.17' +requires_ansible: ">=2.9.17" action_groups: helm: @@ -29,18 +29,18 @@ plugin_routing: warning_text: Use kubernetes.core.k8s_info instead. k8s_raw: tombstone: - removal_version: 0.1.0 + removal_version: "0.1.0" warning_text: The k8s_raw module was slated for deprecation in Ansible 2.10 and has been removed. Use kubernetes.core.k8s instead. openshift_raw: tombstone: - removal_version: 0.1.0 + removal_version: "0.1.0" warning_text: The openshift_raw module was slated for deprecation in Ansible 2.10 and has been removed. Use kubernetes.core.k8s instead. openshift_scale: tombstone: - removal_version: 0.1.0 + removal_version: "0.1.0" warning_text: The openshift_scale module was slated for deprecation in Ansible 2.10 and has been removed. Use kubernetes.core.k8s_scale instead. lookup: openshift: tombstone: - removal_version: 0.1.0 + removal_version: "0.1.0" warning_text: The openshift lookup plugin was slated for deprecation in Ansible 2.10 and has been removed. Use kubernetes.core.k8s instead. diff --git a/ansible_collections/kubernetes/core/plugins/filter/k8s.py b/ansible_collections/kubernetes/core/plugins/filter/k8s.py index f5e0170e5..a8ec560b3 100644 --- a/ansible_collections/kubernetes/core/plugins/filter/k8s.py +++ b/ansible_collections/kubernetes/core/plugins/filter/k8s.py @@ -1,12 +1,50 @@ # Copyright (c) 2017 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - +# SPDX-License-Identifier: GPL-3.0-or-later from __future__ import absolute_import, division, print_function __metaclass__ = type +DOCUMENTATION = r""" + +name: k8s_config_resource_name +short_description: Generate resource name for the given resource of type ConfigMap, Secret +description: + - Generate resource name for the given resource of type ConfigMap, Secret. + - Resource must have a C(metadata.name) key to generate a resource name +options: + _input: + description: + - A valid YAML definition for a ConfigMap or a Secret. + type: dict + required: true +author: + - ansible cloud team + +""" + +EXAMPLES = r""" +# Dump generated name for a configmap into a variable +- set_fact: + generated_name: '{{ definition | kubernetes.core.k8s_config_resource_name }}' + vars: + definition: + apiVersion: v1 + kind: ConfigMap + metadata: + name: myconfigmap + namespace: mynamespace +""" + +RETURN = r""" + _value: + description: Generated resource name. + type: str +""" + + from ansible.errors import AnsibleFilterError from ansible_collections.kubernetes.core.plugins.module_utils.hashes import ( generate_hash, diff --git a/ansible_collections/kubernetes/core/plugins/inventory/k8s.py b/ansible_collections/kubernetes/core/plugins/inventory/k8s.py index 099730f1b..462856bb6 100644 --- a/ansible_collections/kubernetes/core/plugins/inventory/k8s.py +++ b/ansible_collections/kubernetes/core/plugins/inventory/k8s.py @@ -27,7 +27,7 @@ DOCUMENTATION = """ connections: description: - Optional list of cluster connection settings. If no connections are provided, the default - I(~/.kube/config) and active context will be used, and objects will be returned for all namespaces + '~/.kube/config' and active context will be used, and objects will be returned for all namespaces the active user is authorized to access. suboptions: name: @@ -38,7 +38,7 @@ DOCUMENTATION = """ description: - Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the Kubernetes client will attempt to load the default - configuration file from I(~/.kube/config). Can also be specified via K8S_AUTH_KUBECONFIG + configuration file from '~/.kube/config'. Can also be specified via K8S_AUTH_KUBECONFIG environment variable. context: description: @@ -94,24 +94,24 @@ DOCUMENTATION = """ EXAMPLES = """ # File must be named k8s.yaml or k8s.yml -# Authenticate with token, and return all pods and services for all namespaces -plugin: kubernetes.core.k8s -connections: - - host: https://192.168.64.4:8443 - api_key: xxxxxxxxxxxxxxxx - validate_certs: false - -# Use default config (~/.kube/config) file and active context, and return objects for a specific namespace -plugin: kubernetes.core.k8s -connections: - - namespaces: - - testing - -# Use a custom config file, and a specific context. -plugin: kubernetes.core.k8s -connections: - - kubeconfig: /path/to/config - context: 'awx/192-168-64-4:8443/developer' +- name: Authenticate with token, and return all pods and services for all namespaces + plugin: kubernetes.core.k8s + connections: + - host: https://192.168.64.4:8443 + api_key: xxxxxxxxxxxxxxxx + validate_certs: false + +- name: Use default config (~/.kube/config) file and active context, and return objects for a specific namespace + plugin: kubernetes.core.k8s + connections: + - namespaces: + - testing + +- name: Use a custom config file, and a specific context. + plugin: kubernetes.core.k8s + connections: + - kubeconfig: /path/to/config + context: 'awx/192-168-64-4:8443/developer' """ import json diff --git a/ansible_collections/kubernetes/core/plugins/module_utils/client/discovery.py b/ansible_collections/kubernetes/core/plugins/module_utils/client/discovery.py index 898a82cef..f0d94e19f 100644 --- a/ansible_collections/kubernetes/core/plugins/module_utils/client/discovery.py +++ b/ansible_collections/kubernetes/core/plugins/module_utils/client/discovery.py @@ -114,7 +114,7 @@ class Discoverer(kubernetes.dynamic.discovery.Discoverer): filter(lambda resource: "/" in resource["name"], resources_response) ) for subresource in subresources_raw: - resource, name = subresource["name"].split("/") + resource, name = subresource["name"].split("/", 1) subresources[resource][name] = subresource for resource in resources_raw: diff --git a/ansible_collections/kubernetes/core/plugins/modules/helm_info.py b/ansible_collections/kubernetes/core/plugins/modules/helm_info.py index aefd44778..5a7a56166 100644 --- a/ansible_collections/kubernetes/core/plugins/modules/helm_info.py +++ b/ansible_collections/kubernetes/core/plugins/modules/helm_info.py @@ -52,6 +52,7 @@ options: - If set to C(uninstalling), show releases that are currently being uninstalled. type: list elements: str + default: [] version_added: "2.3.0" get_all_values: description: diff --git a/ansible_collections/kubernetes/core/plugins/modules/helm_template.py b/ansible_collections/kubernetes/core/plugins/modules/helm_template.py index ab50f8712..2a1872573 100644 --- a/ansible_collections/kubernetes/core/plugins/modules/helm_template.py +++ b/ansible_collections/kubernetes/core/plugins/modules/helm_template.py @@ -98,6 +98,7 @@ options: required: false type: list elements: str + default: [] version_added: 2.4.0 values_files: description: diff --git a/ansible_collections/kubernetes/core/plugins/modules/k8s.py b/ansible_collections/kubernetes/core/plugins/modules/k8s.py index 9b284d15d..a14dfc77b 100644 --- a/ansible_collections/kubernetes/core/plugins/modules/k8s.py +++ b/ansible_collections/kubernetes/core/plugins/modules/k8s.py @@ -257,10 +257,10 @@ EXAMPLES = r""" kubernetes.core.k8s: state: present template: - - path: '/testing/deployment_one.j2' - - path: '/testing/deployment_two.j2' - variable_start_string: '[[' - variable_end_string: ']]' + - path: '/testing/deployment_one.j2' + - path: '/testing/deployment_two.j2' + variable_start_string: '[[' + variable_end_string: ']]' - name: fail on validation errors kubernetes.core.k8s: diff --git a/ansible_collections/kubernetes/core/plugins/modules/k8s_drain.py b/ansible_collections/kubernetes/core/plugins/modules/k8s_drain.py index 31596d8c4..fef2ced78 100644 --- a/ansible_collections/kubernetes/core/plugins/modules/k8s_drain.py +++ b/ansible_collections/kubernetes/core/plugins/modules/k8s_drain.py @@ -46,6 +46,7 @@ options: description: - Specify options to delete pods. - This option has effect only when C(state) is set to I(drain). + default: {} suboptions: terminate_grace_period: description: @@ -103,7 +104,7 @@ EXAMPLES = r""" state: drain name: foo delete_options: - terminate_grace_period: 900 + terminate_grace_period: 900 - name: Mark node "foo" as schedulable. kubernetes.core.k8s_drain: @@ -114,7 +115,6 @@ EXAMPLES = r""" kubernetes.core.k8s_drain: state: cordon name: foo - """ RETURN = r""" diff --git a/ansible_collections/kubernetes/core/plugins/modules/k8s_info.py b/ansible_collections/kubernetes/core/plugins/modules/k8s_info.py index 4b29be119..fdd5093ac 100644 --- a/ansible_collections/kubernetes/core/plugins/modules/k8s_info.py +++ b/ansible_collections/kubernetes/core/plugins/modules/k8s_info.py @@ -38,10 +38,12 @@ options: description: List of label selectors to use to filter results type: list elements: str + default: [] field_selectors: description: List of field selectors to use to filter results type: list elements: str + default: [] extends_documentation_fragment: - kubernetes.core.k8s_auth_options diff --git a/ansible_collections/kubernetes/core/plugins/modules/k8s_log.py b/ansible_collections/kubernetes/core/plugins/modules/k8s_log.py index e52d5bce7..48537e4ac 100644 --- a/ansible_collections/kubernetes/core/plugins/modules/k8s_log.py +++ b/ansible_collections/kubernetes/core/plugins/modules/k8s_log.py @@ -47,6 +47,7 @@ options: - Only one of I(name) or I(label_selectors) may be provided. type: list elements: str + default: [] container: description: - Use to specify the container within a pod to grab the log from. diff --git a/ansible_collections/kubernetes/core/plugins/modules/k8s_rollback.py b/ansible_collections/kubernetes/core/plugins/modules/k8s_rollback.py index 8dfab4596..8dd686294 100644 --- a/ansible_collections/kubernetes/core/plugins/modules/k8s_rollback.py +++ b/ansible_collections/kubernetes/core/plugins/modules/k8s_rollback.py @@ -24,10 +24,12 @@ options: description: List of label selectors to use to filter results. type: list elements: str + default: [] field_selectors: description: List of field selectors to use to filter results. type: list elements: str + default: [] extends_documentation_fragment: - kubernetes.core.k8s_auth_options - kubernetes.core.k8s_name_options diff --git a/ansible_collections/kubernetes/core/plugins/modules/k8s_scale.py b/ansible_collections/kubernetes/core/plugins/modules/k8s_scale.py index a7cdfe1e0..c3e5f8425 100644 --- a/ansible_collections/kubernetes/core/plugins/modules/k8s_scale.py +++ b/ansible_collections/kubernetes/core/plugins/modules/k8s_scale.py @@ -36,6 +36,7 @@ options: description: List of label selectors to use to filter results. type: list elements: str + default: [] version_added: 2.0.0 continue_on_error: description: diff --git a/ansible_collections/kubernetes/core/test-requirements.txt b/ansible_collections/kubernetes/core/test-requirements.txt index c9068609d..47283a2f9 100644 --- a/ansible_collections/kubernetes/core/test-requirements.txt +++ b/ansible_collections/kubernetes/core/test-requirements.txt @@ -5,3 +5,5 @@ pytest pytest-xdist pytest-mock pytest-forked +virtualenv +pytest-ansible diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/helm_kubeconfig/tasks/main.yml b/ansible_collections/kubernetes/core/tests/integration/targets/helm_kubeconfig/tasks/main.yml index 244f1bdfd..dc64c1172 100644 --- a/ansible_collections/kubernetes/core/tests/integration/targets/helm_kubeconfig/tasks/main.yml +++ b/ansible_collections/kubernetes/core/tests/integration/targets/helm_kubeconfig/tasks/main.yml @@ -1,6 +1,10 @@ --- - name: Test helm with in-memory kubeconfig include_tasks: "from_in_memory_kubeconfig.yml" + loop_control: + loop_var: test_helm_version + with_items: + - "v3.10.3" - name: Test helm with custom kubeconfig and validate_certs=false include_tasks: "from_kubeconfig_with_validate_certs.yml" @@ -8,12 +12,10 @@ loop_var: test_helm_version with_items: - "v3.10.3" - - "v3.8.2" - name: Test helm with custom kubeconfig and ca_cert include_tasks: "from_kubeconfig_with_cacert.yml" loop_control: loop_var: test_helm_version with_items: - - "v3.5.1" - - "v3.4.2" + - "v3.10.3" diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_info/tasks/discovery.yml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_info/tasks/discovery.yml new file mode 100644 index 000000000..36c01bec4 --- /dev/null +++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_info/tasks/discovery.yml @@ -0,0 +1,32 @@ +--- +# Testing fix for issue https://github.com/ansible-collections/kubernetes.core/pull/676 +- vars: + kubevirt_release: "v1.1.1" + block: + - name: Delete existing namespace + kubernetes.core.k8s: + kind: namespace + namespace: kubevirt + state: absent + + - name: Create kubevirt resources + kubernetes.core.k8s: + state: present + apply: true + src: "{{ item }}" + with_items: + - "https://github.com/kubevirt/kubevirt/releases/download/{{ kubevirt_release }}/kubevirt-operator.yaml" + - "https://github.com/kubevirt/kubevirt/releases/download/{{ kubevirt_release }}/kubevirt-cr.yaml" + + - name: Read kubevirt Deployment + k8s_info: + kind: Deployment + namespace: kubevirt + always: + - name: Delete existing namespace + kubernetes.core.k8s: + kind: namespace + namespace: kubevirt + state: absent + wait: true + ignore_errors: true diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_info/tasks/main.yml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_info/tasks/main.yml index f15274a58..723556403 100644 --- a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_info/tasks/main.yml +++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_info/tasks/main.yml @@ -3,3 +3,4 @@ with_items: - wait - api-server-caching + - discovery diff --git a/ansible_collections/kubernetes/core/tests/sanity/ignore-2.14.txt b/ansible_collections/kubernetes/core/tests/sanity/ignore-2.14.txt index 6cfa02f6b..f62989e02 100644 --- a/ansible_collections/kubernetes/core/tests/sanity/ignore-2.14.txt +++ b/ansible_collections/kubernetes/core/tests/sanity/ignore-2.14.txt @@ -3,16 +3,19 @@ plugins/module_utils/client/discovery.py import-3.7!skip plugins/module_utils/client/discovery.py import-3.8!skip plugins/module_utils/client/discovery.py import-3.9!skip plugins/module_utils/client/discovery.py import-3.10!skip +plugins/module_utils/client/discovery.py import-3.11!skip plugins/module_utils/client/resource.py import-3.6!skip plugins/module_utils/client/resource.py import-3.7!skip plugins/module_utils/client/resource.py import-3.8!skip plugins/module_utils/client/resource.py import-3.9!skip plugins/module_utils/client/resource.py import-3.10!skip +plugins/module_utils/client/resource.py import-3.11!skip plugins/module_utils/k8sdynamicclient.py import-3.6!skip plugins/module_utils/k8sdynamicclient.py import-3.7!skip plugins/module_utils/k8sdynamicclient.py import-3.8!skip plugins/module_utils/k8sdynamicclient.py import-3.9!skip plugins/module_utils/k8sdynamicclient.py import-3.10!skip +plugins/module_utils/k8sdynamicclient.py import-3.11!skip plugins/modules/k8s.py validate-modules:parameter-type-not-in-doc plugins/modules/k8s_scale.py validate-modules:parameter-type-not-in-doc plugins/modules/k8s_service.py validate-modules:parameter-type-not-in-doc @@ -25,7 +28,6 @@ tests/integration/targets/helm/files/test-chart-v2/templates/configmap.yaml yaml tests/integration/targets/helm/files/test-chart/templates/configmap.yaml yamllint!skip tests/integration/targets/helm_diff/files/test-chart/templates/configmap.yaml yamllint!skip tests/integration/targets/k8s_scale/files/deployment.yaml yamllint!skip -tests/sanity/refresh_ignore_files shebang!skip plugins/modules/k8s.py validate-modules:return-syntax-error plugins/modules/k8s_scale.py validate-modules:return-syntax-error plugins/modules/k8s_service.py validate-modules:return-syntax-error diff --git a/ansible_collections/kubernetes/core/tests/sanity/ignore-2.15.txt b/ansible_collections/kubernetes/core/tests/sanity/ignore-2.15.txt index 95cd652ae..86c079160 100644 --- a/ansible_collections/kubernetes/core/tests/sanity/ignore-2.15.txt +++ b/ansible_collections/kubernetes/core/tests/sanity/ignore-2.15.txt @@ -16,6 +16,7 @@ plugins/module_utils/k8sdynamicclient.py import-3.8!skip plugins/module_utils/k8sdynamicclient.py import-3.9!skip plugins/module_utils/k8sdynamicclient.py import-3.10!skip plugins/module_utils/k8sdynamicclient.py import-3.11!skip +plugins/module_utils/version.py pylint!skip plugins/modules/k8s.py validate-modules:parameter-type-not-in-doc plugins/modules/k8s_scale.py validate-modules:parameter-type-not-in-doc plugins/modules/k8s_service.py validate-modules:parameter-type-not-in-doc @@ -28,7 +29,6 @@ tests/integration/targets/helm/files/test-chart-v2/templates/configmap.yaml yaml tests/integration/targets/helm/files/test-chart/templates/configmap.yaml yamllint!skip tests/integration/targets/helm_diff/files/test-chart/templates/configmap.yaml yamllint!skip tests/integration/targets/k8s_scale/files/deployment.yaml yamllint!skip -tests/sanity/refresh_ignore_files shebang!skip plugins/modules/k8s.py validate-modules:return-syntax-error plugins/modules/k8s_scale.py validate-modules:return-syntax-error plugins/modules/k8s_service.py validate-modules:return-syntax-error diff --git a/ansible_collections/kubernetes/core/tests/sanity/ignore-2.16.txt b/ansible_collections/kubernetes/core/tests/sanity/ignore-2.16.txt new file mode 100644 index 000000000..cb6e74504 --- /dev/null +++ b/ansible_collections/kubernetes/core/tests/sanity/ignore-2.16.txt @@ -0,0 +1,38 @@ +plugins/module_utils/client/discovery.py import-3.6!skip +plugins/module_utils/client/discovery.py import-3.7!skip +plugins/module_utils/client/discovery.py import-3.8!skip +plugins/module_utils/client/discovery.py import-3.9!skip +plugins/module_utils/client/discovery.py import-3.10!skip +plugins/module_utils/client/discovery.py import-3.11!skip +plugins/module_utils/client/discovery.py import-3.12!skip +plugins/module_utils/client/resource.py import-3.6!skip +plugins/module_utils/client/resource.py import-3.7!skip +plugins/module_utils/client/resource.py import-3.8!skip +plugins/module_utils/client/resource.py import-3.9!skip +plugins/module_utils/client/resource.py import-3.10!skip +plugins/module_utils/client/resource.py import-3.11!skip +plugins/module_utils/client/resource.py import-3.12!skip +plugins/module_utils/k8sdynamicclient.py import-3.6!skip +plugins/module_utils/k8sdynamicclient.py import-3.7!skip +plugins/module_utils/k8sdynamicclient.py import-3.8!skip +plugins/module_utils/k8sdynamicclient.py import-3.9!skip +plugins/module_utils/k8sdynamicclient.py import-3.10!skip +plugins/module_utils/k8sdynamicclient.py import-3.11!skip +plugins/module_utils/k8sdynamicclient.py import-3.12!skip +plugins/module_utils/version.py pylint!skip +plugins/modules/k8s.py validate-modules:parameter-type-not-in-doc +plugins/modules/k8s_scale.py validate-modules:parameter-type-not-in-doc +plugins/modules/k8s_service.py validate-modules:parameter-type-not-in-doc +tests/unit/module_utils/fixtures/definitions.yml yamllint!skip +tests/unit/module_utils/fixtures/deployments.yml yamllint!skip +tests/unit/module_utils/fixtures/pods.yml yamllint!skip +tests/integration/targets/helm/files/appversionless-chart-v2/templates/configmap.yaml yamllint!skip +tests/integration/targets/helm/files/appversionless-chart/templates/configmap.yaml yamllint!skip +tests/integration/targets/helm/files/test-chart-v2/templates/configmap.yaml yamllint!skip +tests/integration/targets/helm/files/test-chart/templates/configmap.yaml yamllint!skip +tests/integration/targets/helm_diff/files/test-chart/templates/configmap.yaml yamllint!skip +tests/integration/targets/k8s_scale/files/deployment.yaml yamllint!skip +plugins/modules/k8s.py validate-modules:return-syntax-error +plugins/modules/k8s_scale.py validate-modules:return-syntax-error +plugins/modules/k8s_service.py validate-modules:return-syntax-error +plugins/modules/k8s_taint.py validate-modules:return-syntax-error diff --git a/ansible_collections/kubernetes/core/tests/sanity/ignore-2.17.txt b/ansible_collections/kubernetes/core/tests/sanity/ignore-2.17.txt new file mode 100644 index 000000000..11c8b21e1 --- /dev/null +++ b/ansible_collections/kubernetes/core/tests/sanity/ignore-2.17.txt @@ -0,0 +1,29 @@ +plugins/module_utils/client/discovery.py import-3.9!skip +plugins/module_utils/client/discovery.py import-3.10!skip +plugins/module_utils/client/discovery.py import-3.11!skip +plugins/module_utils/client/discovery.py import-3.12!skip +plugins/module_utils/client/resource.py import-3.9!skip +plugins/module_utils/client/resource.py import-3.10!skip +plugins/module_utils/client/resource.py import-3.11!skip +plugins/module_utils/client/resource.py import-3.12!skip +plugins/module_utils/k8sdynamicclient.py import-3.9!skip +plugins/module_utils/k8sdynamicclient.py import-3.10!skip +plugins/module_utils/k8sdynamicclient.py import-3.11!skip +plugins/module_utils/k8sdynamicclient.py import-3.12!skip +plugins/module_utils/version.py pylint!skip +plugins/modules/k8s.py validate-modules:parameter-type-not-in-doc +plugins/modules/k8s_scale.py validate-modules:parameter-type-not-in-doc +plugins/modules/k8s_service.py validate-modules:parameter-type-not-in-doc +tests/unit/module_utils/fixtures/definitions.yml yamllint!skip +tests/unit/module_utils/fixtures/deployments.yml yamllint!skip +tests/unit/module_utils/fixtures/pods.yml yamllint!skip +tests/integration/targets/helm/files/appversionless-chart-v2/templates/configmap.yaml yamllint!skip +tests/integration/targets/helm/files/appversionless-chart/templates/configmap.yaml yamllint!skip +tests/integration/targets/helm/files/test-chart-v2/templates/configmap.yaml yamllint!skip +tests/integration/targets/helm/files/test-chart/templates/configmap.yaml yamllint!skip +tests/integration/targets/helm_diff/files/test-chart/templates/configmap.yaml yamllint!skip +tests/integration/targets/k8s_scale/files/deployment.yaml yamllint!skip +plugins/modules/k8s.py validate-modules:return-syntax-error +plugins/modules/k8s_scale.py validate-modules:return-syntax-error +plugins/modules/k8s_service.py validate-modules:return-syntax-error +plugins/modules/k8s_taint.py validate-modules:return-syntax-error diff --git a/ansible_collections/kubernetes/core/tests/sanity/refresh_ignore_files b/ansible_collections/kubernetes/core/tests/sanity/refresh_ignore_files deleted file mode 100644 index bdb01b8c3..000000000 --- a/ansible_collections/kubernetes/core/tests/sanity/refresh_ignore_files +++ /dev/null @@ -1,216 +0,0 @@ -#!/usr/bin/env python3 - - -import itertools - -from pathlib import Path - - -# Mapping of Ansible versions to supported Python versions -ANSIBLE_VERSIONS = { - "2.9": ["3.6", "3.7", "3.8"], - "2.10": ["3.6", "3.7", "3.8", "3.9"], - "2.11": ["3.6", "3.7", "3.8", "3.9"], - "2.12": ["3.6", "3.7", "3.8", "3.9", "3.10"], - "2.13": ["3.6", "3.7", "3.8", "3.9", "3.10"], - "2.14": ["3.6", "3.7", "3.8", "3.9", "3.10"], - "2.15": ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"], -} - -IMPORT_SKIPS = [ - "plugins/module_utils/client/discovery.py", - "plugins/module_utils/client/resource.py", - "plugins/module_utils/k8sdynamicclient.py", -] - -# Adds validate-modules:parameter-type-not-in-doc -PARAM_TYPE_SKIPS = [ - "plugins/modules/k8s.py", - "plugins/modules/k8s_scale.py", - "plugins/modules/k8s_service.py", -] - -# Adds validate-modules:return-syntax-error -RETURN_SYNTAX_SKIPS = [ - "plugins/modules/k8s.py", - "plugins/modules/k8s_scale.py", - "plugins/modules/k8s_service.py", - "plugins/modules/k8s_taint.py", -] - -YAML_LINT_SKIPS = [ - "tests/unit/module_utils/fixtures/definitions.yml", - "tests/unit/module_utils/fixtures/deployments.yml", - "tests/unit/module_utils/fixtures/pods.yml", - "tests/integration/targets/helm/files/appversionless-chart-v2/templates/configmap.yaml", - "tests/integration/targets/helm/files/appversionless-chart/templates/configmap.yaml", - "tests/integration/targets/helm/files/test-chart-v2/templates/configmap.yaml", - "tests/integration/targets/helm/files/test-chart/templates/configmap.yaml", - "tests/integration/targets/helm_diff/files/test-chart/templates/configmap.yaml", - "tests/integration/targets/k8s_scale/files/deployment.yaml", -] - -# Add shebang!skip -SHEBANG_SKIPS = [ - "tests/sanity/refresh_ignore_files", -] - -# Add validate-modules:import-error -VALIDATE_IMPORT_SKIPS = [ - "plugins/modules/k8s.py", - "plugins/modules/k8s_cp.py", - "plugins/modules/k8s_drain.py", - "plugins/modules/k8s_exec.py", - "plugins/modules/k8s_info.py", - "plugins/modules/k8s_json_patch.py", - "plugins/modules/k8s_log.py", - "plugins/modules/k8s_rollback.py", - "plugins/modules/k8s_scale.py", - "plugins/modules/k8s_service.py", - "plugins/modules/k8s_taint.py", -] - - -def import_skips(*versions): - for f in IMPORT_SKIPS: - for v in versions: - yield f"{f} import-{v}!skip" - -def param_type_skips(ansible_version): - if ansible_version not in ("2.9", "2.10"): - for f in PARAM_TYPE_SKIPS: - yield f"{f} validate-modules:parameter-type-not-in-doc" - - -def return_syntax_skips(ansible_version): - if ansible_version not in ("2.9", "2.10"): - for f in RETURN_SYNTAX_SKIPS: - yield f"{f} validate-modules:return-syntax-error" - else: - yield - - -def yaml_lint_skips(): - for f in YAML_LINT_SKIPS: - yield f"{f} yamllint!skip" - - -def shebang_skips(): - for f in SHEBANG_SKIPS: - yield f"{f} shebang!skip" - - -def import_boilerplate(path, ansible_version): - if ansible_version in ("2.9", "2.10", "2.11"): - for f in (p for p in path.glob("**/*.py") if not p.is_symlink()): - yield f"{f} future-import-boilerplate!skip" - else: - yield - - -def metaclass_boilerplate(path, ansible_version): - if ansible_version in ("2.9", "2.10", "2.11"): - for f in (p for p in path.glob("**/*.py") if not p.is_symlink()): - yield f"{f} metaclass-boilerplate!skip" - else: - yield - - -def unsupported_compile_skips(path, ansible_version): - """This adds rules for compile skips for all unsupported versions of python. - - These aren't needed for Ansible version 2.12+ as that can be managed on a - global level in tests/config.yml. - """ - if ansible_version in ("2.9", "2.10", "2.11"): - for f in (p for p in path.glob("**/*.py") if not p.is_symlink()): - yield ( - f"{f} compile-2.6!skip\n" - f"{f} compile-2.7!skip\n" - f"{f} compile-3.5!skip" - ) - - -def unsupported_import_skips(path, ansible_version): - """This adds rules for import skips for all unsupported versions of python. - - These aren't needed for Ansible version 2.12+ as that can be managed on a - global level in tests/config.yml. - """ - if ansible_version in ("2.9", "2.10", "2.11"): - if ansible_version in ("2.9", "2.10") and path.name == "plugins": - pathglob = itertools.chain( - path.joinpath("modules").glob("**/*.py"), - path.joinpath("module_utils").glob("**/*.py") - ) - else: - pathglob = path.glob("**/*.py") - for f in (p for p in pathglob if not p.is_symlink()): - yield ( - f"{f} import-2.6!skip\n" - f"{f} import-2.7!skip\n" - f"{f} import-3.5!skip" - ) - - -def unsupported_pylint_skips(path, ansible_version): - """This adds rules to skip pylint checks. - - This is only a problem on Ansible version 2.9 and 2.10 with python 3.5, - but there's no way to restrict this to a specific version of python. - """ - if ansible_version in ("2.9", "2.10"): - pathglob = itertools.chain( - path.joinpath("plugins/modules").glob("**/*.py"), - path.joinpath("plugins/module_utils").glob("**/*.py"), - path.joinpath("tests").glob("**/*.py"), - ) - for f in (p for p in pathglob if not p.is_symlink()): - yield f"{f} pylint!skip" - - -def unsupported_validate_modules_skips(ansible_version): - """Disable validate-modules test. - - Unfortunately, this is overly broad. Applying a validate-modules:import-error - skip fixes ansible 2.9 and python <3.6, but causes validation of the ignores - file itself to fail in python 3.6+. The only solution here is to simply - skip validate-modules altogether. - """ - if ansible_version in ("2.9", "2.10"): - for f in VALIDATE_IMPORT_SKIPS: - yield f"{f} validate-modules!skip" - - -def main(): - target_dir = Path('.') - sanity_dir = target_dir / "tests" / "sanity" - plugins = target_dir / "plugins" - units = target_dir / "tests" / "unit" - integration = target_dir / "tests" / "integration" - - for ansible, python in ANSIBLE_VERSIONS.items(): - with open(sanity_dir / f"ignore-{ansible}.txt", "w") as fp: - ignores = itertools.chain( - import_skips(*python), - param_type_skips(ansible), - yaml_lint_skips(), - shebang_skips(), - return_syntax_skips(ansible), - import_boilerplate(plugins, ansible), - import_boilerplate(units, ansible), - metaclass_boilerplate(plugins, ansible), - metaclass_boilerplate(units, ansible), - unsupported_import_skips(plugins, ansible), - unsupported_compile_skips(plugins, ansible), - unsupported_compile_skips(units, ansible), - unsupported_compile_skips(integration, ansible), - unsupported_pylint_skips(target_dir, ansible), - unsupported_validate_modules_skips(ansible), - ) - for f in filter(None, ignores): - fp.write(f + "\n") - - -if __name__ == "__main__": - main() |