Skip to content

Commit

Permalink
fix: scaledjobs stuck as not ready
Browse files Browse the repository at this point in the history
since code was missing for setting a scaledjob as ready it was stuck as unready if there ever was a problem

This is a fix for a regression in #5916

Signed-off-by: Mårten Svantesson <[email protected]>
  • Loading branch information
msvticket committed Nov 12, 2024
1 parent 8332446 commit fc27e39
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pkg/scaling/executor/scale_jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,28 @@ func (e *scaleExecutor) RequestJobScale(ctx context.Context, scaledJob *kedav1al
logger.V(1).Info("No change in activity")
}

readyCondition := scaledJob.Status.Conditions.GetReadyCondition()
if isError {
// some triggers responded with error
// Set ScaledJob.Status.ReadyCondition to Unknown
readyCondition := scaledJob.Status.Conditions.GetReadyCondition()
msg := "Some triggers defined in ScaledJob are not working correctly"
logger.V(1).Info(msg)
if !readyCondition.IsUnknown() {
if err := e.setReadyCondition(ctx, logger, scaledJob, metav1.ConditionUnknown, "PartialTriggerError", msg); err != nil {
logger.Error(err, "error setting ready condition")
}
}
} else {
// if the ScaledObject's triggers aren't in the error state,
// but ScaledJob.Status.ReadyCondition is set not set to 'true' -> set it back to 'true'
if !readyCondition.IsTrue() {
msg := "ScaledJob is defined correctly and is ready for scaling"
logger.V(1).Info(msg)
if err := e.setReadyCondition(ctx, logger, scaledJob, metav1.ConditionTrue,
"ScaledJobReady", msg); err != nil {
logger.Error(err, "error setting ready condition")
}
}
}

condition := scaledJob.Status.Conditions.GetActiveCondition()
Expand Down

0 comments on commit fc27e39

Please sign in to comment.