@@ -369,6 +369,18 @@ func RestartKueueController(ctx context.Context, k8sClient client.Client, kindCl
369369 kcmKey := types.NamespacedName {Namespace : kueueNS , Name : "kueue-controller-manager" }
370370 rolloutOperatorDeployment (ctx , k8sClient , kcmKey , kindClusterName )
371371 WaitForKueueAvailabilityNoRestartCountCheck (ctx , k8sClient )
372+ waitForDeploymentWithOnlyAvailableReplicas (ctx , k8sClient , kcmKey )
373+ }
374+
375+ func waitForDeploymentWithOnlyAvailableReplicas (ctx context.Context , k8sClient client.Client , key types.NamespacedName ) {
376+ deployment := & appsv1.Deployment {}
377+ waitForAvailableStart := time .Now ()
378+ ginkgo .By (fmt .Sprintf ("Waiting for deployment to have only available replicas: %q" , key ))
379+ gomega .EventuallyWithOffset (2 , func (g gomega.Gomega ) {
380+ g .Expect (k8sClient .Get (ctx , key , deployment )).To (gomega .Succeed ())
381+ g .Expect (deployment .Status .Replicas ).To (gomega .Equal (deployment .Status .AvailableReplicas ))
382+ }, LongTimeout , Interval ).Should (gomega .Succeed ())
383+ ginkgo .GinkgoLogr .Info ("Deployment has only available replicas in the cluster" , "deployment" , key , "waitingTime" , time .Since (waitForAvailableStart ))
372384}
373385
374386func WaitForActivePodsAndTerminate (ctx context.Context , k8sClient client.Client , restClient * rest.RESTClient , cfg * rest.Config , namespace string , activePodsCount , exitCode int , opts ... client.ListOption ) {
0 commit comments