Migrate Helm Chart to autoscaling/v2 for Compatibility with Kubernetes 1.25

Description

As a user installing gitlab-workspaces-proxy, I encountered an error due to the use of the deprecated and removed Kubernetes API version autoscaling/v2beta1 for HorizontalPodAutoscaler. This API version was deprecated in Kubernetes 1.22 and fully removed in 1.25, and I am running Kubernetes 1.30.

Error:

Release "gitlab-workspaces-proxy" does not exist. Installing it now.
Error: unable to build kubernetes objects from release manifest: resource mapping not found for name: "gitlab-workspaces-proxy" namespace: "" from "": no matches for kind "HorizontalPodAutoscaler" in version "autoscaling/v2beta1"
ensure CRDs are installed first

The Helm chart template for gitlab-workspaces-proxy has not been updated for over a year and still references the removed API version:

{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
  name: {{ include "gitlab-workspaces-proxy.fullname" . }}
  labels:
    {{- include "gitlab-workspaces-proxy.labels" . | nindent 4 }}
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: {{ include "gitlab-workspaces-proxy.fullname" . }}
  minReplicas: {{ .Values.autoscaling.minReplicas }}
  maxReplicas: {{ .Values.autoscaling.maxReplicas }}
  metrics:
    {{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
    - type: Resource
      resource:
        name: cpu
        targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
    {{- end }}
    {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
    - type: Resource
      resource:
        name: memory
        targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
    {{- end }}
{{- end }}

Proposed Fix:

Update the apiVersion in the Helm chart from autoscaling/v2beta1 to autoscaling/v2, which is the stable and supported version.


Acceptance criteria

  • Update the apiVersion in the gitlab-workspaces-proxy Helm chart to autoscaling/v2.
  • Ensure the HorizontalPodAutoscaler manifests are compatible with Kubernetes 1.25 and up, as changes are needed.
  • Validate that the new API version works with the expected autoscaling behavior.

Implementation plan

  1. Modify the apiVersion in the Helm chart from autoscaling/v2beta1 to autoscaling/v2.
  2. Test the deployment on Kubernetes 1.30 to confirm gitlab-workspaces-proxy installs correctly.
  3. Verify that autoscaling functions as expected using the autoscaling/v2 API.
  4. Merge changes and update documentation if necessary.

Edited by broboa