Description
The Horizontal Pod Autoscaler (HPA) configuration in the values.yaml file implies that the target utilization is being configured. However, the current implementation sets the average value instead. This discrepancy can lead to confusion and unexpected behavior during autoscaling.
Affected Code:
The relevant section of the hpa.yaml template can be found here.
|
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }} |
|
- type: Resource |
|
resource: |
|
name: cpu |
|
{{- if or (.Capabilities.APIVersions.Has "autoscaling/v2") (.Capabilities.APIVersions.Has "autoscaling/v2beta2") }} |
|
target: |
|
type: AverageValue |
|
averageValue: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} |
|
{{- else }} |
|
targetAverageValue: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} |
|
{{- end }} |
|
{{- end }} |
|
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} |
|
- type: Resource |
|
resource: |
|
name: memory |
|
{{- if or (.Capabilities.APIVersions.Has "autoscaling/v2") (.Capabilities.APIVersions.Has "autoscaling/v2beta2") }} |
|
target: |
|
type: AverageValue |
|
averageValue: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} |
|
{{- else }} |
|
targetAverageValue: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} |
|
{{- end }} |
Steps to Reproduce
- Configure HPA in
values.yaml with a value implying target utilization.
- Deploy the Helm chart.
- Observe that the HPA uses the average value instead of the target utilization.
Expected Behavior
The configuration should prioritize the use of target utilization, as it is more commonly used and aligns with typical HPA configurations. Alternatively, the configuration could allow users to choose between setting target utilization or average value explicitly.
Suggested Improvements
-
Modify Default Behavior:
- Update the
hpa.yaml template to use target utilization by default, as it is generally preferred for most use cases.
-
Add Configurability:
- Introduce a configuration option in
values.yaml that allows users to specify whether they want to set target utilization or average value.
Example:
hpa:
targetType: utilization # Options: utilization, averageValue
targetValue: 70
- Adjust the
hpa.yaml template to dynamically render the configuration based on the chosen targetType.
-
Improve Documentation:
- Clearly document the difference between target utilization and average value in the
values.yaml file and other relevant documentation.
- Provide examples to guide users in configuring the HPA according to their needs.
Additional Context
This issue may cause confusion and unexpected scaling behavior if users are unaware of the difference between target utilization and average value. Updating the default behavior to prioritize target utilization or adding configurability will make the chart more user-friendly and flexible.
Description
The Horizontal Pod Autoscaler (HPA) configuration in the
values.yamlfile implies that the target utilization is being configured. However, the current implementation sets the average value instead. This discrepancy can lead to confusion and unexpected behavior during autoscaling.Affected Code:
The relevant section of the
hpa.yamltemplate can be found here.dataone-indexer/helm/templates/hpa.yaml
Lines 22 to 44 in 79abffe
Steps to Reproduce
values.yamlwith a value implying target utilization.Expected Behavior
The configuration should prioritize the use of target utilization, as it is more commonly used and aligns with typical HPA configurations. Alternatively, the configuration could allow users to choose between setting target utilization or average value explicitly.
Suggested Improvements
Modify Default Behavior:
hpa.yamltemplate to use target utilization by default, as it is generally preferred for most use cases.Add Configurability:
values.yamlthat allows users to specify whether they want to set target utilization or average value.Example:
hpa.yamltemplate to dynamically render the configuration based on the chosentargetType.Improve Documentation:
values.yamlfile and other relevant documentation.Additional Context
This issue may cause confusion and unexpected scaling behavior if users are unaware of the difference between target utilization and average value. Updating the default behavior to prioritize target utilization or adding configurability will make the chart more user-friendly and flexible.