Skip to content

Commit 9773f03

Browse files
committed
fix: align hpa behavior defaults with review
1 parent f6c5fc4 commit 9773f03

File tree

3 files changed

+42
-32
lines changed

3 files changed

+42
-32
lines changed

charts/netbox/templates/hpa.yaml

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,36 +16,39 @@ spec:
1616
name: {{ include "common.names.fullname" . }}
1717
minReplicas: {{ .Values.autoscaling.minReplicas }}
1818
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
19-
{{- if .Values.autoscaling.behavior }}
19+
{{- $behavior := .Values.autoscaling.behavior }}
20+
{{- if $behavior }}
2021
behavior:
21-
{{- with .Values.autoscaling.behavior.scaleUp }}
22+
{{- $scaleUp := $behavior.scaleUp }}
23+
{{- if $scaleUp }}
2224
scaleUp:
23-
{{- if .stabilizationWindowSeconds }}
24-
stabilizationWindowSeconds: {{ .stabilizationWindowSeconds }}
25+
{{- if $scaleUp.stabilizationWindowSeconds }}
26+
stabilizationWindowSeconds: {{ $scaleUp.stabilizationWindowSeconds }}
2527
{{- end }}
26-
{{- if .selectPolicy }}
27-
selectPolicy: {{ .selectPolicy | quote }}
28+
{{- if $scaleUp.selectPolicy }}
29+
selectPolicy: {{ $scaleUp.selectPolicy | quote }}
2830
{{- end }}
29-
{{- with .policies }}
31+
{{- if $scaleUp.policies }}
3032
policies:
31-
{{- range . }}
33+
{{- range $scaleUp.policies }}
3234
- type: {{ .type | quote }}
3335
value: {{ .value }}
3436
periodSeconds: {{ .periodSeconds }}
3537
{{- end }}
3638
{{- end }}
3739
{{- end }}
38-
{{- with .Values.autoscaling.behavior.scaleDown }}
40+
{{- $scaleDown := $behavior.scaleDown }}
41+
{{- if $scaleDown }}
3942
scaleDown:
40-
{{- if .stabilizationWindowSeconds }}
41-
stabilizationWindowSeconds: {{ .stabilizationWindowSeconds }}
43+
{{- if $scaleDown.stabilizationWindowSeconds }}
44+
stabilizationWindowSeconds: {{ $scaleDown.stabilizationWindowSeconds }}
4245
{{- end }}
43-
{{- if .selectPolicy }}
44-
selectPolicy: {{ .selectPolicy | quote }}
46+
{{- if $scaleDown.selectPolicy }}
47+
selectPolicy: {{ $scaleDown.selectPolicy | quote }}
4548
{{- end }}
46-
{{- with .policies }}
49+
{{- if $scaleDown.policies }}
4750
policies:
48-
{{- range . }}
51+
{{- range $scaleDown.policies }}
4952
- type: {{ .type | quote }}
5053
value: {{ .value }}
5154
periodSeconds: {{ .periodSeconds }}

charts/netbox/templates/worker/hpa.yaml

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,36 +16,39 @@ spec:
1616
name: {{ include "common.names.fullname" . }}-worker
1717
minReplicas: {{ .Values.worker.autoscaling.minReplicas }}
1818
maxReplicas: {{ .Values.worker.autoscaling.maxReplicas }}
19-
{{- if .Values.worker.autoscaling.behavior }}
19+
{{- $behavior := .Values.worker.autoscaling.behavior }}
20+
{{- if $behavior }}
2021
behavior:
21-
{{- with .Values.worker.autoscaling.behavior.scaleUp }}
22+
{{- $scaleUp := $behavior.scaleUp }}
23+
{{- if $scaleUp }}
2224
scaleUp:
23-
{{- if .stabilizationWindowSeconds }}
24-
stabilizationWindowSeconds: {{ .stabilizationWindowSeconds }}
25+
{{- if $scaleUp.stabilizationWindowSeconds }}
26+
stabilizationWindowSeconds: {{ $scaleUp.stabilizationWindowSeconds }}
2527
{{- end }}
26-
{{- if .selectPolicy }}
27-
selectPolicy: {{ .selectPolicy | quote }}
28+
{{- if $scaleUp.selectPolicy }}
29+
selectPolicy: {{ $scaleUp.selectPolicy | quote }}
2830
{{- end }}
29-
{{- with .policies }}
31+
{{- if $scaleUp.policies }}
3032
policies:
31-
{{- range . }}
33+
{{- range $scaleUp.policies }}
3234
- type: {{ .type | quote }}
3335
value: {{ .value }}
3436
periodSeconds: {{ .periodSeconds }}
3537
{{- end }}
3638
{{- end }}
3739
{{- end }}
38-
{{- with .Values.worker.autoscaling.behavior.scaleDown }}
40+
{{- $scaleDown := $behavior.scaleDown }}
41+
{{- if $scaleDown }}
3942
scaleDown:
40-
{{- if .stabilizationWindowSeconds }}
41-
stabilizationWindowSeconds: {{ .stabilizationWindowSeconds }}
43+
{{- if $scaleDown.stabilizationWindowSeconds }}
44+
stabilizationWindowSeconds: {{ $scaleDown.stabilizationWindowSeconds }}
4245
{{- end }}
43-
{{- if .selectPolicy }}
44-
selectPolicy: {{ .selectPolicy | quote }}
46+
{{- if $scaleDown.selectPolicy }}
47+
selectPolicy: {{ $scaleDown.selectPolicy | quote }}
4548
{{- end }}
46-
{{- with .policies }}
49+
{{- if $scaleDown.policies }}
4750
policies:
48-
{{- range . }}
51+
{{- range $scaleDown.policies }}
4952
- type: {{ .type | quote }}
5053
value: {{ .value }}
5154
periodSeconds: {{ .periodSeconds }}

charts/netbox/values.schema.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,12 @@
178178
"type": ["integer", "null"]
179179
},
180180
"targetMemoryUtilizationPercentage": {
181-
"type": ["integer", "null"]
181+
"type": ["integer", "null"],
182+
"default": null
182183
},
183184
"behavior": {
184185
"type": "object",
186+
"default": {},
185187
"properties": {
186188
"scaleUp": {
187189
"type": "object",
@@ -1542,10 +1544,12 @@
15421544
"type": ["integer", "null"]
15431545
},
15441546
"targetMemoryUtilizationPercentage": {
1545-
"type": ["integer", "null"]
1547+
"type": ["integer", "null"],
1548+
"default": null
15461549
},
15471550
"behavior": {
15481551
"type": "object",
1552+
"default": {},
15491553
"properties": {
15501554
"scaleUp": {
15511555
"type": "object",

0 commit comments

Comments
 (0)