diff --git a/charts/fluentd/Chart.yaml b/charts/fluentd/Chart.yaml index cb748397..df5e3928 100644 --- a/charts/fluentd/Chart.yaml +++ b/charts/fluentd/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: fluentd description: A Helm chart for Kubernetes # type: application -version: 0.5.1 +version: 0.5.2 appVersion: v1.16.2 icon: https://www.fluentd.org/images/miscellany/fluentd-logo_2x.png home: https://www.fluentd.org/ diff --git a/charts/fluentd/templates/_helpers.tpl b/charts/fluentd/templates/_helpers.tpl index 72e878df..1b1bf702 100644 --- a/charts/fluentd/templates/_helpers.tpl +++ b/charts/fluentd/templates/_helpers.tpl @@ -90,3 +90,15 @@ Name of the configMap used for additional configuration files; allows users to o {{ printf "%s-%s" "fluentd-config" ( include "fluentd.shortReleaseName" . ) }} {{- end -}} {{- end -}} + +{{/* +HPA ApiVersion according k8s version +Check legacy first so helm template / kustomize will default to latest version +*/}} +{{- define "fluentd.hpa.apiVersion" -}} +{{- if and (.Capabilities.APIVersions.Has "autoscaling/v2beta2") (semverCompare "<1.23-0" .Capabilities.KubeVersion.GitVersion) -}} +autoscaling/v2beta2 +{{- else -}} +autoscaling/v2 +{{- end -}} +{{- end -}} \ No newline at end of file diff --git a/charts/fluentd/templates/hpa.yaml b/charts/fluentd/templates/hpa.yaml index b2e82822..f4785662 100644 --- a/charts/fluentd/templates/hpa.yaml +++ b/charts/fluentd/templates/hpa.yaml @@ -1,5 +1,5 @@ {{- if and ( eq .Values.kind "Deployment" ) .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta2 +apiVersion: {{ include "fluentd.hpa.apiVersion" . }} kind: HorizontalPodAutoscaler metadata: name: {{ include "fluentd.fullname" . }}