Skip to content

Commit

Permalink
feat: add option in chart to add hpa to gateway
Browse files Browse the repository at this point in the history
re envoyproxy#703

Signed-off-by: Gazal Gafoor <gazal.gafoor@rea-group.com>
  • Loading branch information
gazal-k committed Nov 27, 2023
1 parent 65cb354 commit de76435
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
2 changes: 2 additions & 0 deletions charts/gateway-helm/templates/envoy-gateway-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ metadata:
control-plane: envoy-gateway
{{- include "eg.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.deployment.replicas }}
{{- end }}
selector:
matchLabels:
control-plane: envoy-gateway
Expand Down
44 changes: 44 additions & 0 deletions charts/gateway-helm/templates/envoy-gateway-hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{{- if .Values.autoscaling.enabled -}}
apiVersion: {{ ternary "autoscaling/v2" "autoscaling/v2beta2" (.Capabilities.APIVersions.Has "autoscaling/v2") }}
kind: HorizontalPodAutoscaler
metadata:
{{- with .Values.autoscaling.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
labels:
control-plane: envoy-gateway
{{- include "eg.labels" . | nindent 4 }}
name: envoy-gateway
namespace: '{{ .Release.Namespace }}'
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: envoy-gateway
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- with .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ . }}
{{- end }}
{{- with .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ . }}
{{- end }}
{{- with .Values.autoscalingTemplate }}
{{- toYaml . | nindent 2 }}
{{- end }}
{{- with .Values.autoscaling.behavior }}
behavior:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
8 changes: 8 additions & 0 deletions charts/gateway-helm/values.tmpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ deployment:
annotations: {}
labels: {}

autoscaling:
enabled: false
annotations: {}
minReplicas: 1
maxReplicas: 10
targetCPUUtilizationPercentage: 60
targetMemoryUtilizationPercentage: 60

config:
envoyGateway:
gateway:
Expand Down

0 comments on commit de76435

Please sign in to comment.