Skip to content

Commit f1f2e13

Browse files
committed
feat(hpa): add behavior configuration for HPA scale up and scale down policies
1 parent d864849 commit f1f2e13

File tree

6 files changed

+210
-1
lines changed

6 files changed

+210
-1
lines changed

charts/netbox/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v2
22
name: netbox
3-
version: 7.0.2
3+
version: 7.0.3
44
# renovate: image=ghcr.io/netbox-community/netbox
55
appVersion: "v4.4.1"
66
type: application

charts/netbox/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ The following table lists the configurable parameters for this chart and their d
307307
| `autoscaling.maxReplicas` | Maximum number of replicas when autoscaling is enabled | `100` |
308308
| `autoscaling.targetCPUUtilizationPercentage` | Target CPU utilisation percentage for autoscaling | `80` |
309309
| `autoscaling.targetMemoryUtilizationPercentage` | Target memory utilisation percentage for autoscaling | `null` |
310+
| `autoscaling.behavior` | HPA behavior (scaleUp/scaleDown policies and settings) | `{}` |
310311
| `nodeSelector` | Node labels for pod assignment | `{}` |
311312
| `tolerations` | Toleration labels for pod assignment | `[]` |
312313
| `updateStrategy` | Configure deployment update strategy | `{}` (defaults to `RollingUpdate`) |

charts/netbox/templates/hpa.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,43 @@ spec:
1616
name: {{ include "common.names.fullname" . }}
1717
minReplicas: {{ .Values.autoscaling.minReplicas }}
1818
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
19+
{{- with .Values.autoscaling.behavior }}
20+
behavior:
21+
{{- with .scaleUp }}
22+
scaleUp:
23+
{{- if .stabilizationWindowSeconds }}
24+
stabilizationWindowSeconds: {{ .stabilizationWindowSeconds }}
25+
{{- end }}
26+
{{- if .selectPolicy }}
27+
selectPolicy: {{ .selectPolicy | quote }}
28+
{{- end }}
29+
{{- with .policies }}
30+
policies:
31+
{{- range . }}
32+
- type: {{ .type | quote }}
33+
value: {{ .value }}
34+
periodSeconds: {{ .periodSeconds }}
35+
{{- end }}
36+
{{- end }}
37+
{{- end }}
38+
{{- with .scaleDown }}
39+
scaleDown:
40+
{{- if .stabilizationWindowSeconds }}
41+
stabilizationWindowSeconds: {{ .stabilizationWindowSeconds }}
42+
{{- end }}
43+
{{- if .selectPolicy }}
44+
selectPolicy: {{ .selectPolicy | quote }}
45+
{{- end }}
46+
{{- with .policies }}
47+
policies:
48+
{{- range . }}
49+
- type: {{ .type | quote }}
50+
value: {{ .value }}
51+
periodSeconds: {{ .periodSeconds }}
52+
{{- end }}
53+
{{- end }}
54+
{{- end }}
55+
{{- end }}
1956
metrics:
2057
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
2158
- type: Resource

charts/netbox/templates/worker/hpa.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,43 @@ spec:
1616
name: {{ include "common.names.fullname" . }}-worker
1717
minReplicas: {{ .Values.worker.autoscaling.minReplicas }}
1818
maxReplicas: {{ .Values.worker.autoscaling.maxReplicas }}
19+
{{- with .Values.worker.autoscaling.behavior }}
20+
behavior:
21+
{{- with .scaleUp }}
22+
scaleUp:
23+
{{- if .stabilizationWindowSeconds }}
24+
stabilizationWindowSeconds: {{ .stabilizationWindowSeconds }}
25+
{{- end }}
26+
{{- if .selectPolicy }}
27+
selectPolicy: {{ .selectPolicy | quote }}
28+
{{- end }}
29+
{{- with .policies }}
30+
policies:
31+
{{- range . }}
32+
- type: {{ .type | quote }}
33+
value: {{ .value }}
34+
periodSeconds: {{ .periodSeconds }}
35+
{{- end }}
36+
{{- end }}
37+
{{- end }}
38+
{{- with .scaleDown }}
39+
scaleDown:
40+
{{- if .stabilizationWindowSeconds }}
41+
stabilizationWindowSeconds: {{ .stabilizationWindowSeconds }}
42+
{{- end }}
43+
{{- if .selectPolicy }}
44+
selectPolicy: {{ .selectPolicy | quote }}
45+
{{- end }}
46+
{{- with .policies }}
47+
policies:
48+
{{- range . }}
49+
- type: {{ .type | quote }}
50+
value: {{ .value }}
51+
periodSeconds: {{ .periodSeconds }}
52+
{{- end }}
53+
{{- end }}
54+
{{- end }}
55+
{{- end }}
1956
metrics:
2057
{{- if .Values.worker.autoscaling.targetCPUUtilizationPercentage }}
2158
- type: Resource

