Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PR #676/19559892 backport][stable-3] fix(Collection's util resource discovery fails when complex subresources present #659) #687

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/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
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
Loading