Skip to content

Commit f1b5784

Browse files
committed
cron scaler
1 parent 3711ac5 commit f1b5784

File tree

3 files changed

+58
-3
lines changed

3 files changed

+58
-3
lines changed

charts/synapse/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
---
22
name: synapse
3-
version: 0.23.0
3+
version: 0.24.0

charts/synapse/templates/synapse-hpa.yaml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{{- range $worker, $options := .Values.synapse.autoscalingWorkers }}
2-
{{- if $options.autoscaling.enabled }}
32
{{- $name := $worker | replace "_" "-"}}
3+
{{- if $options.autoscaling.enabled }}
44
---
55
apiVersion: autoscaling/v2
66
kind: HorizontalPodAutoscaler
@@ -19,7 +19,7 @@ spec:
1919
name: cpu
2020
target:
2121
type: Utilization
22-
averageUtilization: 75
22+
averageUtilization: 65
2323
behavior:
2424
scaleDown:
2525
stabilizationWindowSeconds: 300
@@ -34,4 +34,23 @@ spec:
3434
value: 2
3535
periodSeconds: 15
3636
{{- end }}
37+
{{- if $options.kedaAutoscaling.enabled }}
38+
---
39+
apiVersion: keda.sh/v1alpha1
40+
kind: ScaledObject
41+
metadata:
42+
name: synapse-{{ $name }}-cron
43+
spec:
44+
scaleTargetRef:
45+
name: synapse-{{ $name }}
46+
minReplicaCount: {{ $options.kedaAutoscaling.minReplicaCount }}
47+
cooldownPeriod: 300
48+
triggers:
49+
- type: cron
50+
metadata:
51+
timezone: {{ $options.kedaAutoscaling.timezone | quote }}
52+
start: {{ $options.kedaAutoscaling.start | quote }}
53+
end: {{ $options.kedaAutoscaling.end | quote }}
54+
desiredReplicas: {{ $options.kedaAutoscaling.desiredReplicas | quote }}
55+
{{- end }}
3756
{{- end }}

charts/synapse/values.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,63 @@ synapse:
3636
federation_sender:
3737
replicas: 1
3838
resources: {}
39+
# https://keda.sh/docs/2.17/scalers/cron/
40+
kedaAutoscaling:
41+
enabled: false
42+
timezone: "Europe/Kyiv"
43+
start: "0 9 * * *"
44+
end: "0 19 * * *"
45+
desiredReplicas: 5
46+
minReplicaCount: 2
47+
# HPA
3948
autoscaling:
4049
enabled: true
4150
minReplicas: 1
4251
maxReplicas: 10
4352
client_reader:
4453
replicas: 2
4554
resources: {}
55+
# https://keda.sh/docs/2.17/scalers/cron/
56+
kedaAutoscaling:
57+
enabled: false
58+
timezone: "Europe/Kyiv"
59+
start: "0 9 * * *"
60+
end: "0 19 * * *"
61+
desiredReplicas: 15
62+
minReplicaCount: 5
63+
# HPA
4664
autoscaling:
4765
enabled: true
4866
minReplicas: 1
4967
maxReplicas: 10
5068
event_creator:
5169
replicas: 2
5270
resources: {}
71+
# https://keda.sh/docs/2.17/scalers/cron/
72+
kedaAutoscaling:
73+
enabled: false
74+
timezone: "Europe/Kyiv"
75+
start: "0 9 * * *"
76+
end: "0 19 * * *"
77+
desiredReplicas: 5
78+
minReplicaCount: 2
79+
# HPA
5380
autoscaling:
5481
enabled: true
5582
minReplicas: 1
5683
maxReplicas: 10
5784
media_repository:
5885
replicas: 2
5986
resources: {}
87+
# https://keda.sh/docs/2.17/scalers/cron/
88+
kedaAutoscaling:
89+
enabled: false
90+
timezone: "Europe/Kyiv"
91+
start: "0 9 * * *"
92+
end: "0 19 * * *"
93+
desiredReplicas: 5
94+
minReplicaCount: 2
95+
# HPA
6096
autoscaling:
6197
enabled: true
6298
minReplicas: 1

0 commit comments

Comments
 (0)