Skip to content

Commit cc40ec1

Browse files
authored
Fix the availability check after rolling restart (#7925)
1 parent 42db0d0 commit cc40ec1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/util/e2e.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

374386
func WaitForActivePodsAndTerminate(ctx context.Context, k8sClient client.Client, restClient *rest.RESTClient, cfg *rest.Config, namespace string, activePodsCount, exitCode int, opts ...client.ListOption) {

0 commit comments

Comments
 (0)