Skip to content

Commit 81914bb

Browse files
committed
[#14835] Ensure pods are ready before attempting to retrieve container
info on startup
1 parent 46d566b commit 81914bb

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
@@ -341,16 +341,22 @@ func EnableRebalanceAfterScaleUp(i *ispnv1.Infinispan, ctx pipeline.Context) {
341341
return
342342
}
343343

344+
if podList, err := ctx.InfinispanPods(); err != nil {
345+
ctx.Requeue(err)
346+
return
347+
} else if len(podList.Items) != int(i.Spec.Replicas) {
348+
ctx.Log().Info("Waiting on cluster pods to be provisioned", "pods", len(podList.Items), "spec.replicas", i.Spec.Replicas)
349+
ctx.RequeueAfter(consts.DefaultWaitClusterPodsNotReady, nil)
350+
return
351+
}
352+
344353
ispnClient, err := ctx.InfinispanClient()
345354
if err != nil {
346-
ctx.Requeue(err)
355+
ctx.Log().Info("Waiting on at least one ready pod", "err", err)
356+
ctx.RequeueAfter(consts.DefaultWaitClusterPodsNotReady, nil)
347357
return
348358
}
349359

350-
// TODO why is this failing in TestOperandUpgrade for 14.0.x servers?
351-
/*
352-
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"}
353-
*/
354360
if info, err := ispnClient.Container().Info(); err != nil {
355361
ctx.Requeue(fmt.Errorf("unable to retrieve cluster information on scale up: %w", err))
356362
return

0 commit comments

Comments
 (0)