{{- if .Values.hpa.enabled }}
---
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
  name: {{ template "nextcloud.fullname" . }}
  labels:
    {{- include "nextcloud.labels"  ( dict "component" "app"  "rootContext" $ ) | nindent 4 }}
spec:
  scaleTargetRef:
    kind: Deployment
    apiVersion: apps/v1
    name: {{ template "nextcloud.fullname" . }}
  {{- with .Values.hpa }}
  minReplicas: {{ .minPods }}
  maxReplicas: {{ .maxPods }}
  targetCPUUtilizationPercentage: {{ .cputhreshold }}
  {{- end }}{{/* end-with .hpa */}}
{{- end }}
