Skip to content

Commit

Permalink
[PR #676/19559892 backport][stable-3] fix(Collection's util resource …
Browse files Browse the repository at this point in the history
…discovery fails when complex subresources present #659) (#687)

* fix(Collection's util resource discovery fails when complex subresources present #659) (#676)

* fix(Collection's util resource discovery fails when complex subresources present #659)

* fix(add changelog fragment)

* update node image

* Create discovery.yml

* Update main.yml

---------

Co-authored-by: Bastien Bosser <[email protected]>
Co-authored-by: Bikouo Aubin <[email protected]>
(cherry picked from commit 1955989)

* adding sanity ignore file

* Remove refresh_ignore_files

* Update ignore files content

---------

Co-authored-by: bastienbosser <[email protected]>
Co-authored-by: abikouo <[email protected]>
  • Loading branch information
3 people authored Mar 1, 2024
1 parent e756ced commit d3031fc
Show file tree
Hide file tree
Showing 15 changed files with 44 additions and 2,113 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/integration-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ jobs:

- name: create kubernetes cluster
uses: helm/[email protected]
with:
node_image: "kindest/node:v1.29.2"

- name: Run integration tests
uses: ansible-network/github_actions/.github/actions/ansible_test_integration@main
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
bugfixes:
- Resolve Collections util resource discovery fails when complex subresources present (https://github.com/ansible-collections/kubernetes.core/pull/676).
2 changes: 1 addition & 1 deletion plugins/module_utils/client/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def get_resources_for_api_version(self, prefix, group, version, preferred):
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:
Expand Down
32 changes: 32 additions & 0 deletions tests/integration/targets/k8s_info/tasks/discovery.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions tests/integration/targets/k8s_info/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
with_items:
- wait
- api-server-caching
- discovery
616 changes: 0 additions & 616 deletions tests/sanity/ignore-2.10.txt

This file was deleted.

593 changes: 0 additions & 593 deletions tests/sanity/ignore-2.11.txt

This file was deleted.

33 changes: 0 additions & 33 deletions tests/sanity/ignore-2.12.txt

This file was deleted.

33 changes: 0 additions & 33 deletions tests/sanity/ignore-2.13.txt

This file was deleted.

1 change: 0 additions & 1 deletion tests/sanity/ignore-2.14.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,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
Expand Down
1 change: 0 additions & 1 deletion tests/sanity/ignore-2.15.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,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
Expand Down
1 change: 0 additions & 1 deletion tests/sanity/ignore-2.16.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,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
Expand Down
15 changes: 5 additions & 10 deletions tests/sanity/ignore-2.6.txt → tests/sanity/ignore-2.17.txt
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
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/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/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/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/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/integration/targets/k8s_delete/files/deployments.yaml 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
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
Expand Down
Loading

0 comments on commit d3031fc

Please sign in to comment.