Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions charts/portkey-gateway/templates/gateway/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,39 @@ spec:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- with .Values.autoscaling.customMetrics }}
{{- toYaml . | nindent 4 }}
{{- end }}
behavior:
scaleUp:
stabilizationWindowSeconds: {{ .Values.autoscaling.behavior.scaleUp.stabilizationWindowSeconds | default 0 }}
{{- if .Values.autoscaling.behavior.scaleUp.selectPolicy }}
selectPolicy: {{ .Values.autoscaling.behavior.scaleUp.selectPolicy }}
{{- end }}
{{- if .Values.autoscaling.behavior.scaleUp.policies }}
policies:
{{- toYaml .Values.autoscaling.behavior.scaleUp.policies | nindent 8 }}
{{- else }}
policies:
- type: Pods
value: {{ .Values.autoscaling.behavior.scaleUp.podScaleUpValue | default 4 }}
periodSeconds: {{ .Values.autoscaling.behavior.scaleUp.periodSeconds | default 15 }}
- type: Percent
value: {{ .Values.autoscaling.behavior.scaleUp.percentScaleUpValue | default 100 }}
periodSeconds: {{ .Values.autoscaling.behavior.scaleUp.periodSeconds | default 15 }}
{{- end }}
scaleDown:
stabilizationWindowSeconds: {{ .Values.autoscaling.behavior.scaleDown.stabilizationWindowSeconds | default 300 }}
{{- if .Values.autoscaling.behavior.scaleDown.selectPolicy }}
selectPolicy: {{ .Values.autoscaling.behavior.scaleDown.selectPolicy }}
{{- end }}
{{- if .Values.autoscaling.behavior.scaleDown.policies }}
policies:
{{- toYaml .Values.autoscaling.behavior.scaleDown.policies | nindent 8 }}
{{- else }}
policies:
- type: Pods
value: {{ .Values.autoscaling.behavior.scaleDown.podScaleDownValue | default 1 }}
periodSeconds: {{ .Values.autoscaling.behavior.scaleDown.periodSeconds | default 60 }}
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/portkey-gateway/templates/redis/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if eq .Values.environment.data.CACHE_STORE "redis" }}
{{- if and (eq .Values.environment.data.CACHE_STORE "redis") .Values.redis.deployLocal }}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down
2 changes: 1 addition & 1 deletion charts/portkey-gateway/templates/redis/service.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if eq .Values.environment.data.CACHE_STORE "redis" }}
{{- if and (eq .Values.environment.data.CACHE_STORE "redis") .Values.redis.deployLocal }}
Copy link
Copy Markdown
Contributor

@sk-portkey sk-portkey Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@camjay Thanks for putting this together — the HPA enhancements (customMetrics, selectPolicy, configurable policies) look useful and I'm happy to take those in.

For the redis.deployLocal part, I'd like to hold off. Today the chart already gates the Redis Deployment/Service on CACHE_STORE = "redis" — so users pointing at external Redis can control this through the existing environment config. Adding deployLocal as a second flag means operators now need to reason about two knobs (CACHE_STORE and deployLocal) to control one outcome, which adds friction without a clear benefit over what's already there.

I realize there's a gap if someone wants CACHE_STORE = "redis" (to tell the app to use Redis) but doesn't want the in-cluster Redis deployed. If that's the use case you're hitting, I'd be interested to hear more — we could look at a cleaner way to handle it. But as a general-purpose toggle, I think it overlaps too much with the existing condition.

Would you be open to splitting out the HPA changes into their own PR so we can move those forward?

apiVersion: v1
kind: Service
metadata:
Expand Down
20 changes: 18 additions & 2 deletions charts/portkey-gateway/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -238,16 +238,27 @@ autoscaling:
maxReplicas: 20
targetCPUUtilizationPercentage: 60
targetMemoryUtilizationPercentage: 60
# customMetrics: []
behavior:
scaleUp:
stabilizationWindowSeconds: 0
# selectPolicy: Max
podScaleUpValue: 2
percentScaleUpValue: 100
periodSeconds: 2
# policies:
# - type: Pods
# value: 2
# periodSeconds: 2
scaleDown:
stabilizationWindowSeconds: 300
# selectPolicy: Min
podScaleDownValue: 1
periodSeconds: 60
# policies:
# - type: Pods
# value: 1
# periodSeconds: 60

# Additional volumes on the output Deployment definition.
volumes: []
Expand Down Expand Up @@ -400,11 +411,16 @@ dataservice:

# Redis-specific configuration section
redis:
name: "redis"
serviceType: NodePort
name: "redis"
serviceType: NodePort
servicePort: 6379
containerPort: 6379
resources: {}
# Set to false to skip deploying in-cluster Redis when using an external Redis/ElastiCache instance.
# When deployLocal is set to false, you MUST also configure Redis connection env vars
# (e.g. environment.data.REDIS_URL, or REDIS_HOST/REDIS_PORT) to point to your external Redis;
# otherwise the deployment will still try to connect to the default in-cluster service (redis://redis:6379).
deployLocal: true

# MinIO configuration section
minio:
Expand Down