Skip to content

Commit 1227914

Browse files
committed
DND-1443: migrate hpa.yaml to autoscaling/v2 and gate it
hpa.yaml emitted apiVersion: autoscaling/v2beta1, removed in Kubernetes 1.25. On any cluster >= 1.25, autoscaling.enabled=true produced a HorizontalPodAutoscaler the API server rejects; kubeconform (strict) also failed it ("could not find schema for HorizontalPodAutoscaler"). - hpa.yaml: apiVersion autoscaling/v2beta1 -> autoscaling/v2, and the metrics shape migrated to the v2 form (spec.metrics[].resource.target.type=Utilization + averageUtilization, instead of targetAverageUtilization). - Add test-values/autoscaling.yaml (HPA enabled, CPU + memory targets) and register it in the lint-render matrix so kubeconform now validates the HPA. Previously no gated scenario enabled autoscaling, so the HPA was never rendered or checked. helm-diff globs test-values/*.yaml and picks it up too. No Chart.yaml version bump (deferred, handled separately), so verify-version fails by design for now. Verified: renders autoscaling/v2 with the v2 metrics shape; kubeconform -strict (no HPA skip, CI-equivalent) validates all rendered resources; helm lint + actionlint clean.
1 parent 2291f5f commit 1227914

3 files changed

Lines changed: 33 additions & 3 deletions

File tree

.github/workflows/lint-render.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
- test-values/rackspace.yaml
3636
- test-values/multi-backend.yaml
3737
- test-values/ingress.yaml
38+
- test-values/autoscaling.yaml
3839
steps:
3940
- name: Checkout
4041
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

charts/s3proxy/templates/hpa.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{- if .Values.autoscaling.enabled }}
2-
apiVersion: autoscaling/v2beta1
2+
apiVersion: autoscaling/v2
33
kind: HorizontalPodAutoscaler
44
metadata:
55
name: {{ include "s3proxy.fullname" . }}
@@ -17,12 +17,16 @@ spec:
1717
- type: Resource
1818
resource:
1919
name: cpu
20-
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
20+
target:
21+
type: Utilization
22+
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
2123
{{- end }}
2224
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
2325
- type: Resource
2426
resource:
2527
name: memory
26-
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
28+
target:
29+
type: Utilization
30+
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
2731
{{- end }}
2832
{{- end }}

test-values/autoscaling.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Render/lint scenario: HorizontalPodAutoscaler enabled, exercising both the CPU
2+
# and memory target metrics. kubeconform validates the rendered HPA against the
3+
# Kubernetes schema, so this scenario is the gate that keeps hpa.yaml on the
4+
# supported autoscaling/v2 API (the removed autoscaling/v2beta1 was rejected by
5+
# kubeconform on k8s >= 1.25 — DND-1443).
6+
config:
7+
auth:
8+
type: aws-v4
9+
identity: test-access-key
10+
secret: test-secret-key
11+
backends:
12+
filesystem:
13+
enabled: true
14+
autoscaling:
15+
enabled: true
16+
minReplicas: 2
17+
maxReplicas: 5
18+
targetCPUUtilizationPercentage: 80
19+
targetMemoryUtilizationPercentage: 75
20+
persistence:
21+
enabled: false
22+
resources:
23+
requests:
24+
cpu: 100m
25+
memory: 256Mi

0 commit comments

Comments
 (0)