Skip to content

Commit 49e2551

Browse files
authored
feat(application-template): keda scaledobject resource 지원하도록 수정 (#25)
1 parent e48f826 commit 49e2551

File tree

5 files changed

+146
-3
lines changed

5 files changed

+146
-3
lines changed

charts/application-template/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ maintainers:
99
- name: modusign
1010
url: https://github.com/modusign
1111
name: application-template
12-
version: 1.6.2
12+
version: 1.7.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{{- if .Values.scheduler.scaledObject.enabled | default false}}
2+
apiVersion: keda.sh/v1alpha1
3+
kind: ScaledObject
4+
metadata:
5+
name: {{ template "application.scheduler.name" . }}-scaledobject
6+
namespace: {{ .Release.Namespace }}
7+
spec:
8+
{{- with .Values.scheduler.scaledObject }}
9+
{{- with .scaleTargetRef }}
10+
scaleTargetRef:
11+
apiVersion: {{ .apiVersion }}
12+
kind: {{ .kind }}
13+
name: {{ .name }}
14+
{{- if .envSourceContainerName }}
15+
envSourceContainerName: {{ .envSourceContainerName }}
16+
{{- end }}
17+
{{- end }}
18+
minReplicaCount: {{ .minReplicaCount }}
19+
maxReplicaCount: {{ .maxReplicaCount }}
20+
triggers:
21+
{{- toYaml .triggers | nindent 4 }}
22+
{{- end }}
23+
{{- end}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{{- if .Values.server.scaledObject.enabled | default false}}
2+
apiVersion: keda.sh/v1alpha1
3+
kind: ScaledObject
4+
metadata:
5+
name: {{ template "application.server.name" . }}-scaledobject
6+
namespace: {{ .Release.Namespace }}
7+
spec:
8+
{{- with .Values.server.scaledObject }}
9+
{{- with .scaleTargetRef }}
10+
scaleTargetRef:
11+
apiVersion: {{ .apiVersion }}
12+
kind: {{ .kind }}
13+
name: {{ .name }}
14+
{{- if .envSourceContainerName }}
15+
envSourceContainerName: {{ .envSourceContainerName }}
16+
{{- end }}
17+
{{- end }}
18+
minReplicaCount: {{ .minReplicaCount }}
19+
maxReplicaCount: {{ .maxReplicaCount }}
20+
triggers:
21+
{{- toYaml .triggers | nindent 4 }}
22+
{{- end }}
23+
{{- end}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{{- if .Values.worker.scaledObject.enabled | default false}}
2+
apiVersion: keda.sh/v1alpha1
3+
kind: ScaledObject
4+
metadata:
5+
name: {{ template "application.worker.name" . }}-scaledobject
6+
namespace: {{ .Release.Namespace }}
7+
spec:
8+
{{- with .Values.worker.scaledObject }}
9+
{{- with .scaleTargetRef }}
10+
scaleTargetRef:
11+
apiVersion: {{ .apiVersion }}
12+
kind: {{ .kind }}
13+
name: {{ .name }}
14+
{{- if .envSourceContainerName }}
15+
envSourceContainerName: {{ .envSourceContainerName }}
16+
{{- end }}
17+
{{- end }}
18+
minReplicaCount: {{ .minReplicaCount }}
19+
maxReplicaCount: {{ .maxReplicaCount }}
20+
triggers:
21+
{{- toYaml .triggers | nindent 4 }}
22+
{{- end }}
23+
{{- end}}

charts/application-template/values.yaml

+76-2
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ server:
145145
## server Horizontal Pod Autoscaler
146146
autoscaling:
147147
# -- Enable Horizontal Pod Autoscaler ([HPA]) for the server
148-
enabled: true
148+
enabled: false
149149
# -- Minimum number of replicas for the server [HPA]
150150
minReplicas: 1
151151
# -- Maximum number of replicas for the server [HPA]
@@ -174,6 +174,31 @@ server:
174174
apiVersion: argoproj.io/v1alpha1
175175
kind: Rollout
176176
name: application-template-server
177+
## KEDA resource for server
178+
scaledObject:
179+
# -- Enable KEDA resources for the server
180+
enabled: false
181+
# -- Minimum number of replicas for the server [KEDA]
182+
minReplicaCount: 1
183+
# -- Maximum number of replicas for the server [KEDA]
184+
maxReplicaCount: 5
185+
scaleTargetRef:
186+
apiVersion: argoproj.io/v1alpha1
187+
kind: Rollout
188+
name: application-template-server
189+
triggers: []
190+
# - type: cron
191+
# metadata:
192+
# timezone: Asia/Seoul
193+
# start: 0 6 * * *
194+
# end: 25 15 * * *
195+
# desiredReplicas: "2"
196+
# - type: cpu
197+
# metricType: Utilization
198+
# metadata:
199+
# value: "800"
200+
# containerName: "application-template-server"
201+
177202
## server Pod Disruption Budget
178203
pdb:
179204
# -- Deploy a [PodDisruptionBudget] for the server
@@ -403,7 +428,7 @@ worker:
403428
## worker Horizontal Pod Autoscaler
404429
autoscaling:
405430
# -- Enable Horizontal Pod Autoscaler ([HPA]) for the worker
406-
enabled: true
431+
enabled: false
407432
# -- Minimum number of replicas for the worker [HPA]
408433
minReplicas: 1
409434
# -- Maximum number of replicas for the worker [HPA]
@@ -435,6 +460,30 @@ worker:
435460
apiVersion: apps/v1
436461
kind: Deployment
437462
name: application-template-worker
463+
## KEDA resource for worker
464+
scaledObject:
465+
# -- Enable KEDA resources for the worker
466+
enabled: false
467+
# -- Minimum number of replicas for the worker [KEDA]
468+
minReplicaCount: 1
469+
# -- Maximum number of replicas for the worker [KEDA]
470+
maxReplicaCount: 4
471+
scaleTargetRef:
472+
apiVersion: argoproj.io/v1alpha1
473+
kind: Rollout
474+
name: application-template-worker
475+
triggers: []
476+
# - type: cron
477+
# metadata:
478+
# timezone: Asia/Seoul
479+
# start: 0 6 * * *
480+
# end: 0 20 * * *
481+
# desiredReplicas: "2"
482+
# - type: cpu
483+
# metricType: Utilization
484+
# metadata:
485+
# value: "800"
486+
# containerName: "application-template-worker"
438487

439488
## worker Pod Disruption Budget
440489
pdb:
@@ -694,6 +743,31 @@ scheduler:
694743
# kind: Deployment
695744
# name: application-template-scheduler
696745

746+
## KEDA resource for scheduler
747+
scaledObject:
748+
# -- Enable KEDA resources for the scheduler
749+
enabled: false
750+
# -- Minimum number of replicas for the scheduler [KEDA]
751+
minReplicaCount: 1
752+
# -- Maximum number of replicas for the scheduler [KEDA]
753+
maxReplicaCount: 4
754+
scaleTargetRef:
755+
apiVersion: argoproj.io/v1alpha1
756+
kind: Rollout
757+
name: application-template-scheduler
758+
triggers: []
759+
# - type: cron
760+
# metadata:
761+
# timezone: Asia/Seoul
762+
# start: 0 6 * * *
763+
# end: 25 15 * * *
764+
# desiredReplicas: "2"
765+
# - type: cpu
766+
# metricType: Utilization
767+
# metadata:
768+
# value: "800"
769+
# containerName: "application-template-scheduler"
770+
697771
## scheduler Pod Disruption Budget
698772
pdb:
699773
# -- Deploy a [PodDisruptionBudget] for the scheduler

0 commit comments

Comments
 (0)