-
Notifications
You must be signed in to change notification settings - Fork 18
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
Add wait option to Pod Create #44
Conversation
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
Given the example: kubernetes.pods.create({
namespace: namespace,
name: podName,
image: image,
command: command
})
const options = {
namespace: namespace,
name: podName,
status: "Succeeded",
timeout: "10s"
}
if (kubernetes.pods.wait(options)) {
console.log(podName + " pod completed successfully")
} else {
throw podName + " is not completed"
} I suggest adding the const resultExecution = kubernetes.pods.createAndWait({
namespace: namespace,
name: podName,
image: image,
command: command,
timeout: "10s"
}) or any other alternative:
|
@ppcano this is already done. I just also made possible to wait after the pod is created. This is useful for waiting for the pod to complete. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add some unit tests around this new functionality; basically what the example scripts attempt to prove.
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
0a93188
to
4519fef
Compare
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple minor issues.
const namespace = "default" | ||
const podName = "new-pod" | ||
const image = "busybox" | ||
const command = ["sh", "-c", "/bin/false"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this command puts the pod into an error state resulting in script returning Pod has failed
. Was this the intended behavior for the example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the example to (hopefully) make the purpose evident.
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you for a great addition!
Add option for waiting until the Pod is running to pod Create. if the pod is not running after a given timeout, an error is returned.
Closes #43