Merge pull request #2675 from stingshen/yishen/nil_impersonator_secret_ref

`karmada-controller-manager`: Fixed the panic when cluster ImpersonatorSecretRef is nil.
This commit is contained in:
karmada-bot 2022-10-26 14:14:19 +08:00 committed by GitHub
commit 0c056c8aa6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -63,6 +63,11 @@ func (c *Controller) Reconcile(ctx context.Context, req controllerruntime.Reques
return controllerruntime.Result{}, nil
}
if cluster.Spec.ImpersonatorSecretRef == nil {
klog.Infof("Aggregated API feature is disabled on cluster %s as it does not have an impersonator secret", cluster.Name)
return controllerruntime.Result{}, nil
}
err := c.syncImpersonationConfig(cluster)
if err != nil {
klog.Errorf("Failed to sync impersonation config for cluster %s. Error: %v.", cluster.Name, err)