From 3a739a32bf73ac002012f00b956772bd521c75ac Mon Sep 17 00:00:00 2001 From: Rub21 Date: Tue, 20 May 2025 10:42:46 -0500 Subject: [PATCH 1/4] Add behavior for hpa --- osm-seed/templates/web/web-hpa.yaml | 37 +++++++++++++++++++---------- osm-seed/values.yaml | 17 +++++++++---- 2 files changed, 38 insertions(+), 16 deletions(-) diff --git a/osm-seed/templates/web/web-hpa.yaml b/osm-seed/templates/web/web-hpa.yaml index e1df7d14..fbc2c4a5 100644 --- a/osm-seed/templates/web/web-hpa.yaml +++ b/osm-seed/templates/web/web-hpa.yaml @@ -11,16 +11,29 @@ spec: minReplicas: {{ .Values.web.autoscaling.minReplicas }} maxReplicas: {{ .Values.web.autoscaling.maxReplicas }} metrics: - - type: Resource - resource: - name: cpu - target: - type: Utilization - averageUtilization: {{ .Values.web.autoscaling.cpuUtilization }} - - type: Resource - resource: - name: memory - target: - type: Utilization - averageUtilization: {{ .Values.web.autoscaling.memoryUtilization }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.web.autoscaling.cpuUtilization }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.web.autoscaling.memoryUtilization }} + behavior: + scaleUp: + stabilizationWindowSeconds: {{ .Values.web.autoscaling.behavior.scaleUp.stabilizationWindowSeconds | default 60 }} + policies: + - type: Percent + value: {{ .Values.web.autoscaling.behavior.scaleUp.policyValue | default 100 }} + periodSeconds: {{ .Values.web.autoscaling.behavior.scaleUp.periodSeconds | default 60 }} + scaleDown: + stabilizationWindowSeconds: {{ .Values.web.autoscaling.behavior.scaleDown.stabilizationWindowSeconds | default 60 }} + policies: + - type: Percent + value: {{ .Values.web.autoscaling.behavior.scaleDown.policyValue | default 50 }} + periodSeconds: {{ .Values.web.autoscaling.behavior.scaleDown.periodSeconds | default 60 }} {{- end }} diff --git a/osm-seed/values.yaml b/osm-seed/values.yaml index 1f16c379..ac2132d1 100644 --- a/osm-seed/values.yaml +++ b/osm-seed/values.yaml @@ -175,11 +175,20 @@ web: nodeSelector: enabled: false autoscaling: - enabled: false + enabled: true minReplicas: 1 - maxReplicas: 3 - cpuUtilization: 60 - memoryUtilization: 60 + maxReplicas: 6 + cpuUtilization: 85 + memoryUtilization: 85 + behavior: + scaleUp: + stabilizationWindowSeconds: 60 + policyValue: 100 + periodSeconds: 60 + scaleDown: + stabilizationWindowSeconds: 60 + policyValue: 50 + periodSeconds: 60 sharedMemorySize: 256Mi livenessProbeExec: true # ==================================================================================================== From e93db6c16b2b31c649b27a83f649e6076fabc76f Mon Sep 17 00:00:00 2001 From: Rub21 Date: Tue, 20 May 2025 13:01:12 -0500 Subject: [PATCH 2/4] Evaluate autoscaling by CPU and memory separately --- osm-seed/templates/web/web-hpa.yaml | 8 ++++++-- osm-seed/values.yaml | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/osm-seed/templates/web/web-hpa.yaml b/osm-seed/templates/web/web-hpa.yaml index fbc2c4a5..82684065 100644 --- a/osm-seed/templates/web/web-hpa.yaml +++ b/osm-seed/templates/web/web-hpa.yaml @@ -11,18 +11,22 @@ spec: minReplicas: {{ .Values.web.autoscaling.minReplicas }} maxReplicas: {{ .Values.web.autoscaling.maxReplicas }} metrics: + {{- if .Values.web.autoscaling.cpuUtilization.enable }} - type: Resource resource: name: cpu target: type: Utilization - averageUtilization: {{ .Values.web.autoscaling.cpuUtilization }} + averageUtilization: {{ .Values.web.autoscaling.cpuUtilization.value }} + {{- end }} + {{- if .Values.web.autoscaling.memoryUtilization.enable }} - type: Resource resource: name: memory target: type: Utilization - averageUtilization: {{ .Values.web.autoscaling.memoryUtilization }} + averageUtilization: {{ .Values.web.autoscaling.memoryUtilization.value }} + {{- end }} behavior: scaleUp: stabilizationWindowSeconds: {{ .Values.web.autoscaling.behavior.scaleUp.stabilizationWindowSeconds | default 60 }} diff --git a/osm-seed/values.yaml b/osm-seed/values.yaml index ac2132d1..b9490cc4 100644 --- a/osm-seed/values.yaml +++ b/osm-seed/values.yaml @@ -178,8 +178,12 @@ web: enabled: true minReplicas: 1 maxReplicas: 6 - cpuUtilization: 85 - memoryUtilization: 85 + cpuUtilization: + enable: false + value: 85 + memoryUtilization: + enable: false + value: 85 behavior: scaleUp: stabilizationWindowSeconds: 60 From 5295d8c44b6bcb77beb079a08efe84f1e63bb145 Mon Sep 17 00:00:00 2001 From: Rub21 Date: Tue, 20 May 2025 15:44:34 -0500 Subject: [PATCH 3/4] Add PASSENGER_MAX_POOL_SIZE env var for web-api --- osm-seed/templates/web/web-deployment.yaml | 2 ++ osm-seed/values.yaml | 1 + 2 files changed, 3 insertions(+) diff --git a/osm-seed/templates/web/web-deployment.yaml b/osm-seed/templates/web/web-deployment.yaml index e707c28c..2cc7b73d 100644 --- a/osm-seed/templates/web/web-deployment.yaml +++ b/osm-seed/templates/web/web-deployment.yaml @@ -167,6 +167,8 @@ spec: value: "127.0.0.1" - name: CGIMAP_PORT value: {{ quote 8000 }} + - name: PASSENGER_MAX_POOL_SIZE + value: {{ .Values.web.env.PASSENGER_MAX_POOL_SIZE | default "6" | quote }} {{- end }} volumeMounts: - mountPath: /dev/shm diff --git a/osm-seed/values.yaml b/osm-seed/values.yaml index b9490cc4..36337ade 100644 --- a/osm-seed/values.yaml +++ b/osm-seed/values.yaml @@ -162,6 +162,7 @@ web: RAILS_STORAGE_REGION: us-east-1 RAILS_STORAGE_BUCKET: osmseed-website-bucket EXTERNAL_CGIMAP: false + PASSENGER_MAX_POOL_SIZE: 6 resources: enabled: false requests: From 923a732758409650aeb53a11f02049f146eb9a63 Mon Sep 17 00:00:00 2001 From: Rub21 Date: Wed, 21 May 2025 10:11:40 -0500 Subject: [PATCH 4/4] Fix possition for PASSENGER_MAX_POOL_SIZE env var --- osm-seed/templates/web/web-deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osm-seed/templates/web/web-deployment.yaml b/osm-seed/templates/web/web-deployment.yaml index 2cc7b73d..ffccd517 100644 --- a/osm-seed/templates/web/web-deployment.yaml +++ b/osm-seed/templates/web/web-deployment.yaml @@ -167,9 +167,9 @@ spec: value: "127.0.0.1" - name: CGIMAP_PORT value: {{ quote 8000 }} + {{- end }} - name: PASSENGER_MAX_POOL_SIZE value: {{ .Values.web.env.PASSENGER_MAX_POOL_SIZE | default "6" | quote }} - {{- end }} volumeMounts: - mountPath: /dev/shm name: shared-memory