@@ -19,10 +19,7 @@ import (
1919// - There are no unavailable replicas
2020// - All pods associated with the deployment are running
2121func WaitForDeploymentAvailable (ctx context.Context , clientset * kubernetes.Clientset , namespace , deploymentName string , timeout time.Duration ) error {
22- ctx , cancel := context .WithTimeout (ctx , timeout )
23- defer cancel ()
24-
25- return wait .PollUntilContextCancel (ctx , 1 * time .Second , true , func (ctx context.Context ) (bool , error ) {
22+ return wait .PollUntilContextTimeout (ctx , 1 * time .Second , timeout , true , func (ctx context.Context ) (bool , error ) {
2623 deployment , err := clientset .AppsV1 ().Deployments (namespace ).Get (ctx , deploymentName , metav1.GetOptions {})
2724 if err != nil {
2825 return false , err
@@ -33,10 +30,7 @@ func WaitForDeploymentAvailable(ctx context.Context, clientset *kubernetes.Clien
3330}
3431
3532func WaitForDeploymentAvailableBySelector (ctx context.Context , clientset * kubernetes.Clientset , namespace , selector string , timeout time.Duration ) error {
36- ctx , cancel := context .WithTimeout (ctx , timeout )
37- defer cancel ()
38-
39- return wait .PollUntilContextCancel (ctx , 1 * time .Second , true , func (ctx context.Context ) (bool , error ) {
33+ return wait .PollUntilContextTimeout (ctx , 1 * time .Second , timeout , true , func (ctx context.Context ) (bool , error ) {
4034 deployments , err := clientset .AppsV1 ().Deployments (namespace ).List (ctx , metav1.ListOptions {
4135 LabelSelector : selector ,
4236 })
0 commit comments