mirror of
https://github.com/lukaszraczylo/kubernetes-images-sync-operator.git
synced 2026-12-06 07:14:14 +00:00
ci(pr): grant actions read and stop using the deprecated Requeue
* ci(pr): grant actions read so the shared PR checks start go-pr.yaml's CodeQL job asks for actions: read. A reusable workflow cannot ask for more than its caller grants, so the whole PR run failed at startup with no jobs. Grant the missing scope. * refactor(controller): use RequeueAfter instead of the deprecated Requeue controller-runtime deprecates Result.Requeue (SA1019), which the PR checks now report because they finally start. Requeue after 30 seconds, the interval the cluster image controller already uses for its max-parallel wait. --------- Co-authored-by: Bug Fixer <[email protected]>
This commit is contained in:
@@ -251,10 +251,10 @@ func (r *ClusterImageExportReconciler) Reconcile(ctx context.Context, req ctrl.R
|
||||
|
||||
// If there are still pending images, requeue
|
||||
if pendingCount > 0 {
|
||||
return ctrl.Result{Requeue: true}, nil
|
||||
return ctrl.Result{RequeueAfter: time.Second * 30}, nil
|
||||
}
|
||||
|
||||
return ctrl.Result{Requeue: true}, nil
|
||||
return ctrl.Result{RequeueAfter: time.Second * 30}, nil
|
||||
}
|
||||
|
||||
// updateStatusWithRetry attempts to update the status of a ClusterImageExport with retries
|
||||
@@ -351,21 +351,21 @@ func (r *ClusterImageExportReconciler) handleDeletion(ctx context.Context, clust
|
||||
}
|
||||
if err := r.Delete(ctx, existingJob, &deleteOptions); err != nil && !errors.IsNotFound(err) {
|
||||
l.Error(err, "Failed to delete existing cleanup job")
|
||||
return ctrl.Result{Requeue: true}, nil
|
||||
return ctrl.Result{RequeueAfter: time.Second * 30}, nil
|
||||
}
|
||||
l.Info("Successfully deleted existing cleanup job", "job", jobName)
|
||||
// Requeue to wait for job deletion to complete
|
||||
return ctrl.Result{Requeue: true}, nil
|
||||
return ctrl.Result{RequeueAfter: time.Second * 30}, nil
|
||||
} else if !errors.IsNotFound(err) {
|
||||
// Unexpected error
|
||||
l.Error(err, "Error checking for existing cleanup job")
|
||||
return ctrl.Result{Requeue: true}, nil
|
||||
return ctrl.Result{RequeueAfter: time.Second * 30}, nil
|
||||
}
|
||||
|
||||
// Create new cleanup job
|
||||
if err := r.runCleanupJob(ctx, clusterImageExport); err != nil {
|
||||
l.Error(err, "Failed to create cleanup job")
|
||||
return ctrl.Result{Requeue: true}, nil
|
||||
return ctrl.Result{RequeueAfter: time.Second * 30}, nil
|
||||
}
|
||||
|
||||
// Only remove finalizer after cleanup job is created successfully
|
||||
|
||||
Reference in New Issue
Block a user