MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / WaitForReady

Function WaitForReady

tests/utils/operator/operator.go:210–227  ·  view source on GitHub ↗

WaitForReady waits for the operator deployment to be ready. If checkWebhook is true, it will also check that the webhook is replying

(
	ctx context.Context,
	crudClient client.Client,
	timeoutSeconds uint,
	checkWebhook bool,
)

Source from the content-addressed store, hash-verified

208// WaitForReady waits for the operator deployment to be ready.
209// If checkWebhook is true, it will also check that the webhook is replying
210func WaitForReady(
211 ctx context.Context,
212 crudClient client.Client,
213 timeoutSeconds uint,
214 checkWebhook bool,
215) error {
216 return retry.New(retry.Delay(time.Second),
217 retry.Attempts(timeoutSeconds)).
218 Do(
219 func() error {
220 ready, err := IsReady(ctx, crudClient, checkWebhook)
221 if err != nil || !ready {
222 return fmt.Errorf("operator deployment is not ready")
223 }
224 return nil
225 },
226 )
227}
228
229// isDeploymentReady returns true if the operator deployment has the expected number
230// of ready pods.

Callers 3

ReloadDeploymentFunction · 0.70
ScaleOperatorDeploymentFunction · 0.70

Calls 1

IsReadyFunction · 0.70

Tested by

no test coverage detected