-
Notifications
You must be signed in to change notification settings - Fork 105
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 condition for checking if a deployment is available #251
Add condition for checking if a deployment is available #251
Conversation
|
Welcome @ryankwilliams! |
Hi @ryankwilliams. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@ryankwilliams Thanks for simplifying the usage. |
/ok-to-test |
This change adds a new condition to check if a deployment is available. The wait condition only requires the user to provide the deployment name and namespace and the condition method handles building the deployment object/checking the deployment condition for a match. With this new condition, it will remove the need for the user to build the deployment object and call deployment condition match condition in their code bases.
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.
/cc @vladimirvivien
/approve |
Thanks @ryankwilliams for the contribution. Now, if you can figure out a way to make the helper more generic, then I think that would be better for the e2e-framework API usability. For instance, you could do something that creates a condition for any resource err = wait.For(conditions.New(client).ResourceAvailable(corev1.ObjectMeta{Name:"my-deployment", Namespace:"my-ns"}, schema.GroupVersionResource{Group: "apps", Version: "v1", Resource: "deployment"}))
if err != nil {
fmt.Printf("error waiting for deployment to become available: %v", err)
os.Exit(1)
} Or, follow the options api pattern that is already used in the e2e-framework err = wait.For(conditions.New(client).ResourceAvailable(
conditions.WithObjectName("my-deployment"),
conditions.WithNamespace("Namespace"),
conditions.WithObjectGVR("apps", "v1", "deployment"),
))
if err != nil {
fmt.Printf("error waiting for deployment to become available: %v", err)
os.Exit(1)
} |
Thank you @vladimirvivien for your reply! I was following in the same steps as lines 269 -> 294 where helper functions existed to see if a pod was ready, containers ready, pod running, job completed or job failed. Thank you for sharing the code examples, I will rethink on this to see about making it into a more generic helper. |
@ryankwilliams you were absolutely right to think this was the proper direction to take originally (based on the code link in your last comment). I should have made that point in the original PR. Nevertheless, if you have time to do a generic version of wait, then you are welcome to. If not, we can accept the original changes since there is precedence. |
Hi @vladimirvivien, Thank you for your response. My apologies on the delayed follow up. I have not had time to work on a generic version of wait yet. For now, if you would like to accept my original change, please feel free to else I can close this. |
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.
Thank you for your contribution.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ryankwilliams, ShwethaKumbla, vladimirvivien The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Change
This PR adds a new condition to check if a deployment is available. The wait condition only requires the user to provide the deployment name and namespace and the condition method will handle building the deployment object/checking the deployment condition for a match.
With this new condition, it will remove the need for the user to build the deployment object and call deployment condition match condition in their code bases.
Before
After