Skip to content

Commit

Permalink
fix(chart): Update autoscaling to handle v2beta schema
Browse files Browse the repository at this point in the history
  • Loading branch information
JossWhittle committed Nov 15, 2023
1 parent 320e6df commit 5b2bcc2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
18 changes: 15 additions & 3 deletions charts/trino/templates/autoscaler.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
{{- if .Values.server.autoscaling.enabled -}}
apiVersion: autoscaling/v1
apiVersion: autoscaling/v2beta
kind: HorizontalPodAutoscaler
metadata:
name: {{ template "trino.worker" . }}
spec:
maxReplicas: {{ .Values.server.autoscaling.maxReplicas }}
maxReplicas: {{ max (.Values.server.workers) (.Values.server.autoscaling.maxReplicas) }}
minReplicas: {{ .Values.server.workers }}
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ template "trino.worker" . }}
targetCPUUtilizationPercentage: {{ .Values.server.autoscaling.targetCPUUtilizationPercentage }}
metrics:
{{- if .Values.server.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .Values.server.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.server.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
targetAverageUtilization: {{ .Values.server.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions charts/trino/templates/deployment-worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ metadata:
annotations:
reloader.stakater.com/auto: "true"
spec:
{{- if not (.Values.server.autoscaling.enabled) }}
replicas: {{ .Values.server.workers }}
{{- end }}
selector:
matchLabels:
app: {{ template "trino.name" . }}
Expand Down
1 change: 1 addition & 0 deletions charts/trino/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ server:
enabled: false
maxReplicas: 5
targetCPUUtilizationPercentage: 50
targetMemoryUtilizationPercentage:

# use this to override the standard entrypoint when you need to use the vault agent injector
entrypointOverride: {}
Expand Down

0 comments on commit 5b2bcc2

Please sign in to comment.