ScalingPolicy API reference
A ScalingPolicy changes configured scaling fields during action windows. It is not a Cron replica trigger. Keep targets within the supported namespace and account for priority when actions overlap; pausing the policy does not directly pause its target workloads.
API details
Section titled “API details”Group: keda.kedify.io. Kind: ScalingPolicy. Scope: Namespaced.
Defaults below are schema defaults only. “Not specified” does not imply a controller default of zero or false. Required fields are required within their containing object. Runtime behavior can impose additional conditions described in the capability guide.
v1alpha1 fields
Section titled “v1alpha1 fields”Served: true; storage: true.
| Field | Type | Required | Schema default | Meaning and validation |
|---|---|---|---|---|
spec | object | No | Not specified | ScalingPolicySpec defines the desired state of ScalingPolicy |
spec.actions | array | Yes | Not specified | Action is the list of actions to be taken |
spec.actions[] | object | No | Not specified | ScalingAction defines the action to be taken |
spec.actions[].adjustment | object | Yes | Not specified | ActionAdjustment defines the adjustment for the action |
spec.actions[].adjustment.idleReplicaCount | integer | No | Not specified | Idle replica count applied to ScaledObjects during the window; unsupported for ScaledJobs. |
spec.actions[].adjustment.maxReplicaCount | integer | No | Not specified | Maximum replica count applied during the active window. |
spec.actions[].adjustment.minReplicaCount | integer | No | Not specified | Minimum replica count applied during the active window. |
spec.actions[].adjustment.pauseConfig | object | No | Not specified | PauseConfig defines the pause configuration |
spec.actions[].adjustment.pauseConfig.paused | boolean | No | Not specified | Paused is the flag to pause the scaling policy autoscaling.keda.sh/paused |
spec.actions[].adjustment.pauseConfig.replicas | integer | No | Not specified | Replicas is the number of replicas to be set when the scaling policy is paused autoscaling.keda.sh/paused-replicas |
spec.actions[].adjustment.pollingInterval | integer | No | Not specified | Polling interval in seconds; must not be negative. |
spec.actions[].name | string | Yes | Not specified | Nonempty action name; also breaks ties between equal priorities lexicographically. |
spec.actions[].priority | integer | No | Not specified | Priority orders actions when more than one is active at the same time. Higher numeric value means higher priority. Adjustments are merged field by field in ascending priority order (ties broken by lexicographic name), so a non-nil field on the highest-priority action overrides the same field from lower-priority actions; fields left unset fall through to lower-priority values. Required when more than one action is defined. |
spec.actions[].trigger | object | No | Not specified | ActionTrigger defines the trigger for the action |
spec.actions[].trigger.schedule | object | Yes | Not specified | ActionTriggerSchedule defines the schedule for the trigger |
spec.actions[].trigger.schedule.end | string | Yes | Not specified | Window end as a five-field cron expression, interpreted in the specified timezone. |
spec.actions[].trigger.schedule.start | string | Yes | Not specified | Window start as a five-field cron expression (minute, hour, day of month, month, day of week). |
spec.actions[].trigger.schedule.timezone | string | Yes | Not specified | Required IANA timezone, for example Europe/Prague; use UTC to avoid daylight-saving shifts. |
spec.targets | array | Yes | Not specified | Targets is the list target resources to be modified |
spec.targets[] | object | No | Not specified | ScalingActionTarget defines the target resource to be modified |
spec.targets[].apiVersion | string | No | Not specified | API group/version of the target, for example keda.sh/v1alpha1. |
spec.targets[].kind | string | Yes | Not specified | Target kind: ScaledObject or ScaledJob. |
spec.targets[].name | string | Yes | Not specified | Target resource name in the same namespace as the ScalingPolicy. |
status
Section titled “status”| Field | Type | Required | Schema default | Meaning and validation |
|---|---|---|---|---|
status | object | No | Not specified | ScalingPolicyStatus defines the observed state of ScalingPolicy |
status.actions | array | No | Not specified | |
status.actions[] | object | No | Not specified | ScalingPolicyStatusAction defines the status of the action |
status.actions[].active | boolean | No | Not specified | |
status.actions[].applied | boolean | No | Not specified | |
status.actions[].message | string | No | Not specified | |
status.actions[].name | string | No | Not specified | |
status.actions[].scheduleEnd | string | No | Not specified | |
status.actions[].scheduleStart | string | No | Not specified | |
status.active | boolean | No | Not specified | |
status.conditions | array | No | Not specified | |
status.conditions[] | object | No | Not specified | Condition contains details for one aspect of the current state of this API Resource. |
status.conditions[].lastTransitionTime | string | Yes | Not specified | lastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. |
status.conditions[].message | string | Yes | Not specified | message is a human readable message indicating details about the transition. This may be an empty string. maxLength: 32768 |
status.conditions[].observedGeneration | integer | No | Not specified | observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance. minimum: 0 |
status.conditions[].reason | string | Yes | Not specified | reason contains a programmatic identifier indicating the reason for the condition’s last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty. minLength: 1; maxLength: 1024; pattern: ”^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$” |
status.conditions[].status | string | Yes | Not specified | status of the condition, one of True, False, Unknown. enum: [“True”,“False”,“Unknown”] |
status.conditions[].type | string | Yes | Not specified | type of condition in CamelCase or in foo.example.com/CamelCase. maxLength: 316; pattern: ”^([a-z0-9]([-a-z0-9][a-z0-9])?(\.[a-z0-9]([-a-z0-9][a-z0-9])?)/)?(([A-Za-z0-9][-A-Za-z0-9_.])?[A-Za-z0-9])$” |
status.schedule | object | No | Not specified | ScheduleStatus defines the status of the schedule |
status.schedule.lastEnd | string | No | Not specified | Most recently recorded window end. |
status.schedule.lastStart | string | No | Not specified | Most recently recorded window start. |
status.schedule.nextEnd | string | No | Not specified | Next scheduled window end reported by the controller. |
status.schedule.nextSchedule | string | No | Not specified | Next scheduled controller evaluation time. |
status.schedule.nextStart | string | No | Not specified | Next scheduled window start reported by the controller. |
status.targets | object | No | Not specified | |
status.targets.* | object | No | Not specified | ScalingPolicyStatusTarget defines the status of the target |
status.targets.*.message | string | No | Not specified | Human-readable details of the target condition. |
status.targets.*.name | string | No | Not specified | Target resource name. |
status.targets.*.namespace | string | No | Not specified | Target namespace. |
status.targets.*.originalConfig | object | No | Not specified | ActionAdjustment defines the adjustment for the action |
status.targets.*.originalConfig.idleReplicaCount | integer | No | Not specified | |
status.targets.*.originalConfig.maxReplicaCount | integer | No | Not specified | |
status.targets.*.originalConfig.minReplicaCount | integer | No | Not specified | |
status.targets.*.originalConfig.pauseConfig | object | No | Not specified | PauseConfig defines the pause configuration |
status.targets.*.originalConfig.pauseConfig.paused | boolean | No | Not specified | Paused is the flag to pause the scaling policy autoscaling.keda.sh/paused |
status.targets.*.originalConfig.pauseConfig.replicas | integer | No | Not specified | Replicas is the number of replicas to be set when the scaling policy is paused autoscaling.keda.sh/paused-replicas |
status.targets.*.originalConfig.pollingInterval | integer | No | Not specified | |
status.targets.*.reason | string | No | Not specified | Machine-readable reason for the target condition. |
status.targets.*.status | string | Yes | Not specified | Target adjustment condition: True, False or Unknown; read reason and message together. |
status.validatedGeneration | integer | No | Not specified | Resource generation last validated by the controller. |
Inspect the installed contract
Section titled “Inspect the installed contract”kubectl get crd scalingpolicies.keda.kedify.io -o yamlkubectl explain scalingpolicy.spec --recursiveCompare served/storage versions and schema before applying configuration. Inspect the resource’s status and events after changing its owning source; schema acceptance alone does not prove successful reconciliation.
Use, verify and diagnose
Section titled “Use, verify and diagnose”- Scaling Policy: scheduled configuration
- Pause and resume scaling for maintenance
- Prepare for predictable demand
Actions
Section titled “Actions”An action is a set of rules that define when and how to scale the target.
trigger defines when the action should be executed and adjustment defines how the target should be scaled.
Triggers:
Section titled “Triggers:”Schedules use five-field cron expressions (Minute Hour DayOfMonth Month DayOfWeek).
schedule: A cron-like trigger that defines when the action should be executed with the following fields:start: The start time of the schedule. For example30 6 * * *, at 06:30 AM.end: The end time of the schedule. For example0 14 * * *, at 02:00 PM.timezone: The timezone of the schedule. For exampleEurope/Prague.
Adjustments:
Section titled “Adjustments:”The following adjustments are supported:
pollingInterval: The interval in seconds at which the target should be polled.idleReplicaCount: The number of replicas to scale down to when the target is idle (not supported by ScaledJobs).minReplicaCount: The minimum number of replicas the target should have.maxReplicaCount: The maximum number of replicas the target should have.pauseConfig: Paused related settings.paused: Scaling will paused for a target (ScaledObject or ScaledJob).replicas: Scaling will paused at the specific number of replicas for a target (only ScaledObject is supported).
Example adjustment:
adjustment: pollingInterval: 10 idleReplicaCount: 0 minReplicaCount: 5 maxReplicaCount: 99 pauseConfig: replicas: 0 paused: trueYou can define overlapping actions with different priorities and the adjustment parameters will get merged with the highest priority value winning (an action with priority: 3 overrides one with priority: 1).
Targets
Section titled “Targets”A target is a reference to a resource that you want to apply the scaling policy to. Scaling policy supports only targets in the same namespace.
Supported targets are:
- ScaledObject
- ScaledJob