Skip to content

Commit 852be4d

Browse files
authored
Merge pull request #80708 from mburke5678/cma-cron-trigger
OSDOCS:11739 add support for cron scaler in CMA
2 parents 755d23b + 21d7464 commit 852be4d

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * nodes/cma/nodes-cma-autoscaling-custom-trigger.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="nodes-cma-autoscaling-custom-trigger-cron_{context}"]
7+
= Understanding the cron trigger
8+
9+
You can scale pods based on a time range.
10+
11+
When the time range starts, the custom metrics autoscaler scales the pods associated with an object from the configured minimum number of pods to the specified number of desired pods. At the end of the time range, the pods are scaled back to the configured minimum. The time period must be configured in link:https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#writing-a-cronjob-spec[cron format].
12+
13+
[NOTE]
14+
====
15+
The custom metrics autoscaler with cron trigger scales pods based only on the specified times and cannot scale pods on a daily, weekly, monthly, or yearly schedule.
16+
====
17+
18+
The following example scales the pods associated with this scaled object from `0` to `100` from 6:00 AM to 6:30 PM India Standard Time.
19+
20+
.Example scaled object with a cron trigger
21+
[source,yaml]
22+
----
23+
apiVersion: keda.sh/v1alpha1
24+
kind: ScaledObject
25+
metadata:
26+
name: cron-scaledobject
27+
namespace: default
28+
spec:
29+
scaleTargetRef:
30+
name: my-deployment
31+
minReplicaCount: 0 <1>
32+
maxReplicaCount: 100 <2>
33+
cooldownPeriod: 300
34+
triggers:
35+
- type: cron <3>
36+
metadata:
37+
timezone: Asia/Kolkata <4>
38+
start: "0 6 * * *" <5>
39+
end: "30 18 * * *" <6>
40+
desiredReplicas: "100" <7>
41+
----
42+
<1> Specifies the minimum number of pods to scale down to at the end of the time frame.
43+
<2> Specifies the maximum number of replicas when scaling up. This value should be the same as `desiredReplicas`. The default is `100`.
44+
<3> Specifies a cron trigger.
45+
<4> Specifies the timezone for the time frame. This value must be from the link:https://data.iana.org/time-zones/tzdb-2021a/zone1970.tab[IANA Time Zone Database].
46+
<5> Specifies the start of the time frame.
47+
<6> Specifies the end of the time frame.
48+
<7> Specifies the number of pods to scale to between the start and end of the time frame. This value should be the same as `maxReplicaCount`.

nodes/cma/nodes-cma-autoscaling-custom-trigger.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ include::modules/nodes-cma-autoscaling-custom-prometheus-config.adoc[leveloffset
2424
include::modules/nodes-cma-autoscaling-custom-trigger-cpu.adoc[leveloffset=+1]
2525
include::modules/nodes-cma-autoscaling-custom-trigger-memory.adoc[leveloffset=+1]
2626
include::modules/nodes-cma-autoscaling-custom-trigger-kafka.adoc[leveloffset=+1]
27+
include::modules/nodes-cma-autoscaling-custom-trigger-cron.adoc[leveloffset=+1]
2728

0 commit comments

Comments
 (0)