Skip to content

Commit fc27e39

Browse files
committed
fix: scaledjobs stuck as not ready
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]>
1 parent 8332446 commit fc27e39

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

pkg/scaling/executor/scale_jobs.go

+12-1
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,28 @@ 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 {
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+
if !readyCondition.IsTrue() {
83+
msg := "ScaledJob is defined correctly and is ready for scaling"
84+
logger.V(1).Info(msg)
85+
if err := e.setReadyCondition(ctx, logger, scaledJob, metav1.ConditionTrue,
86+
"ScaledJobReady", msg); err != nil {
87+
logger.Error(err, "error setting ready condition")
88+
}
89+
}
7990
}
8091

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

0 commit comments

Comments
 (0)