Skip to content

Commit

Permalink
fix: HPA target (#361)
Browse files Browse the repository at this point in the history
Fixes an issue with HPA autoscaling/v2:
* HorizontalPodAutoscaler.autoscaling "reflector" is invalid: [spec.metrics[0].resource.target.type: Required value: must specify a metric target type, spec.metrics[0].resource.target.type: Invalid value: "": must be either Utilization, Value, or AverageValue, spec.metrics[0].resource.target.averageUtilization: Required value: must set either a target raw value or a target utilization]

Docs: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/
  • Loading branch information
sydorovdmytro authored Jul 6, 2023
1 parent 619e4bd commit e970061
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/helm/reflector/templates/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ spec:
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}

0 comments on commit e970061

Please sign in to comment.