Skip to content

Commit 55d3170

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

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: 6.1.17
3+
version: 6.1.18
44
# renovate: image=ghcr.io/netbox-community/netbox
55
appVersion: "v4.4.0"
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"
@@ -1485,6 +1531,52 @@
14851531
},
14861532
"targetCPUUtilizationPercentage": {
14871533
"type": "integer"
1534+
},
1535+
"targetMemoryUtilizationPercentage": {
1536+
"type": "integer"
1537+
},
1538+
"behavior": {
1539+
"type": "object",
1540+
"properties": {
1541+
"scaleUp": {
1542+
"type": "object",
1543+
"properties": {
1544+
"stabilizationWindowSeconds": { "type": "integer" },
1545+
"selectPolicy": { "type": "string" },
1546+
"policies": {
1547+
"type": "array",
1548+
"items": {
1549+
"type": "object",
1550+
"properties": {
1551+
"type": { "type": "string" },
1552+
"value": { "type": "integer" },
1553+
"periodSeconds": { "type": "integer" }
1554+
},
1555+
"required": ["type", "value", "periodSeconds"]
1556+
}
1557+
}
1558+
}
1559+
},
1560+
"scaleDown": {
1561+
"type": "object",
1562+
"properties": {
1563+
"stabilizationWindowSeconds": { "type": "integer" },
1564+
"selectPolicy": { "type": "string" },
1565+
"policies": {
1566+
"type": "array",
1567+
"items": {
1568+
"type": "object",
1569+
"properties": {
1570+
"type": { "type": "string" },
1571+
"value": { "type": "integer" },
1572+
"periodSeconds": { "type": "integer" }
1573+
},
1574+
"required": ["type", "value", "periodSeconds"]
1575+
}
1576+
}
1577+
}
1578+
}
1579+
}
14881580
}
14891581
},
14901582
"type": "object"

charts/netbox/values.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,13 +1153,34 @@ cachingDatabase:
11531153
## @param autoscaling.maxReplicas Maximum number of replicas
11541154
## @param autoscaling.targetCPUUtilizationPercentage Target CPU utilization percentage
11551155
## @param autoscaling.targetMemoryUtilizationPercentage Target Memory utilization percentage
1156+
## @param autoscaling.behavior.scaleUp.stabilizationWindowSeconds Scale-up stabilization window in seconds
1157+
## @param autoscaling.behavior.scaleUp.selectPolicy Policy selection for scale-up (Max|Min|Disabled)
1158+
## @param autoscaling.behavior.scaleUp.policies List of scale-up policies [{type,value,periodSeconds}]
1159+
## @param autoscaling.behavior.scaleDown.stabilizationWindowSeconds Scale-down stabilization window in seconds
1160+
## @param autoscaling.behavior.scaleDown.selectPolicy Policy selection for scale-down (Max|Min|Disabled)
1161+
## @param autoscaling.behavior.scaleDown.policies List of scale-down policies [{type,value,periodSeconds}]
11561162
##
11571163
autoscaling:
11581164
enabled: false
11591165
minReplicas: 1
11601166
maxReplicas: 100
11611167
targetCPUUtilizationPercentage: 80
11621168
# targetMemoryUtilizationPercentage: 80
1169+
# behavior:
1170+
# scaleUp:
1171+
# stabilizationWindowSeconds: 0
1172+
# selectPolicy: Max
1173+
# policies:
1174+
# - type: Percent
1175+
# value: 100
1176+
# periodSeconds: 60
1177+
# scaleDown:
1178+
# stabilizationWindowSeconds: 300
1179+
# selectPolicy: Max
1180+
# policies:
1181+
# - type: Percent
1182+
# value: 100
1183+
# periodSeconds: 60
11631184

11641185
## @section Volume permissions parameters
11651186

@@ -1630,13 +1651,34 @@ worker:
16301651
## @param worker.autoscaling.maxReplicas Maximum number of replicas
16311652
## @param worker.autoscaling.targetCPUUtilizationPercentage Target CPU utilization percentage
16321653
## @param worker.autoscaling.targetMemoryUtilizationPercentage Target Memory utilization percentage
1654+
## @param worker.autoscaling.behavior.scaleUp.stabilizationWindowSeconds Scale-up stabilization window in seconds
1655+
## @param worker.autoscaling.behavior.scaleUp.selectPolicy Policy selection for scale-up (Max|Min|Disabled)
1656+
## @param worker.autoscaling.behavior.scaleUp.policies List of scale-up policies [{type,value,periodSeconds}]
1657+
## @param worker.autoscaling.behavior.scaleDown.stabilizationWindowSeconds Scale-down stabilization window in seconds
1658+
## @param worker.autoscaling.behavior.scaleDown.selectPolicy Policy selection for scale-down (Max|Min|Disabled)
1659+
## @param worker.autoscaling.behavior.scaleDown.policies List of scale-down policies [{type,value,periodSeconds}]
16331660
##
16341661
autoscaling:
16351662
enabled: false
16361663
minReplicas: 1
16371664
maxReplicas: 100
16381665
targetCPUUtilizationPercentage: 80
16391666
# targetMemoryUtilizationPercentage: 80
1667+
# behavior:
1668+
# scaleUp:
1669+
# stabilizationWindowSeconds: 0
1670+
# selectPolicy: Max
1671+
# policies:
1672+
# - type: Percent
1673+
# value: 100
1674+
# periodSeconds: 60
1675+
# scaleDown:
1676+
# stabilizationWindowSeconds: 300
1677+
# selectPolicy: Max
1678+
# policies:
1679+
# - type: Percent
1680+
# value: 100
1681+
# periodSeconds: 60
16401682
## @param worker.extraEnvs Extra environment variables to be set on containers
16411683
## E.g:
16421684
## extraEnvs:

0 commit comments

Comments
 (0)