mirror of
https://github.com/nikdoof/helm-charts.git
synced 2025-12-23 22:59:29 +00:00
[common] Add common chart from KaH
This commit is contained in:
37
charts/common/templates/classes/_HorizontalPodAutoscaler.tpl
Normal file
37
charts/common/templates/classes/_HorizontalPodAutoscaler.tpl
Normal file
@@ -0,0 +1,37 @@
|
||||
{{/*
|
||||
This template serves as a blueprint for horizontal pod autoscaler objects that are created
|
||||
using the common library.
|
||||
*/}}
|
||||
{{- define "common.classes.hpa" -}}
|
||||
{{- if .Values.autoscaling.enabled -}}
|
||||
{{- $hpaName := include "common.names.fullname" . -}}
|
||||
{{- $targetName := include "common.names.fullname" . }}
|
||||
---
|
||||
apiVersion: autoscaling/v2beta1
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: {{ $hpaName }}
|
||||
labels: {{- include "common.labels" $ | nindent 4 }}
|
||||
annotations: {{- include "common.annotations" $ | nindent 4 }}
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: {{ include "common.names.controllerType" . }}
|
||||
name: {{ .Values.autoscaling.target | default $targetName }}
|
||||
minReplicas: {{ .Values.autoscaling.minReplicas | default 1 }}
|
||||
maxReplicas: {{ .Values.autoscaling.maxReplicas | default 3 }}
|
||||
metrics:
|
||||
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||
{{- end }}
|
||||
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: memory
|
||||
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
Reference in New Issue
Block a user