Requeue ssar check if only hubKubeConfigSecret is unauthorized (#1169)
Some checks failed
Scorecard supply-chain security / Scorecard analysis (push) Failing after 39s
Post / coverage (push) Failing after 28s
Post / images (amd64, addon-manager) (push) Failing after 27s
Post / images (amd64, placement) (push) Failing after 29s
Post / images (amd64, registration) (push) Failing after 27s
Post / images (amd64, registration-operator) (push) Failing after 33s
Post / images (amd64, work) (push) Failing after 29s
Post / images (arm64, addon-manager) (push) Failing after 27s
Post / images (arm64, placement) (push) Failing after 26s
Post / images (arm64, registration) (push) Failing after 32s
Post / images (arm64, registration-operator) (push) Failing after 31s
Post / images (arm64, work) (push) Failing after 34s
Post / image manifest (addon-manager) (push) Has been skipped
Post / image manifest (placement) (push) Has been skipped
Post / image manifest (registration) (push) Has been skipped
Post / image manifest (registration-operator) (push) Has been skipped
Post / image manifest (work) (push) Has been skipped
Post / trigger clusteradm e2e (push) Has been skipped
Close stale issues and PRs / stale (push) Successful in 50s

Signed-off-by: Jian Qiu <jqiu@redhat.com>
This commit is contained in:
Jian Qiu
2025-09-05 10:26:30 +08:00
committed by GitHub
parent c93f90f59a
commit 7d42f5f9f6

View File

@@ -91,6 +91,8 @@ func (l *klusterletLocker) deleteSSARChecking(klusterletName string) {
}
func (c *ssarController) sync(ctx context.Context, controllerContext factory.SyncContext) error {
logger := klog.FromContext(ctx)
klusterletName := controllerContext.QueueKey()
if klusterletName == "" {
return nil
@@ -106,7 +108,7 @@ func (c *ssarController) sync(ctx context.Context, controllerContext factory.Syn
// if the ssar checking is already processing, requeue it after 30s.
if c.inSSARChecking(klusterletName) {
klog.V(4).Infof("Reconciling Klusterlet %q is already processing now", klusterletName)
logger.V(4).Info("Reconciling Klusterlet is already processing now", "name", klusterletName)
controllerContext.Queue().AddAfter(klusterletName, SSARReSyncTime)
return nil
}
@@ -117,7 +119,7 @@ func (c *ssarController) sync(ctx context.Context, controllerContext factory.Syn
newKlusterlet := klusterlet.DeepCopy()
klog.V(4).Infof("Checking hub kubeconfig for klusterlet %q", klusterletName)
logger.V(4).Info("Checking hub kubeconfig for klusterlet", "name", klusterletName)
agentNamespace := helpers.AgentNamespace(klusterlet)
hubConfigDegradedCondition := checkAgentDegradedCondition(
@@ -137,7 +139,7 @@ func (c *ssarController) sync(ctx context.Context, controllerContext factory.Syn
meta.SetStatusCondition(&newKlusterlet.Status.Conditions, hubConfigDegradedCondition)
_, err := c.patcher.PatchStatus(ctx, newKlusterlet, newKlusterlet.Status, klusterlet.Status)
if err != nil {
klog.Errorf("Update Klusterlet Status Failed: %v", err)
logger.Error(err, "Update Klusterlet Status Failed")
controllerContext.Queue().AddAfter(klusterletName, SSARReSyncTime)
}
@@ -172,7 +174,14 @@ func (c *ssarController) sync(ctx context.Context, controllerContext factory.Syn
})
_, err := c.patcher.PatchStatus(ctx, newKlusterlet, newKlusterlet.Status, klusterlet.Status)
if err != nil {
klog.Errorf("Update Klusterlet Status Failed: %v", err)
logger.Error(err, "Update Klusterlet Status Failed")
controllerContext.Queue().AddAfter(klusterletName, SSARReSyncTime)
}
// We need to requeue when only hubKubeConfigSecret is not authorized, since we do not know whether managercluster
// is accepted or permission is created.
if hubConfigDegradedCondition.Reason == operatorapiv1.ReasonHubKubeConfigUnauthorized &&
bootstrapDegradedCondition.Reason == "BootstrapSecretFunctional" {
controllerContext.Queue().AddAfter(klusterletName, SSARReSyncTime)
}
}