Skip to content

Commit 0ea5774

Browse files
msvticketJorTurFer
authored andcommitted
fix: scaledjobs stuck as not ready (kedacore#6329)
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 kedacore#5916 Signed-off-by: Mårten Svantesson <[email protected]> Signed-off-by: Jorge Turrado <[email protected]>
1 parent b10caf1 commit 0ea5774

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

pkg/scaling/executor/scale_jobs.go

+10-1
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,26 @@ func (e *scaleExecutor) RequestJobScale(ctx context.Context, scaledJob *kedav1al
6565
logger.V(1).Info("No change in activity")
6666
}
6767

68+
readyCondition := scaledJob.Status.Conditions.GetReadyCondition()
6869
if isError {
6970
// some triggers responded with error
7071
// Set ScaledJob.Status.ReadyCondition to Unknown
71-
readyCondition := scaledJob.Status.Conditions.GetReadyCondition()
7272
msg := "Some triggers defined in ScaledJob are not working correctly"
7373
logger.V(1).Info(msg)
7474
if !readyCondition.IsUnknown() {
7575
if err := e.setReadyCondition(ctx, logger, scaledJob, metav1.ConditionUnknown, "PartialTriggerError", msg); err != nil {
7676
logger.Error(err, "error setting ready condition")
7777
}
7878
}
79+
} else if !readyCondition.IsTrue() {
80+
// if the ScaledObject's triggers aren't in the error state,
81+
// but ScaledJob.Status.ReadyCondition is set not set to 'true' -> set it back to 'true'
82+
msg := "ScaledJob is defined correctly and is ready for scaling"
83+
logger.V(1).Info(msg)
84+
if err := e.setReadyCondition(ctx, logger, scaledJob, metav1.ConditionTrue,
85+
"ScaledJobReady", msg); err != nil {
86+
logger.Error(err, "error setting ready condition")
87+
}
7988
}
8089

8190
condition := scaledJob.Status.Conditions.GetActiveCondition()

0 commit comments

Comments
 (0)