diff --git a/CHANGELOG.md b/CHANGELOG.md index a3bf8261cf2..826a0343cc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -74,6 +74,7 @@ Here is an overview of all new **experimental** features: - **General**: Centralize and improve automaxprocs configuration with proper structured logging ([#5970](https://github.com/kedacore/keda/issues/5970)) - **General**: Paused ScaledObject count is reported correctly after operator restart ([#6321](https://github.com/kedacore/keda/issues/6321)) +- **General**: ScaledJobs ready status set to true when recoverred problem ([#6329](https://github.com/kedacore/keda/pull/6329)) ### Deprecations diff --git a/pkg/scaling/executor/scale_jobs.go b/pkg/scaling/executor/scale_jobs.go index b32eb344f07..c1dc4adf315 100644 --- a/pkg/scaling/executor/scale_jobs.go +++ b/pkg/scaling/executor/scale_jobs.go @@ -65,10 +65,10 @@ 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() { @@ -76,6 +76,15 @@ func (e *scaleExecutor) RequestJobScale(ctx context.Context, scaledJob *kedav1al logger.Error(err, "error setting ready condition") } } + } else if !readyCondition.IsTrue() { + // 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' + 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()