From 70abbb5f9701ca234ed4dda75ca77188c170e878 Mon Sep 17 00:00:00 2001 From: Michael Kaplan Date: Mon, 27 Nov 2023 00:52:54 +0100 Subject: [PATCH] bump to autoscaling/v2 --- deploy/container_images/php/www.conf | 2 +- .../charts/kissj/templates/autoscalers.yaml | 68 +++++++++++++++++-- deploy/helm/charts/kissj/templates/caddy.yaml | 4 +- 3 files changed, 67 insertions(+), 7 deletions(-) diff --git a/deploy/container_images/php/www.conf b/deploy/container_images/php/www.conf index 2b85d028..6acf4a6b 100644 --- a/deploy/container_images/php/www.conf +++ b/deploy/container_images/php/www.conf @@ -112,7 +112,7 @@ pm = static ; forget to tweak pm.* to fit your needs. ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' ; Note: This value is mandatory. -pm.max_children = 400 +pm.max_children = 600 ; The number of child processes created on startup. ; Note: Used only when pm is set to 'dynamic' diff --git a/deploy/helm/charts/kissj/templates/autoscalers.yaml b/deploy/helm/charts/kissj/templates/autoscalers.yaml index 3650db69..f9b09c1e 100644 --- a/deploy/helm/charts/kissj/templates/autoscalers.yaml +++ b/deploy/helm/charts/kissj/templates/autoscalers.yaml @@ -1,5 +1,5 @@ {{- if .Values.caddy.hpa.enabled }} -apiVersion: autoscaling/v1 +apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: name: {{ .Release.Name }}-caddy @@ -10,11 +10,38 @@ spec: name: {{ .Release.Name }}-caddy minReplicas: {{ .Values.caddy.hpa.minReplicas }} maxReplicas: {{ .Values.caddy.hpa.maxReplicas }} - targetCPUUtilizationPercentage: 80 + metrics: + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 80 + - type: Resource + resource: + name: memory + target: + type: Utilization + averageValue: 400Mi + behavior: + scaleUp: + policies: + - type: Pods + value: 1 + periodSeconds: 10 + selectPolicy: Max + stabilizationWindowSeconds: 10 + scaleDown: + policies: + - type: Pods + value: 1 + periodSeconds: 60 + selectPolicy: Max + stabilizationWindowSeconds: 200 {{- end }} --- {{- if .Values.php.hpa.enabled }} -apiVersion: autoscaling/v1 +apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: name: {{ .Release.Name }}-php-fpm @@ -25,5 +52,38 @@ spec: name: {{ .Release.Name }}-php-fpm minReplicas: {{ .Values.php.hpa.minReplicas }} maxReplicas: {{ .Values.php.hpa.maxReplicas }} - targetCPUUtilizationPercentage: 80 + metrics: + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 80 + - type: Resource + resource: + name: memory + target: + type: Utilization + averageValue: 800Mi + behavior: + scaleUp: + policies: + - type: Pods + value: 3 + periodSeconds: 10 + - type: Percent + value: 30 + periodSeconds: 10 + selectPolicy: Max + stabilizationWindowSeconds: 10 + scaleDown: + policies: + - type: Pods + value: 2 + periodSeconds: 60 + - type: Percent + value: 15 + periodSeconds: 60 + selectPolicy: Max + stabilizationWindowSeconds: 200 {{- end }} \ No newline at end of file diff --git a/deploy/helm/charts/kissj/templates/caddy.yaml b/deploy/helm/charts/kissj/templates/caddy.yaml index 12fafdc9..31b6ab33 100644 --- a/deploy/helm/charts/kissj/templates/caddy.yaml +++ b/deploy/helm/charts/kissj/templates/caddy.yaml @@ -46,10 +46,10 @@ spec: resources: requests: - memory: "256Mi" + memory: "500Mi" cpu: "500m" limits: - memory: "500Mi" + memory: "1Gi" cpu: "1000m" volumeMounts: - mountPath: /etc/caddy