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

Function WaitForGetClusterWithClient

pkg/management/client.go:150–167  ·  view source on GitHub ↗

WaitForGetClusterWithClient will wait for a successful get cluster to be executed

(ctx context.Context, cli client.Client, clusterObjectKey client.ObjectKey)

Source from the content-addressed store, hash-verified

148
149// WaitForGetClusterWithClient will wait for a successful get cluster to be executed
150func WaitForGetClusterWithClient(ctx context.Context, cli client.Client, clusterObjectKey client.ObjectKey) error {
151 logger := log.FromContext(ctx).WithName("wait-for-get-cluster")
152
153 err := retry.OnError(readinessCheckRetry, resources.RetryAlways, func() error {
154 if err := cli.Get(ctx, clusterObjectKey, &apiv1.Cluster{}); err != nil {
155 logger.Warning("Encountered an error while executing get cluster. Will wait and retry", "error", err.Error())
156 return err
157 }
158 return nil
159 })
160 if err != nil {
161 const message = "error while waiting for the API server to be reachable"
162 logger.Error(err, message)
163 return fmt.Errorf("%s: %w", message, err)
164 }
165
166 return nil
167}

Callers 4

StartMethod · 0.92
upgradeSubCommandMethod · 0.92
StartMethod · 0.92
WaitForGetClusterFunction · 0.85

Calls 4

WithNameMethod · 0.80
WarningMethod · 0.80
GetMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected