Skip to content

Commit

Permalink
fix(chart): Update autoscaling to handle v2beta schema (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
JossWhittle authored Nov 15, 2023
1 parent 320e6df commit 657c116
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
14 changes: 11 additions & 3 deletions charts/trino/templates/autoscaler.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
{{- if .Values.server.autoscaling.enabled -}}
apiVersion: autoscaling/v1
apiVersion: autoscaling/v2
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 }}
{{- if .Values.server.autoscaling.metrics }}
metrics:
{{- tpl (toYaml .Values.server.autoscaling.metrics) . | nindent 4 }}
{{- end }}
{{- if .Values.server.autoscaling.behavior }}
behavior:
{{- tpl (toYaml .Values.server.autoscaling.behavior) . | nindent 4 }}
{{- 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
9 changes: 8 additions & 1 deletion charts/trino/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,14 @@ server:
autoscaling:
enabled: false
maxReplicas: 5
targetCPUUtilizationPercentage: 50
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 50
behavior:

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

0 comments on commit 657c116

Please sign in to comment.