Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 40 additions & 2 deletions pkg/controllers/readiness/wellknown_ready_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,51 @@ func (c *wellKnownReadyController) sync(ctx context.Context, controllerContext f
return err
}

if err := c.isWellknownEndpointsReady(ctx, operatorSpec, operatorStatus, authConfig, infraConfig); err != nil {
// Retry the well-known endpoint check for up to 15 seconds with 1-second intervals
retryStart := time.Now()
const retryTimeout = 15 * time.Second
const retryInterval = 1 * time.Second

for {
err := c.isWellknownEndpointsReady(ctx, operatorSpec, operatorStatus, authConfig, infraConfig)
if err == nil {
// Success - well-known endpoints are ready
break
}

elapsed := time.Since(retryStart)

// If we've exceeded the retry timeout, handle the final error
if elapsed >= retryTimeout {
// After retries are exhausted, set to Unavailable with reason NotReady
available = available.
WithStatus(operatorv1.ConditionFalse).
WithReason("NotReady").
WithMessage(fmt.Sprintf("The well-known endpoint failed after %v of retries: %s", retryTimeout, err.Error()))
progressing = progressing.
WithStatus(operatorv1.ConditionTrue)
return err
}

// Wait before retrying, but check context cancellation
select {
case <-ctx.Done():
return ctx.Err()
case <-time.After(retryInterval):
// Continue with retry
}
}

// After retries are exhausted, handle the final error with proper progressingErr logic
if err != nil {
available = available.
WithStatus(operatorv1.ConditionFalse).
WithReason("NotReady").
WithMessage(fmt.Sprintf("The well-known endpoint is not yet available: %s", err.Error()))
WithMessage(fmt.Sprintf("The well-known endpoint failed after %v of retries: %s", retryTimeout, err.Error()))
progressing = progressing.
WithStatus(operatorv1.ConditionTrue)

// Handle ControllerProgressingError specially
if progressingErr, ok := err.(*common.ControllerProgressingError); ok {
if progressingErr.IsDegraded(controllerName, operatorStatus) {
return progressingErr.Unwrap()
Expand Down