From 6dd92c7cfb5af3a2b48ca63fdcc80963b81afd6b Mon Sep 17 00:00:00 2001 From: "gavin.jeong" Date: Tue, 23 Jan 2024 17:31:48 +0900 Subject: [PATCH] [prometheus-statsd-exporter] Reorder HPA target to fix ordering HPA target problem Signed-off-by: gavin.jeong --- charts/prometheus-statsd-exporter/Chart.yaml | 2 +- .../templates/deployment.yaml | 8 ++++---- .../templates/hpa.yaml | 20 +++++++++---------- charts/prometheus-statsd-exporter/values.yaml | 5 +++++ 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/charts/prometheus-statsd-exporter/Chart.yaml b/charts/prometheus-statsd-exporter/Chart.yaml index a6786948075a..fba8b0f842c4 100644 --- a/charts/prometheus-statsd-exporter/Chart.yaml +++ b/charts/prometheus-statsd-exporter/Chart.yaml @@ -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: diff --git a/charts/prometheus-statsd-exporter/templates/deployment.yaml b/charts/prometheus-statsd-exporter/templates/deployment.yaml index 140a901406c2..69953f531b57 100644 --- a/charts/prometheus-statsd-exporter/templates/deployment.yaml +++ b/charts/prometheus-statsd-exporter/templates/deployment.yaml @@ -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 @@ -111,7 +115,3 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.lifecycle }} - lifecycle: - {{- toYaml . | nindent 8 }} - {{- end }} diff --git a/charts/prometheus-statsd-exporter/templates/hpa.yaml b/charts/prometheus-statsd-exporter/templates/hpa.yaml index 9c0fa614b072..b48caae3df2e 100644 --- a/charts/prometheus-statsd-exporter/templates/hpa.yaml +++ b/charts/prometheus-statsd-exporter/templates/hpa.yaml @@ -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: @@ -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 }} diff --git a/charts/prometheus-statsd-exporter/values.yaml b/charts/prometheus-statsd-exporter/values.yaml index 279bac8f9d3c..4ca17cee1b96 100644 --- a/charts/prometheus-statsd-exporter/values.yaml +++ b/charts/prometheus-statsd-exporter/values.yaml @@ -163,6 +163,11 @@ autoscaling: targetCPUUtilizationPercentage: 80 # targetMemoryUtilizationPercentage: 80 +lifecycle: + preStop: + exec: + command: ["sleep", "10"] + nodeSelector: {} tolerations: []