Skip to content

Commit 5b292be

Browse files
committed
[#2280] Ensure pods are ready before attempting to retrieve container
info on startup
1 parent e2ef650 commit 5b292be

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

pkg/reconcile/pipeline/infinispan/context/context.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ func (c *contextImpl) InfinispanClient() (api.Infinispan, error) {
104104
break
105105
}
106106
}
107+
if pod == "" {
108+
return nil, fmt.Errorf("unable to create Infinispan client, no ready pods exist")
109+
}
107110
c.ispnClient = c.InfinispanClientForPod(pod)
108111
return c.ispnClient, nil
109112
}

pkg/reconcile/pipeline/infinispan/handler/manage/upgrades.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -344,16 +344,22 @@ func EnableRebalanceAfterScaleUp(i *ispnv1.Infinispan, ctx pipeline.Context) {
344344
return
345345
}
346346

347+
if podList, err := ctx.InfinispanPods(); err != nil {
348+
ctx.Requeue(err)
349+
return
350+
} else if len(podList.Items) != int(i.Spec.Replicas) {
351+
ctx.Log().Info("Waiting on cluster pods to be provisioned", "pods", len(podList.Items), "spec.replicas", i.Spec.Replicas)
352+
ctx.RequeueAfter(consts.DefaultWaitClusterPodsNotReady, nil)
353+
return
354+
}
355+
347356
ispnClient, err := ctx.InfinispanClient()
348357
if err != nil {
349-
ctx.Requeue(err)
358+
ctx.Log().Info("Waiting on at least one ready pod", "err", err)
359+
ctx.RequeueAfter(consts.DefaultWaitClusterPodsNotReady, nil)
350360
return
351361
}
352362

353-
// TODO why is this failing in TestOperandUpgrade for 14.0.x servers?
354-
/*
355-
2025-05-16T17:11:58.093+0100 ERROR Reconciler error {"controller": "infinispan", "controllerGroup": "infinispan.org", "controllerKind": "Infinispan", "infinispan": {"name":"test-operand-upgrade","namespace":"namespace-for-testing"}, "namespace": "namespace-for-testing", "name": "test-operand-upgrade", "reconcileID": "eda96c7e-fd83-43cc-b903-4a623e4e2785", "error": "unable to retrieve cluster information on scale up: unexpected error getting cache manager info: stderr: , err: the server does not allow this method on the requested resource"}
356-
*/
357363
if info, err := ispnClient.Container().Info(); err != nil {
358364
ctx.Requeue(fmt.Errorf("unable to retrieve cluster information on scale up: %w", err))
359365
return

0 commit comments

Comments
 (0)