Apply suggestions from code review
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
2a8056e628
commit
c37f1aeef1
|
|
@ -341,13 +341,11 @@ func (ars *AutoscalingRunnerSet) Hash() string {
|
|||
type data struct {
|
||||
Spec *AutoscalingRunnerSetSpec
|
||||
Labels map[string]string
|
||||
Phase AutoscalingRunnerSetPhase
|
||||
}
|
||||
|
||||
d := &data{
|
||||
Spec: ars.Spec.DeepCopy(),
|
||||
Labels: ars.Labels,
|
||||
Phase: ars.Status.Phase,
|
||||
}
|
||||
|
||||
return hash.ComputeTemplateHash(d)
|
||||
|
|
|
|||
|
|
@ -339,6 +339,7 @@ func (r *EphemeralRunnerReconciler) Reconcile(ctx context.Context, req ctrl.Requ
|
|||
case 7:
|
||||
if err := r.markAsOutdated(ctx, ephemeralRunner, log); err != nil {
|
||||
log.Error(err, "Failed to set ephemeral runner to phase Outdated")
|
||||
return ctrl.Result{}, err
|
||||
}
|
||||
return ctrl.Result{}, nil
|
||||
}
|
||||
|
|
@ -366,6 +367,7 @@ func (r *EphemeralRunnerReconciler) Reconcile(ctx context.Context, req ctrl.Requ
|
|||
case cs.State.Terminated.ExitCode == 7: // outdated
|
||||
if err := r.markAsOutdated(ctx, ephemeralRunner, log); err != nil {
|
||||
log.Error(err, "Failed to set ephemeral runner to phase Outdated")
|
||||
return ctrl.Result{}, err
|
||||
}
|
||||
return ctrl.Result{}, nil
|
||||
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ func (r *EphemeralRunnerSetReconciler) Reconcile(ctx context.Context, req ctrl.R
|
|||
ephemeralRunnersByState := newEphemeralRunnersByStates(ephemeralRunnerList)
|
||||
|
||||
log.Info("Ephemeral runner counts",
|
||||
"outdated", ephemeralRunnersByState.outdated,
|
||||
"outdated", len(ephemeralRunnersByState.outdated),
|
||||
"pending", len(ephemeralRunnersByState.pending),
|
||||
"running", len(ephemeralRunnersByState.running),
|
||||
"finished", len(ephemeralRunnersByState.finished),
|
||||
|
|
@ -240,10 +240,10 @@ func (r *EphemeralRunnerSetReconciler) updateStatus(ctx context.Context, ephemer
|
|||
total := state.scaleTotal()
|
||||
var phase v1alpha1.EphemeralRunnerSetPhase
|
||||
switch {
|
||||
case ephemeralRunnerSet.Status.Phase == "":
|
||||
phase = v1alpha1.EphemeralRunnerSetPhaseRunning
|
||||
case len(state.outdated) > 0:
|
||||
phase = v1alpha1.EphemeralRunnerSetPhaseOutdated
|
||||
case ephemeralRunnerSet.Status.Phase == "":
|
||||
phase = v1alpha1.EphemeralRunnerSetPhaseRunning
|
||||
default:
|
||||
phase = ephemeralRunnerSet.Status.Phase
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue