budibase/charts/budibase/templates/worker-service-hpa.yaml

33 lines
1.2 KiB
YAML

{{- if .Values.services.worker.autoscaling.enabled }}
apiVersion: {{ ternary "autoscaling/v2" "autoscaling/v2beta2" (.Capabilities.APIVersions.Has "autoscaling/v2") }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "budibase.fullname" . }}-worker
labels:
{{- include "budibase.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: worker-service
minReplicas: {{ .Values.services.worker.autoscaling.minReplicas }}
maxReplicas: {{ .Values.services.worker.autoscaling.maxReplicas }}
metrics:
{{- if .Values.services.worker.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.services.worker.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.services.worker.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.services.worker.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}