INNER CODE UNIT · Go
initKeeperWithRetry
Altinity/clickhouse-operator · cmd/operator/app/main.go:161
func initKeeperWithRetry(ctx context.Context, init func(context.Context) error) error {
backoff := keeperInitRetryBackoff // copy - Step() mutates the receiver
for {
// Each attempt rebuilds the manager and reassigns the package-level manager, scheme and
// logger. A failed one abandons a manager that was built but never started, so there is
// nothing to unwind; its HTTP transport is client-go's globally cached one, which the next
// attempt gets back rather than leaking, and ctrl.SetLogger is a no-op after the first
// call. The retry is not a clean slate; it does not need to be.
err := init(ctx)
if err == nil {
return nil
}
// Retry by default, and stop only on what initKeeper itself marks as deterministic.
// Deliberately NOT IsTransientAPIError: that classifier serves reconcile-time reads, where
// NotFound legitimately means "create it", and it reports Forbidden and a missing REST
// mapping as terminal. Here that is worth waiting out - apps/v1 briefly absent from
// discovery resolves on its own. Classifying the failure where it is raised leaves