Skip to content

Commit f454b42

Browse files
committed
fix(autoscaler): preserve newline before apiVersion to prevent validation errors
1 parent d6a0448 commit f454b42

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

HelmChart/Public/oneuptime/templates/_helpers.tpl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,6 +909,13 @@ the global .Values.autoscaling block, but a per-service Override block (passed a
909909
.Override, e.g. .Values.nginx.autoscaling) can override any subset of
910910
enabled / minReplicas / maxReplicas / targetCPUUtilizationPercentage /
911911
targetMemoryUtilizationPercentage. Keys absent from Override inherit the global.
912+
913+
The block below intentionally preserves the newline immediately before
914+
"apiVersion" (the last override `{{- end }}` is NOT right-trimmed). Callers place
915+
a descriptive "# ... autoscaler" comment right before this include; without the
916+
leading newline Helm's whitespace trimming glues apiVersion onto that comment
917+
line, silently commenting it out and producing "error validating data: apiVersion
918+
not set" on upgrade. Mirrors the leading newline that oneuptime.service relies on.
912919
*/}}
913920
{{- define "oneuptime.autoscaler" }}
914921
{{- $g := .Values.autoscaling | default dict -}}
@@ -923,7 +930,7 @@ targetMemoryUtilizationPercentage. Keys absent from Override inherit the global.
923930
{{- $targetCPU := $g.targetCPUUtilizationPercentage -}}
924931
{{- if hasKey $o "targetCPUUtilizationPercentage" -}}{{- $targetCPU = $o.targetCPUUtilizationPercentage -}}{{- end -}}
925932
{{- $targetMemory := $g.targetMemoryUtilizationPercentage -}}
926-
{{- if hasKey $o "targetMemoryUtilizationPercentage" -}}{{- $targetMemory = $o.targetMemoryUtilizationPercentage -}}{{- end -}}
933+
{{- if hasKey $o "targetMemoryUtilizationPercentage" -}}{{- $targetMemory = $o.targetMemoryUtilizationPercentage -}}{{- end }}
927934
apiVersion: autoscaling/v2
928935
kind: HorizontalPodAutoscaler
929936
metadata:

0 commit comments

Comments
 (0)