Skip to content

Improve resilience when reconciling OIDC resources that require remote JWKS #154

@dimityrmirchev

Description

@dimityrmirchev

What would you like to be added:
The logic that immediately removes the authentication handler when a request to retrieve a remote JWKS fails can be improved to better handle intermittent failures.

keySet, err = remoteKeySet(ctx, config.Spec.IssuerURL, config.Spec.CABundle)
if err != nil {
log.Error(err, "Invalid remote JWKS KeySet")
r.deleteHandler(req.Name)
return reconcile.Result{RequeueAfter: 10 * time.Second}, nil
}

It would be better to implement a retry mechanism that tries the request a couple of times before finally removing the auth handler from store. This will improve stability of the service. In addition to that the default resync period can be increased from its current default value of 10min.

fs.DurationVar(&s.Duration, "resync-period", time.Minute*10, "resync period")

Why is this needed:
An intermittent failure, i.e. DNS or network issue can cause an authentication handler to be removed from store causing request to the kube-apiserver to be unauthorized.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/enhancementEnhancement, improvement, extensionlifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions