Skip to content

Commit ffffb39

Browse files
authored
Merge pull request #25 from thaunghtike-share/thaung/issue-12
add autoscaling
2 parents d196330 + fbfed4d commit ffffb39

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ apps:
5252
- name: payroll
5353
secrets:
5454
USERNAME: opszero
55+
autoscaling:
56+
enabled: true
57+
minReplicas: 2
58+
maxReplicas: 4
59+
targetCPUUtilizationPercentage: 75
60+
targetMemoryUtilizationPercentage: 75
5561
service:
5662
enabled: true
5763
type: ClusterIP

charts/tiphys/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 0.5.4
18+
version: 0.5.5
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to
@@ -26,4 +26,4 @@ dependencies:
2626
- name: redis
2727
version: 17.3.11
2828
repository: https://charts.bitnami.com/bitnami
29-
condition: redis.enabled
29+
condition: redis.enabled

charts/tiphys/templates/app.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ metadata:
5252
labels:
5353
{{- include "opszero.selectorLabels" $ | nindent 4 }}-{{ $app.name }}
5454
spec:
55+
{{- if not $app.autoscaling.enabled }}
56+
replicas: {{ $.Values.replicaCount }}
57+
{{- end }}
5558
selector:
5659
matchLabels:
5760
{{- include "opszero.selectorLabels" $ | nindent 6 }}-{{ $app.name }}
@@ -106,6 +109,7 @@ stringData:
106109
{{- end }}
107110
{{- end }}
108111

112+
{{- if $app.autoscaling.enabled }}
109113
---
110114
apiVersion: keda.sh/v1alpha1
111115
kind: ScaledObject
@@ -117,18 +121,19 @@ spec:
117121
scaleTargetRef:
118122
name: {{ include "opszero.fullname" $ }}-{{ $app.name }}
119123
kind: Deployment
120-
minReplicaCount: {{ $.Values.autoscaling.minReplicas }}
121-
maxReplicaCount: {{ $.Values.autoscaling.maxReplicas }}
124+
minReplicaCount: {{ default $.Values.autoscaling.minReplicas $app.autoscaling.minReplicas }}
125+
maxReplicaCount: {{ default $.Values.autoscaling.maxReplicas $app.autoscaling.maxReplicas }}
122126
cooldownPeriod: 60
123127
triggers:
124128
- type: cpu
125129
metadata:
126130
type: Utilization
127-
value: {{ $.Values.autoscaling.targetCPUUtilizationPercentage | quote }}
131+
value: {{ default $.Values.autoscaling.CPUUtilizationPercentage $app.autoscaling.targetCPUUtilizationPercentage | quote }}
128132
- type: memory
129133
metadata:
130134
type: Utilization
131-
value: {{ $.Values.autoscaling.targetMemoryUtilizationPercentage | quote }}
135+
value: {{ default $.Values.autoscaling.targetMemoryUtilizationPercentage $app.autoscaling.targetMemoryUtilizationPercentage | quote }}
136+
{{- end }}
132137
---
133138
apiVersion: networking.k8s.io/v1
134139
kind: Ingress

charts/tiphys/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
defaultImage: ""
22
imagePullSecrets: []
33
nameOverride: ""
4+
replicaCount: 1
45

56
serviceAccount:
67
# Specifies whether a service account should be created

0 commit comments

Comments
 (0)