Closed hojerst closed 3 years ago
@hojerst Thank you for reporting this. I'll take a look.
@tima @Akasurde Thinking about this and I'm not actually sure what the behavior should be. In the case of a specific object as described here--we're given a name
, for example--we can wait until the object is created or wait_timeout
, whichever comes first. If we are given a less specific query, like listing all the pods in a namespace, for example:
k8s_info:
kind: Pod
namespace: foo
wait: true
wait_timeout: 180
the only way that's ever satisfied is to always wait the full timeout period.
imho there are two sane algorithms which might work in this case:
maybe this can be switched by parameter which defaults to the current implementation. (or use a "magic default" depending if "name" is specified)
This should make this module usable for two usecases:
Which ever implementation is used, I think the documentation needs to be clear about the implications. As both scenarios might be needed in plays.
SUMMARY
k8s_info
with thewait
option does return immediately when no object is found.From the example in the
ISSUE TYPE
COMPONENT NAME
community.kubernetes.k8s_info
(in collection v1.1.1)ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE
run the example from the documentation without a object "pod/pod-not-yet-created"
EXPECTED RESULTS
I'm expecting that the module waits for up to 360 seconds until the resource "pod/pod-not-yet-created" is in the desired state (Running for Pods).
ACTUAL RESULTS
The module returns immediately without any waiting if the resource is not yet created. This makes the module unusable when the resources are indirectly created by other resources. e.g. a pod which is created by a deployment (or a pod created by a operator)
(no error text output, but this is the "register: result" json object: