Skip to content

Commit

Permalink
bump to autoscaling/v2
Browse files Browse the repository at this point in the history
  • Loading branch information
kaplan-michael committed Nov 27, 2023
1 parent cd6bc98 commit 70abbb5
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 7 deletions.
2 changes: 1 addition & 1 deletion deploy/container_images/php/www.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
68 changes: 64 additions & 4 deletions deploy/helm/charts/kissj/templates/autoscalers.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if .Values.caddy.hpa.enabled }}
apiVersion: autoscaling/v1
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ .Release.Name }}-caddy
Expand All @@ -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
Expand All @@ -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 }}
4 changes: 2 additions & 2 deletions deploy/helm/charts/kissj/templates/caddy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ spec:

resources:
requests:
memory: "256Mi"
memory: "500Mi"
cpu: "500m"
limits:
memory: "500Mi"
memory: "1Gi"
cpu: "1000m"
volumeMounts:
- mountPath: /etc/caddy
Expand Down

0 comments on commit 70abbb5

Please sign in to comment.