Skip to content

Commit

Permalink
feat(fluentd): conditionally update deprecated API for HPA (#363)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael McLeroy <michaelmcleroy@cloudfitsoftware.com>
Co-authored-by: Diogo Guerra <diogo.filipe.tomas.guerra@cern.ch>
  • Loading branch information
Boojapho and Diogo Guerra committed Feb 27, 2024
1 parent 300f3aa commit e6aef88
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/fluentd/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
12 changes: 12 additions & 0 deletions charts/fluentd/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}
2 changes: 1 addition & 1 deletion charts/fluentd/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -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" . }}
Expand Down

0 comments on commit e6aef88

Please sign in to comment.