Skip to content

Resume Scaling Controller

The Resume Scaling Controller is a controller that allows you to automatically resume scaling for a target (ScaledObject or ScaledJob) that has been paused. KEDA users can temporarily pause scaling for a target by setting a special annotation on a ScaledObject or ScaledJob. For example, to pause scaling for a ScaledObject, you can set the following annotation:

metadata:
annotations:
autoscaling.keda.sh/paused: true

Once paused, users need to manually unpause scaling for the target by removing the annotation. The Resume Scaling Controller automates this process by resuming scaling for a target based on a schedule defined by the user.

Resume At

“Resume At” specifies a particular date in RFC3339 format when the target should be resumed. For example, to resume scaling for a ScaledObject at 06:30 AM on 2025-01-01, you can set the following annotation:

metadata:
annotations:
autoscaling.keda.sh/paused: true
keda.kedify.io/pause-resume-at: '2025-01-01T06:30:00Z'

The Resume Scaling Controller will automatically remove the autoscaling.keda.sh/paused annotation at the specified time, resuming scaling for the target.

This feature is GitOps-friendly and can be used to automate scaling operations during maintenance windows. However, a potential drawback is that the timestamp includes a specific time and date with a timezone, which can be challenging to set correctly across multiple timezones.

Resume After

“Resume After” specifies a duration after which the target should be resumed. For example, to resume scaling for a ScaledObject after 1 hour, you can set the following annotation:

metadata:
annotations:
autoscaling.keda.sh/paused: true
keda.kedify.io/pause-resume-after: '1h'

The value of the annotation is a duration in Go format. The Resume Scaling Controller will automatically remove the autoscaling.keda.sh/paused annotation after the specified duration, resuming scaling for the target.

This feature is useful for users who want to pause scaling during a maintenance window and automatically resume scaling after the maintenance window ends. A limitation is that the duration is relative and cannot be directly used in GitOps workflows.

Since the duration is a relative time, the Resume Scaling Controller will calculate a specific date in RFC3339 format based on the current time and the specified duration, replacing the value of the keda.kedify.io/pause-resume-after annotation.

Using Resume At and Resume After Together

You can use both annotations together, and the Resume Scaling Controller will prioritize the earlier of the two to resume scaling.

Paused Reason

You can set a reason for pausing scaling by using the keda.kedify.io/paused-reason annotation. This annotation is optional and can provide context for why scaling was paused.

metadata:
annotations:
autoscaling.keda.sh/paused: true
keda.kedify.io/pause-resume-after: '1h'
keda.kedify.io/paused-reason: 'Maintenance window - patching to version v2.2.0'

This annotation is removed when scaling is resumed.

Example

metadata:
annotations:
autoscaling.keda.sh/paused: 'true'
autoscaling.keda.sh/paused-replicas: '3'
keda.kedify.io/pause-resume-after: '1h'
keda.kedify.io/paused-reason: 'Maintenance window - patching to version v2.2.0'

After 1 hour, the Resume Scaling Controller will remove all these annotations and resume scaling for the target.