diff --git a/charts/prometheus-statsd-exporter/Chart.yaml b/charts/prometheus-statsd-exporter/Chart.yaml index 97f5f91be7bc..4dd572251ff4 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.9.0 +version: 0.9.1 appVersion: v0.22.8 home: https://github.com/prometheus/statsd_exporter sources: diff --git a/charts/prometheus-statsd-exporter/templates/_helpers.tpl b/charts/prometheus-statsd-exporter/templates/_helpers.tpl index 613bb8628034..47ba46716f43 100644 --- a/charts/prometheus-statsd-exporter/templates/_helpers.tpl +++ b/charts/prometheus-statsd-exporter/templates/_helpers.tpl @@ -74,3 +74,16 @@ Check if there is any mappings available {{- template "prometheus-statsd-exporter.fullname" . -}} {{- end }} {{- end }} + +{{/* +Define apiVersion of HorizontalPodAutoscaler +*/}} +{{- define "prometheus-statsd-exporter.hpa.apiVersion" -}} +{{- if .Capabilities.APIVersions.Has "autoscaling/v2" -}} +{{- print "autoscaling/v2" -}} +{{- else if .Capabilities.APIVersions.Has "autoscaling/v2beta2" -}} +{{- print "autoscaling/v2beta2" -}} +{{- else -}} +{{- print "autoscaling/v2beta1" -}} +{{- end -}} +{{- end -}} diff --git a/charts/prometheus-statsd-exporter/templates/hpa.yaml b/charts/prometheus-statsd-exporter/templates/hpa.yaml index ae5d0f1d7516..4d04994993dc 100644 --- a/charts/prometheus-statsd-exporter/templates/hpa.yaml +++ b/charts/prometheus-statsd-exporter/templates/hpa.yaml @@ -1,5 +1,5 @@ {{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta1 +apiVersion: {{ include "prometheus-statsd-exporter.hpa.apiVersion" . }} kind: HorizontalPodAutoscaler metadata: name: {{ include "prometheus-statsd-exporter.fullname" . }}