Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

Commit

Permalink
cluster_bootstrap: Short requeue if CRD not found on remote cluster
Browse files Browse the repository at this point in the history
On clusters where kapp is taking a long time to get installed (slow
registries etc...), cluster_bootstrap controller may end up in
exponential backoff because some CRDs do not exist yet on the remote
cluster.

This change checks for this particular error, and requeues the cluster
for retry after 10s.

Signed-off-by: Naadir Jeewa <jeewan@vmware.com>
  • Loading branch information
randomvariable committed Oct 19, 2022
1 parent 130b0f3 commit 3593f55
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions addons/controllers/clusterbootstrap_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
corev1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
Expand Down Expand Up @@ -251,6 +252,11 @@ func (r *ClusterBootstrapReconciler) createOrPatchResourcesForCorePackages(clust
// packages, we return error and let the reconciler retry again.
log.Error(err, fmt.Sprintf("unable to create or patch all the required resources for %s on cluster: %s/%s",
corePackage.RefName, cluster.Namespace, cluster.Name))
if meta.IsNoMatchError(err) {
// If the remote cluster does not have the required CRDs, we will requeue the request to try again in 10s.
log.Error(err, "reconciler error - required CRDs are not yet installed, requeing request in 10s")
return ctrl.Result{RequeueAfter: constants.RequeueAfterDuration}, nil
}
return ctrl.Result{}, err
}
// set watches on provider objects in core packages if not already set
Expand Down

0 comments on commit 3593f55

Please sign in to comment.