charts/netbox/values.schema.json

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,52 @@
176176
},
177177
"targetCPUUtilizationPercentage": {
178178
"type": "integer"
179+
},
180+
"targetMemoryUtilizationPercentage": {
181+
"type": "integer"
182+
},
183+
"behavior": {
184+
"type": "object",
185+
"properties": {
186+
"scaleUp": {
187+
"type": "object",
188+
"properties": {
189+
"stabilizationWindowSeconds": { "type": "integer" },
190+
"selectPolicy": { "type": "string" },
191+
"policies": {
192+
"type": "array",
193+
"items": {
194+
"type": "object",
195+
"properties": {
196+
"type": { "type": "string" },
197+
"value": { "type": "integer" },
198+
"periodSeconds": { "type": "integer" }
199+
},
200+
"required": ["type", "value", "periodSeconds"]
201+
}
202+
}
203+
}
204+
},
205+
"scaleDown": {
206+
"type": "object",
207+
"properties": {
208+
"stabilizationWindowSeconds": { "type": "integer" },
209+
"selectPolicy": { "type": "string" },
210+
"policies": {
211+
"type": "array",
212+
"items": {
213+
"type": "object",
214+
"properties": {
215+
"type": { "type": "string" },
216+
"value": { "type": "integer" },
217+
"periodSeconds": { "type": "integer" }
218+
},
219+
"required": ["type", "value", "periodSeconds"]
220+
}
221+
}
222+
}
223+
}
224+
}
179225
}
180226
},
181227
"type": "object"
@@ -1494,6 +1540,52 @@
14941540
},
14951541
"targetCPUUtilizationPercentage": {
14961542
"type": "integer"
1543+
},
1544+
"targetMemoryUtilizationPercentage": {
1545+
"type": "integer"
1546+
},
1547+
"behavior": {
1548+
"type": "object",
1549+
"properties": {
1550+
"scaleUp": {
1551+
"type": "object",
1552+
"properties": {
1553+
"stabilizationWindowSeconds": { "type": "integer" },
1554+
"selectPolicy": { "type": "string" },
1555+
"policies": {
1556+
"type": "array",
1557+
"items": {
1558+
"type": "object",
1559+
"properties": {
1560+
"type": { "type": "string" },
1561+
"value": { "type": "integer" },
1562+
"periodSeconds": { "type": "integer" }
1563+
},
1564+
"required": ["type", "value", "periodSeconds"]
1565+
}
1566+
}
1567+
}
1568+
},
1569+
"scaleDown": {
1570+
"type": "object",
1571+
"properties": {
1572+
"stabilizationWindowSeconds": { "type": "integer" },
1573+
"selectPolicy": { "type": "string" },
1574+
"policies": {
1575+
"type": "array",
1576+
"items": {
1577+
"type": "object",
1578+
"properties": {
1579+
"type": { "type": "string" },
1580+
"value": { "type": "integer" },
1581+
"periodSeconds": { "type": "integer" }
1582+
},
1583+
"required": ["type", "value", "periodSeconds"]
1584+
}
1585+
}
1586+
}
1587+
}
1588+
}
14971589
}
14981590
},
14991591
"type": "object"

