Skip to content

HPAs on Kubernetes version 1.20.6 do not use the correct apiVersion #363

@Magnus010

Description

@Magnus010

Kubernetes version 1.20.6 does not recognize the autoscaling/v2 api. I believe the autoscaling/v2 api was introduced in Kubernetes version 1.23.

A possible solution would be adding this to the _capabilities.tpl:

{{/*
Return the appropriate apiVersion for HorizontalPodAutoscaler object.
*/}}
{{- define "capabilities.horizontalPodAutoscaler.apiVersion" -}}
{{- if semverCompare "<1.23-0" ( .Values.kubeVersion | default .Capabilities.KubeVersion.Version ) -}}
{{- print "autoscaling/v2beta2" -}}
{{- else -}}
{{- print "autoscaling/v2" -}}
{{- end -}}
{{- end -}}

And updating the hpa.yaml with apiVersion: {{ include "capabilities.horizontalPodAutoscaler.apiVersion" . }}
Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions