ForResourceDefaultReady waits for any resource If identifier is empty, it will wait for the given kind If condition is empty, it will wait for the given identifier to be fully reconciled using healthchecks. This functions requires that a cluster is available before it is called
(ctx context.Context, kind, identifier, condition, namespace string, timeout time.Duration)
| 90 | // If condition is empty, it will wait for the given identifier to be fully reconciled using healthchecks. |
| 91 | // This functions requires that a cluster is available before it is called |
| 92 | func ForResourceDefaultReady(ctx context.Context, kind, identifier, condition, namespace string, timeout time.Duration) error { |
| 93 | if kind == "" { |
| 94 | return errors.New("kind is required") |
| 95 | } |
| 96 | |
| 97 | deadline := time.Now().Add(timeout) |
| 98 | |
| 99 | condition = strings.ReplaceAll(condition, "'", "") |
| 100 | |
| 101 | loader := clientcmd.NewDefaultClientConfigLoadingRules() |
| 102 | clientCfg := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(loader, nil) |
| 103 | _, restConfig, err := cluster.ClientAndConfig() |
| 104 | if err != nil { |
| 105 | return err |
| 106 | } |
| 107 | |
| 108 | return waitFor(ctx, restConfig, clientCfg, kind, namespace, identifier, condition, deadline) |
| 109 | } |
| 110 | |
| 111 | func waitFor(ctx context.Context, restConfig *rest.Config, clientCfg clientcmd.ClientConfig, kind string, namespace string, identifier string, condition string, deadline time.Time) error { |
| 112 | l := logger.From(ctx) |
no test coverage detected