41 lines
1.1 KiB
YAML
41 lines
1.1 KiB
YAML
{{- /*
|
|
Generate HPA for each PocketBase instance
|
|
*/ -}}
|
|
{{- if .Values.autoscaling.enabled }}
|
|
{{- range .Values.instances }}
|
|
---
|
|
apiVersion: autoscaling/v2
|
|
kind: HorizontalPodAutoscaler
|
|
metadata:
|
|
name: pocketbase-{{ .id }}
|
|
labels:
|
|
app: pocketbase
|
|
instance: {{ .id }}
|
|
{{- include "pocketbase.labels" $ | nindent 4 }}
|
|
spec:
|
|
scaleTargetRef:
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
name: pocketbase-{{ .id }}
|
|
minReplicas: {{ .replicaCount | default 1 }}
|
|
maxReplicas: {{ $.Values.autoscaling.maxReplicas }}
|
|
metrics:
|
|
{{- if $.Values.autoscaling.targetCPUUtilizationPercentage }}
|
|
- type: Resource
|
|
resource:
|
|
name: cpu
|
|
target:
|
|
type: Utilization
|
|
averageUtilization: {{ $.Values.autoscaling.targetCPUUtilizationPercentage }}
|
|
{{- end }}
|
|
{{- if $.Values.autoscaling.targetMemoryUtilizationPercentage }}
|
|
- type: Resource
|
|
resource:
|
|
name: memory
|
|
target:
|
|
type: Utilization
|
|
averageUtilization: {{ $.Values.autoscaling.targetMemoryUtilizationPercentage }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|