Skip to content

Commit 8cc76e8

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 8cc76e8

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ Here is an overview of all new **experimental** features:
7373
### Fixes
7474

7575
- **General**: Paused ScaledObject count is reported correctly after operator restart ([#6321](https://github.com/kedacore/keda/issues/6321))
76+
- **General**: ScaledJobs ready status set to true when recoverred problem ([#6329](https://github.com/kedacore/keda/pull/6329))
7677

7778
### Deprecations
7879

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)