{{- if and (.Values.rolloutStrategy) (.Values.rolloutStrategy.enabled) }}
{{- if and (.Values.rolloutStrategy.hpa) (.Values.rolloutStrategy.hpa.enabled) }}
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
  name: {{ .Values.rolloutStrategy.deploymentName }}-hpa
spec:
  maxReplicas: {{ .Values.rolloutStrategy.hpa.maxReplicas }}
  minReplicas: {{ .Values.rolloutStrategy.hpa.minReplicas }}
  scaleTargetRef:
    apiVersion: argoproj.io/v1alpha1
    kind: Rollout
    name: {{ .Values.rolloutStrategy.deploymentName }}
  targetCPUUtilizationPercentage: {{ .Values.rolloutStrategy.hpa.targetCPUUtilizationPercentage }}
{{- end -}}
{{- end -}}