charts/netbox/values.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,13 +1166,34 @@ cachingDatabase:
11661166
## @param autoscaling.maxReplicas Maximum number of replicas
11671167
## @param autoscaling.targetCPUUtilizationPercentage Target CPU utilization percentage
11681168
## @param autoscaling.targetMemoryUtilizationPercentage Target Memory utilization percentage
1169+
## @param autoscaling.behavior.scaleUp.stabilizationWindowSeconds Scale-up stabilization window in seconds
1170+
## @param autoscaling.behavior.scaleUp.selectPolicy Policy selection for scale-up (Max|Min|Disabled)
1171+
## @param autoscaling.behavior.scaleUp.policies List of scale-up policies [{type,value,periodSeconds}]
1172+
## @param autoscaling.behavior.scaleDown.stabilizationWindowSeconds Scale-down stabilization window in seconds
1173+
## @param autoscaling.behavior.scaleDown.selectPolicy Policy selection for scale-down (Max|Min|Disabled)
1174+
## @param autoscaling.behavior.scaleDown.policies List of scale-down policies [{type,value,periodSeconds}]
11691175
##
11701176
autoscaling:
11711177
enabled: false
11721178
minReplicas: 1
11731179
maxReplicas: 100
11741180
targetCPUUtilizationPercentage: 80
11751181
# targetMemoryUtilizationPercentage: 80
1182+
# behavior:
1183+
# scaleUp:
1184+
# stabilizationWindowSeconds: 0
1185+
# selectPolicy: Max
1186+
# policies:
1187+
# - type: Percent
1188+
# value: 100
1189+
# periodSeconds: 60
1190+
# scaleDown:
1191+
# stabilizationWindowSeconds: 300
1192+
# selectPolicy: Max
1193+
# policies:
1194+
# - type: Percent
1195+
# value: 100
1196+
# periodSeconds: 60
11761197

11771198
## @section Volume permissions parameters
11781199

@@ -1654,13 +1675,34 @@ worker:
16541675
## @param worker.autoscaling.maxReplicas Maximum number of replicas
16551676
## @param worker.autoscaling.targetCPUUtilizationPercentage Target CPU utilization percentage
16561677
## @param worker.autoscaling.targetMemoryUtilizationPercentage Target Memory utilization percentage
1678+
## @param worker.autoscaling.behavior.scaleUp.stabilizationWindowSeconds Scale-up stabilization window in seconds
1679+
## @param worker.autoscaling.behavior.scaleUp.selectPolicy Policy selection for scale-up (Max|Min|Disabled)
1680+
## @param worker.autoscaling.behavior.scaleUp.policies List of scale-up policies [{type,value,periodSeconds}]
1681+
## @param worker.autoscaling.behavior.scaleDown.stabilizationWindowSeconds Scale-down stabilization window in seconds
1682+
## @param worker.autoscaling.behavior.scaleDown.selectPolicy Policy selection for scale-down (Max|Min|Disabled)
1683+
## @param worker.autoscaling.behavior.scaleDown.policies List of scale-down policies [{type,value,periodSeconds}]
16571684
##
16581685
autoscaling:
16591686
enabled: false
16601687
minReplicas: 1
16611688
maxReplicas: 100
16621689
targetCPUUtilizationPercentage: 80
16631690
# targetMemoryUtilizationPercentage: 80
1691+
# behavior:
1692+
# scaleUp:
1693+
# stabilizationWindowSeconds: 0
1694+
# selectPolicy: Max
1695+
# policies:
1696+
# - type: Percent
1697+
# value: 100
1698+
# periodSeconds: 60
1699+
# scaleDown:
1700+
# stabilizationWindowSeconds: 300
1701+
# selectPolicy: Max
1702+
# policies:
1703+
# - type: Percent
1704+
# value: 100
1705+
# periodSeconds: 60
16641706
## @param worker.extraEnvs Extra environment variables to be set on containers
16651707
## E.g:
16661708
## extraEnvs:

0 commit comments

Comments
 (0)