Skip to content

Commit

Permalink
[prometheus-statsd-exporter] Reorder HPA target to fix ordering HPA t…
Browse files Browse the repository at this point in the history
…arget problem

Signed-off-by: gavin.jeong <[email protected]>
  • Loading branch information
gavin-jeong committed Jan 25, 2024
1 parent da42c4a commit 6dd92c7
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
2 changes: 1 addition & 1 deletion charts/prometheus-statsd-exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: prometheus-statsd-exporter
description: A Helm chart for prometheus stats-exporter
version: 0.11.1
version: 0.12.0
appVersion: v0.26.0
home: https://github.com/prometheus/statsd_exporter
sources:
Expand Down
8 changes: 4 additions & 4 deletions charts/prometheus-statsd-exporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ spec:
- name: statsd-mapping-config
mountPath: /etc/prometheus-statsd-exporter
{{- end }}
{{- if .Values.lifecycle }}
lifecycle:
{{- toYaml .Values.lifecycle | nindent 12 }}
{{- end }}
{{- if or .Values.statsd.mappingConfigMapName .Values.statsd.mappingConfig }}
volumes:
- name: statsd-mapping-config
Expand All @@ -111,7 +115,3 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.lifecycle }}
lifecycle:
{{- toYaml . | nindent 8 }}
{{- end }}
20 changes: 10 additions & 10 deletions charts/prometheus-statsd-exporter/templates/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@ spec:
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if eq (include "prometheus-statsd-exporter.hpa.apiVersion" .) "autoscaling/v2" -}}
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
Expand All @@ -30,18 +22,26 @@ spec:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- else -}}
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- else -}}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end -}}
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- end }}
{{- end }}
5 changes: 5 additions & 0 deletions charts/prometheus-statsd-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ autoscaling:
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80

lifecycle:
preStop:
exec:
command: ["sleep", "10"]

nodeSelector: {}

tolerations: []
Expand Down

0 comments on commit 6dd92c7

Please sign in to comment.