ansible-collections / community.kubernetes

Kubernetes Collection for Ansible
https://galaxy.ansible.com/community/kubernetes
GNU General Public License v3.0
265 stars 106 forks source link

Honor wait_timeout in k8s_info for missing resource #360

Closed gravesm closed 3 years ago

gravesm commented 3 years ago
SUMMARY

The wait logic in the k8s_info module immediately returns when no resources are found, regardless whether a wait_timeout has been specified. This expands the logic to wait when a name has been provided. The case this is specifically meant to address is when querying for a resource that is indirectly created by another resource, for example, a pod created by a deployment or an operator.

The existing logic in every other case should remain as it was before. This means if a query might return more than one resource--all pods with some label, for example--the module will return immediately if no pods are found, even if a wait_timeout has been provided.

Closes #344

ISSUE TYPE
COMPONENT NAME

k8s_info, k8s

ADDITIONAL INFORMATION
codecov[bot] commented 3 years ago

Codecov Report

Merging #360 (0553adc) into main (92e3732) will decrease coverage by 0.99%. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #360      +/-   ##
==========================================
- Coverage   36.80%   35.81%   -1.00%     
==========================================
  Files           3        3              
  Lines         758      779      +21     
  Branches      148      154       +6     
==========================================
  Hits          279      279              
- Misses        430      451      +21     
  Partials       49       49              
Impacted Files Coverage Δ
...ommunity/kubernetes/plugins/module_utils/common.py 34.19% <0.00%> (-1.28%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 92e3732...06291d8. Read the comment docs.

github-actions[bot] commented 2 years ago

This repository does not accept pull requests, see the README for details.