mirror of
https://github.com/bapung/gitea-runner-operator.git
synced 2026-06-21 23:48:43 +00:00
Add verbose logging for debugging
This commit is contained in:
@@ -67,6 +67,8 @@ func (r *RunnerGroupReconciler) Reconcile(ctx context.Context, req ctrl.Request)
|
|||||||
return ctrl.Result{}, err
|
return ctrl.Result{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.Info("Reconciling RunnerGroup", "name", runnerGroup.Name, "namespace", runnerGroup.Namespace)
|
||||||
|
|
||||||
// 2. List Jobs owned by this RunnerGroup
|
// 2. List Jobs owned by this RunnerGroup
|
||||||
jobList := &batchv1.JobList{}
|
jobList := &batchv1.JobList{}
|
||||||
labelSelector := client.MatchingLabels{
|
labelSelector := client.MatchingLabels{
|
||||||
@@ -95,6 +97,8 @@ func (r *RunnerGroupReconciler) Reconcile(ctx context.Context, req ctrl.Request)
|
|||||||
return ctrl.Result{}, err
|
return ctrl.Result{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.Info("Checked active runners", "active", activeRunners, "max", runnerGroup.Spec.MaxActiveRunners)
|
||||||
|
|
||||||
// 4. Capacity Check
|
// 4. Capacity Check
|
||||||
if activeRunners >= runnerGroup.Spec.MaxActiveRunners {
|
if activeRunners >= runnerGroup.Spec.MaxActiveRunners {
|
||||||
logger.Info("Max active runners reached, skipping scaling",
|
logger.Info("Max active runners reached, skipping scaling",
|
||||||
@@ -111,6 +115,8 @@ func (r *RunnerGroupReconciler) Reconcile(ctx context.Context, req ctrl.Request)
|
|||||||
return ctrl.Result{}, err
|
return ctrl.Result{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.Info("Checking Gitea for queued jobs", "url", runnerGroup.Spec.GiteaURL, "scope", runnerGroup.Spec.Scope)
|
||||||
|
|
||||||
// Query for queued workflow runs
|
// Query for queued workflow runs
|
||||||
queuedJobs, err := r.GiteaClient.GetQueuedRuns(
|
queuedJobs, err := r.GiteaClient.GetQueuedRuns(
|
||||||
ctx,
|
ctx,
|
||||||
@@ -126,6 +132,8 @@ func (r *RunnerGroupReconciler) Reconcile(ctx context.Context, req ctrl.Request)
|
|||||||
return ctrl.Result{RequeueAfter: 10 * time.Second}, err
|
return ctrl.Result{RequeueAfter: 10 * time.Second}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.Info("Gitea query result", "queuedJobs", queuedJobs)
|
||||||
|
|
||||||
// 6. Scale Up
|
// 6. Scale Up
|
||||||
availableSlots := runnerGroup.Spec.MaxActiveRunners - activeRunners
|
availableSlots := runnerGroup.Spec.MaxActiveRunners - activeRunners
|
||||||
toSpawn := min(queuedJobs, availableSlots)
|
toSpawn := min(queuedJobs, availableSlots)
|
||||||
|
|||||||
Reference in New Issue
Block a user