wait: ExponentialBackoffWithContext should take context-aware fn

The condition methods will eventually all take a context. Since we
have been provided one, alter the accepted condition type and
change the four references in tree.

Collers of ExponentialBackoffWithContext should use a condition
aware function (ConditionWithContextFunc). If the context can be
ignored the helper ConditionFunc.WithContext can be used to convert
an existing function to the new type.

Kubernetes-commit: 34bfdc3635cb621d94eebde5d8f4b9c0b933c68e
This commit is contained in:
Clayton Coleman 2023-01-16 14:57:57 -05:00 committed by Kubernetes Publisher
parent 7959088f40
commit fbcccd4f68
1 changed files with 1 additions and 1 deletions

View File

@ -121,7 +121,7 @@ func WithExponentialBackoff(ctx context.Context, retryBackoff wait.Backoff, webh
// having a webhook error allows us to track the last actual webhook error for requests that
// are later cancelled or time out.
var webhookErr error
err := wait.ExponentialBackoffWithContext(ctx, retryBackoff, func() (bool, error) {
err := wait.ExponentialBackoffWithContext(ctx, retryBackoff, func(_ context.Context) (bool, error) {
webhookErr = webhookFn()
if shouldRetry(webhookErr) {
return false, nil