Add ContainerResource scaling to spire-server HPA (#746)

* Add ContainerResource scaling to spire-server HPA

Signed-off-by: Jayme Howard <[email protected]>

* Amend flag name to address feedback

Signed-off-by: Jayme Howard <[email protected]>

---------

Signed-off-by: Jayme Howard <[email protected]>
Co-authored-by: kfox1111 <[email protected]>
This commit is contained in:
Jayme Howard
2026-02-14 00:29:22 +00:00
committed by GitHub
co-authored by kfox1111
parent 8abac78a15
commit 982d53c200
3 changed files with 17 additions and 0 deletions
@@ -110,6 +110,7 @@ In order to run Tornjak with simple HTTP Connection only, make sure you don't cr
| `autoscaling.enabled` | Flag to enable autoscaling | `false` | | `autoscaling.enabled` | Flag to enable autoscaling | `false` |
| `autoscaling.minReplicas` | Minimum replicas for autoscaling | `1` | | `autoscaling.minReplicas` | Minimum replicas for autoscaling | `1` |
| `autoscaling.maxReplicas` | Maximum replicas for autoscaling | `100` | | `autoscaling.maxReplicas` | Maximum replicas for autoscaling | `100` |
| `autoscaling.scaleOnSPIREServerOnly` | Flag to only consider the main SPIRE container for autoscaling purposes | `false` |
| `autoscaling.targetCPUUtilizationPercentage` | Target CPU utilization that triggers autoscaling | `80` | | `autoscaling.targetCPUUtilizationPercentage` | Target CPU utilization that triggers autoscaling | `80` |
| `nodeSelector` | Select specific nodes to run on (currently only amd64 is supported by Tornjak) | `{}` | | `nodeSelector` | Select specific nodes to run on (currently only amd64 is supported by Tornjak) | `{}` |
| `tolerations` | List of tolerations | `[]` | | `tolerations` | List of tolerations | `[]` |
@@ -23,17 +23,31 @@ spec:
maxReplicas: {{ .Values.autoscaling.maxReplicas }} maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics: metrics:
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- if .Values.autoscaling.scaleOnSPIREServerOnly }}
- type: ContainerResource
{{- else }}
- type: Resource - type: Resource
{{- end }}
resource: resource:
name: memory name: memory
{{- if .Values.autoscaling.scaleOnSPIREServerOnly }}
container: {{ .Chart.Name }}
{{- end }}
target: target:
type: Utilization type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }} {{- end }}
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }} {{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- if .Values.autoscaling.scaleOnSPIREServerOnly }}
- type: ContainerResource
{{- else }}
- type: Resource - type: Resource
{{- end }}
resource: resource:
name: cpu name: cpu
{{- if .Values.autoscaling.scaleOnSPIREServerOnly }}
container: {{ .Chart.Name }}
{{- end }}
target: target:
type: Utilization type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
@@ -103,12 +103,14 @@ resources: {}
## @param autoscaling.enabled Flag to enable autoscaling ## @param autoscaling.enabled Flag to enable autoscaling
## @param autoscaling.minReplicas Minimum replicas for autoscaling ## @param autoscaling.minReplicas Minimum replicas for autoscaling
## @param autoscaling.maxReplicas Maximum replicas for autoscaling ## @param autoscaling.maxReplicas Maximum replicas for autoscaling
## @param autoscaling.scaleOnSPIREServerOnly Flag to only consider the main SPIRE container for autoscaling purposes
## @param autoscaling.targetCPUUtilizationPercentage Target CPU utilization that triggers autoscaling ## @param autoscaling.targetCPUUtilizationPercentage Target CPU utilization that triggers autoscaling
## ##
autoscaling: autoscaling:
enabled: false enabled: false
minReplicas: 1 minReplicas: 1
maxReplicas: 100 maxReplicas: 100
scaleOnSPIREServerOnly: false
targetCPUUtilizationPercentage: 80 targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80 # targetMemoryUtilizationPercentage: 80