From 982d53c2003116607f21f398e177b86356386784 Mon Sep 17 00:00:00 2001 From: Jayme Howard Date: Fri, 13 Feb 2026 18:29:22 -0600 Subject: [PATCH] Add ContainerResource scaling to spire-server HPA (#746) * Add ContainerResource scaling to spire-server HPA Signed-off-by: Jayme Howard * Amend flag name to address feedback Signed-off-by: Jayme Howard --------- Signed-off-by: Jayme Howard Co-authored-by: kfox1111 --- charts/spire/charts/spire-server/README.md | 1 + .../spire/charts/spire-server/templates/hpa.yaml | 14 ++++++++++++++ charts/spire/charts/spire-server/values.yaml | 2 ++ 3 files changed, 17 insertions(+) diff --git a/charts/spire/charts/spire-server/README.md b/charts/spire/charts/spire-server/README.md index 0294f87..1d7e6a7 100644 --- a/charts/spire/charts/spire-server/README.md +++ b/charts/spire/charts/spire-server/README.md @@ -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.minReplicas` | Minimum replicas for autoscaling | `1` | | `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` | | `nodeSelector` | Select specific nodes to run on (currently only amd64 is supported by Tornjak) | `{}` | | `tolerations` | List of tolerations | `[]` | diff --git a/charts/spire/charts/spire-server/templates/hpa.yaml b/charts/spire/charts/spire-server/templates/hpa.yaml index 7fd457a..5d0eb5f 100644 --- a/charts/spire/charts/spire-server/templates/hpa.yaml +++ b/charts/spire/charts/spire-server/templates/hpa.yaml @@ -23,17 +23,31 @@ spec: maxReplicas: {{ .Values.autoscaling.maxReplicas }} metrics: {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- if .Values.autoscaling.scaleOnSPIREServerOnly }} + - type: ContainerResource + {{- else }} - type: Resource + {{- end }} resource: name: memory + {{- if .Values.autoscaling.scaleOnSPIREServerOnly }} + container: {{ .Chart.Name }} + {{- end }} target: type: Utilization averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} {{- end }} {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- if .Values.autoscaling.scaleOnSPIREServerOnly }} + - type: ContainerResource + {{- else }} - type: Resource + {{- end }} resource: name: cpu + {{- if .Values.autoscaling.scaleOnSPIREServerOnly }} + container: {{ .Chart.Name }} + {{- end }} target: type: Utilization averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} diff --git a/charts/spire/charts/spire-server/values.yaml b/charts/spire/charts/spire-server/values.yaml index bf093c6..e30b624 100644 --- a/charts/spire/charts/spire-server/values.yaml +++ b/charts/spire/charts/spire-server/values.yaml @@ -103,12 +103,14 @@ resources: {} ## @param autoscaling.enabled Flag to enable autoscaling ## @param autoscaling.minReplicas Minimum 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 ## autoscaling: enabled: false minReplicas: 1 maxReplicas: 100 + scaleOnSPIREServerOnly: false targetCPUUtilizationPercentage: 80 # targetMemoryUtilizationPercentage: 80