rimusz / charts

Helm Charts for Kubernetes
MIT License
90 stars 70 forks source link

gcloud-sqlproxy - Helm Chart hpa fails using autoscaling/v2 #134

Closed ChristianGeie closed 1 year ago

ChristianGeie commented 1 year ago

Hello, in version 0.24.0 helmchart fails while applying hpa. For version 0.23.0 everything works well.

I see that between both version some changes regarding apiVersion happend, it was changed from autoscaling/v2beta1 to autoscaling/v2 which is fine, because v2beta1 is deprecated in 1.19 and no longer served as of 1.25.

autoscaling/v2 is available since 1.23, but has some breaking changes that are currently not reflected in the gcloud-sqlproxy chart.

I would like to suggest using autoscaling/v2beta2 to apply HorizontalPodAutoscaler ressource.

K8s: v1.23.14-gke.1800 Error while applying helm chart:

Helm upgrade failed: error validating "": error validating data: [ValidationError(HorizontalPodAutoscaler.spec.metrics[0].resource): unknown field "targe
tAverageUtilization" in io.k8s.api.autoscaling.v2.ResourceMetricSource, ValidationError(HorizontalPodAutoscaler.spec.metrics[0].resource): missing required field "target" in io.k8s
.api.autoscaling.v2.ResourceMetricSource]
tomrk-esteam8 commented 1 year ago

Hi, if I understand it correctly, there is an error in the way metrics are builded.

I mean: https://github.com/rimusz/charts/blame/master/stable/gcloud-sqlproxy/templates/horizontalpodautoscaler.yaml#L19-L29

 {{- 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 }}

when it should be sth like this:

https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-resource-metrics

type: Resource
resource:
  name: cpu
  target:
    type: Utilization
    averageUtilization: 60

I can try to fix it.

rimusz commented 1 year ago

@tomrk-esteam8 yes please :)

ChristianGeie commented 1 year ago

@tomrk-esteam8 Do you want to simple switch to autoscaling/v2beta2 or do you want to use autoscaling/v2 furthermore and adapt the hpa template to it?

Please note that the api is only supported from v1.23 and the gcloud-sqlproxy helm chart will then become unusable for users who are still using an older kubernetes version.

@rimusz Are there any specifications as to which k8s version should be supported?

tomrk-esteam8 commented 1 year ago

@ChristianGeie I would stick with autoscaling/v2 as it is already switched and chart is unusable anyway at this point.

ChristianGeie commented 1 year ago

@tomrk-esteam8 :+1: