Skip to content

Commit 31d881c

Browse files
committed
[#2280] Ensure pods are ready before attempting to retrieve container
info on startup
1 parent 79e5d2f commit 31d881c

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
@@ -355,16 +355,22 @@ func EnableRebalanceAfterScaleUp(i *ispnv1.Infinispan, ctx pipeline.Context) {
355355
return
356356
}
357357

358+
if podList, err := ctx.InfinispanPods(); err != nil {
359+
ctx.Requeue(err)
360+
return
361+
} else if len(podList.Items) != int(i.Spec.Replicas) {
362+
ctx.Log().Info("Waiting on cluster pods to be provisioned", "pods", len(podList.Items), "spec.replicas", i.Spec.Replicas)
363+
ctx.RequeueAfter(consts.DefaultWaitClusterPodsNotReady, nil)
364+
return
365+
}
366+
358367
ispnClient, err := ctx.InfinispanClient()
359368
if err != nil {
360-
ctx.Requeue(err)
369+
ctx.Log().Info("Waiting on at least one ready pod", "err", err)
370+
ctx.RequeueAfter(consts.DefaultWaitClusterPodsNotReady, nil)
361371
return
362372
}
363373

364-
// TODO why is this failing in TestOperandUpgrade for 14.0.x servers?
365-
/*
366-
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"}
367-
*/
368374
if info, err := ispnClient.Container().Info(); err != nil {
369375
ctx.Requeue(fmt.Errorf("unable to retrieve cluster information on scale up: %w", err))
370376
return

0 commit comments

Comments
 (0)