What is the better way to poll for kubernetes reso...
# general
f
What is the better way to poll for kubernetes resources that are created as part of a deployment? Say, my jenkins deployment creates a secret with jenkins credentials, and I want to put in as my stack output.
Copy code
export const credentials = k8s.core.v1.Secret.get("jenkins-credentials", `${namespace}/jenkins-operator-credentials-${jenkinsName}`, {
         provider: kubernetes
}).data;
The code above does not output anything, because the secret is not created yet. Should I try to poll the secret? Is there a code example for that?
c
@faint-vegetable-61837 hmm, that’s an interesting use case,
get
was meant to be invoked once.
@faint-vegetable-61837 probably in the limit what would be nice is to have a Jenkins provider that signals completion of a pipeline, which then allows you to call get afterwards.
In the meantime if you can check somehow that the pipeline is complete, you can (I think)
dependsOn
the
Promise
of that HTTP call (or whatever), and that should automatically register that that check needs to complete first.
f
As a feature request, it would be nice to have a way to wait for creation of an object in k8s with some timeout settings. This will be useful when working with k8s operators - once you deploy a CRD for the operator, and operator reacts to it by creating something in k8s, this would wait for the result.
c
@faint-vegetable-61837 in fact, @gorgeous-egg-16927 is working on precisely this feature right now!
f
awesome, looks like you are steps ahead of me! Do you know target release for this?
g
So I’m planning to add configurable timeouts for waiting on resource creation. I’m not sure if this is exactly the same case; looks like you might be wanting a timeout/polling on the
.get()
?
c
That might be nice, but I am not sure how we would want to do it yet.