Skip to content

Commit de94f43

Browse files
authored
Add behavior for Horizontal Pod Autoscaler (#366)
* Add behavior for hpa * Evaluate autoscaling by CPU and memory separately * Add PASSENGER_MAX_POOL_SIZE env var for web-api * Fix possition for PASSENGER_MAX_POOL_SIZE env var
1 parent 99162f1 commit de94f43

File tree

3 files changed

+49
-16
lines changed

3 files changed

+49
-16
lines changed

osm-seed/templates/web/web-deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ spec:
168168
- name: CGIMAP_PORT
169169
value: {{ quote 8000 }}
170170
{{- end }}
171+
- name: PASSENGER_MAX_POOL_SIZE
172+
value: {{ .Values.web.env.PASSENGER_MAX_POOL_SIZE | default "6" | quote }}
171173
volumeMounts:
172174
- mountPath: /dev/shm
173175
name: shared-memory

osm-seed/templates/web/web-hpa.yaml

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,33 @@ spec:
1111
minReplicas: {{ .Values.web.autoscaling.minReplicas }}
1212
maxReplicas: {{ .Values.web.autoscaling.maxReplicas }}
1313
metrics:
14-
- type: Resource
15-
resource:
16-
name: cpu
17-
target:
18-
type: Utilization
19-
averageUtilization: {{ .Values.web.autoscaling.cpuUtilization }}
20-
- type: Resource
21-
resource:
22-
name: memory
23-
target:
24-
type: Utilization
25-
averageUtilization: {{ .Values.web.autoscaling.memoryUtilization }}
14+
{{- if .Values.web.autoscaling.cpuUtilization.enable }}
15+
- type: Resource
16+
resource:
17+
name: cpu
18+
target:
19+
type: Utilization
20+
averageUtilization: {{ .Values.web.autoscaling.cpuUtilization.value }}
21+
{{- end }}
22+
{{- if .Values.web.autoscaling.memoryUtilization.enable }}
23+
- type: Resource
24+
resource:
25+
name: memory
26+
target:
27+
type: Utilization
28+
averageUtilization: {{ .Values.web.autoscaling.memoryUtilization.value }}
29+
{{- end }}
30+
behavior:
31+
scaleUp:
32+
stabilizationWindowSeconds: {{ .Values.web.autoscaling.behavior.scaleUp.stabilizationWindowSeconds | default 60 }}
33+
policies:
34+
- type: Percent
35+
value: {{ .Values.web.autoscaling.behavior.scaleUp.policyValue | default 100 }}
36+
periodSeconds: {{ .Values.web.autoscaling.behavior.scaleUp.periodSeconds | default 60 }}
37+
scaleDown:
38+
stabilizationWindowSeconds: {{ .Values.web.autoscaling.behavior.scaleDown.stabilizationWindowSeconds | default 60 }}
39+
policies:
40+
- type: Percent
41+
value: {{ .Values.web.autoscaling.behavior.scaleDown.policyValue | default 50 }}
42+
periodSeconds: {{ .Values.web.autoscaling.behavior.scaleDown.periodSeconds | default 60 }}
2643
{{- end }}

osm-seed/values.yaml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ web:
162162
RAILS_STORAGE_REGION: us-east-1
163163
RAILS_STORAGE_BUCKET: osmseed-website-bucket
164164
EXTERNAL_CGIMAP: false
165+
PASSENGER_MAX_POOL_SIZE: 6
165166
resources:
166167
enabled: false
167168
requests:
@@ -175,11 +176,24 @@ web:
175176
nodeSelector:
176177
enabled: false
177178
autoscaling:
178-
enabled: false
179+
enabled: true
179180
minReplicas: 1
180-
maxReplicas: 3
181-
cpuUtilization: 60
182-
memoryUtilization: 60
181+
maxReplicas: 6
182+
cpuUtilization:
183+
enable: false
184+
value: 85
185+
memoryUtilization:
186+
enable: false
187+
value: 85
188+
behavior:
189+
scaleUp:
190+
stabilizationWindowSeconds: 60
191+
policyValue: 100
192+
periodSeconds: 60
193+
scaleDown:
194+
stabilizationWindowSeconds: 60
195+
policyValue: 50
196+
periodSeconds: 60
183197
sharedMemorySize: 256Mi
184198
livenessProbeExec: true
185199
# ====================================================================================================

0 commit comments

Comments
 (0)