{{- if .Values.autoscaling.enabled }} {{- if semverCompare ">=v1.23.0-0" .Capabilities.KubeVersion.Version }} apiVersion: autoscaling/v2 {{- else }} apiVersion: autoscaling/v2beta2 {{- end }} kind: HorizontalPodAutoscaler metadata: labels: app: {{ template "artifactory.name" . }} chart: {{ template "artifactory.chart" . }} heritage: {{ .Release.Service }} release: {{ .Release.Name }} name: {{ template "artifactory.fullname" . }} spec: scaleTargetRef: apiVersion: apps/v1 kind: StatefulSet name: {{ template "artifactory.fullname" . }} minReplicas: {{ .Values.autoscaling.minReplicas }} maxReplicas: {{ .Values.autoscaling.maxReplicas }} metrics: - type: Resource resource: name: cpu target: type: Utilization averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} {{- end }}