mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-07 19:22:14 +09:00
42 lines
1.3 KiB
YAML
42 lines
1.3 KiB
YAML
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
{{- define "worker.hpa" -}}
|
|
{{- $name := .name -}}
|
|
{{- $values := .values -}}
|
|
{{- $ctx := .context -}}
|
|
apiVersion: autoscaling/v2
|
|
kind: HorizontalPodAutoscaler
|
|
metadata:
|
|
name: {{ $name }}
|
|
namespace: {{ $ctx.Values.global.namespace }}
|
|
labels:
|
|
{{- include "fluxer.labels" $ctx | nindent 4 }}
|
|
{{- include "fluxer.selectorLabels" (dict "name" $name "context" $ctx) | nindent 4 }}
|
|
spec:
|
|
scaleTargetRef:
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
name: {{ $name }}
|
|
minReplicas: {{ $values.autoscaling.minReplicas }}
|
|
maxReplicas: {{ $values.autoscaling.maxReplicas }}
|
|
metrics:
|
|
- type: Resource
|
|
resource:
|
|
name: cpu
|
|
target:
|
|
type: Utilization
|
|
averageUtilization: {{ $values.autoscaling.targetCPUUtilizationPercentage }}
|
|
behavior:
|
|
scaleDown:
|
|
stabilizationWindowSeconds: 300
|
|
scaleUp:
|
|
stabilizationWindowSeconds: 30
|
|
{{- end -}}
|
|
{{- if and .Values.workerUnfurl.autoscaling .Values.workerUnfurl.autoscaling.enabled }}
|
|
{{ include "worker.hpa" (dict "name" "worker-unfurl" "values" .Values.workerUnfurl "context" .) }}
|
|
{{- end }}
|
|
{{- if and .Values.workerBatch.autoscaling .Values.workerBatch.autoscaling.enabled }}
|
|
---
|
|
{{ include "worker.hpa" (dict "name" "worker-batch" "values" .Values.workerBatch "context" .) }}
|
|
{{- end }}
|