From 54148ad49fe111db048acbb553047beff9ff0581 Mon Sep 17 00:00:00 2001 From: aharonh Date: Tue, 21 Feb 2023 15:56:52 +0200 Subject: [PATCH] fix: The paused-replicas annotation not fully respected (#4253) Signed-off-by: aharonh --- CHANGELOG.md | 5 ++++- controllers/keda/scaledobject_controller.go | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08f3ca53462..2b36af15b97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,14 +41,17 @@ To learn more about active deprecations, we recommend checking [GitHub Discussio ## Unreleased +- **General** + ### Breaking Changes -- TODO +- TODO ### New Here is an overview of all **stable** additions: +- **General**: Improve error logging by skipping reconciliation and therefore logging of errors related to paused ScaledObject ([#4254](https://github.com/kedacore/keda/issues/4254)) - **General**: Add support to register custom CAs globally in KEDA operator ([#4168](https://github.com/kedacore/keda/issues/4168)) - **General**: Introduce admission webhooks to automatically validate resource changes to prevent misconfiguration and enforce best practices ([#3755](https://github.com/kedacore/keda/issues/3755)) - **General**: Introduce new ArangoDB Scaler ([#4000](https://github.com/kedacore/keda/issues/4000)) diff --git a/controllers/keda/scaledobject_controller.go b/controllers/keda/scaledobject_controller.go index aa4d32530b1..abd40b5887f 100644 --- a/controllers/keda/scaledobject_controller.go +++ b/controllers/keda/scaledobject_controller.go @@ -149,6 +149,13 @@ func (r *ScaledObjectReconciler) Reconcile(ctx context.Context, req ctrl.Request return ctrl.Result{}, err } + // if the ScaledObject is paused, skip processing the request + _, paused := scaledObject.GetAnnotations()[kedacontrollerutil.PausedReplicasAnnotation] + if paused { + reqLogger.Info("ScaledObject is paused, so skipping the request.") + return ctrl.Result{}, nil + } + reqLogger.Info("Reconciling ScaledObject") // Check if the ScaledObject instance is marked to be deleted, which is