Skip to content

Commit 858b6e2

Browse files
authored
Add HPA to store gateway (#406)
* Add HPA to store gateway Signed-off-by: Matthew Ames <mames@yelp.com> * Fix changelog PR number Signed-off-by: Matthew Ames <mames@yelp.com> Signed-off-by: Matthew Ames <mames@yelp.com>
1 parent ac382ed commit 858b6e2

File tree

4 files changed

+43
-0
lines changed

4 files changed

+43
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* [ENHANCEMENT] Add verboseLogging option to nginx config #402
66
* [DEPENDENCY] Update quay.io/cortexproject/cortex Docker tag to v1.13.1 #401
77
* [ENHANCEMENT] Add pod topology spread constrant option to Ingester/Alertmanager statefulset #403
8+
* [ENHANCEMENT] Add HPA to store gateways #406
89

910
# 1.7.0 / 2022-09-23
1011

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,11 @@ Kubernetes: `^1.19.0-0`
791791
| store_gateway.&ZeroWidthSpace;affinity.&ZeroWidthSpace;podAntiAffinity.&ZeroWidthSpace;preferredDuringSchedulingIgnoredDuringExecution[0].&ZeroWidthSpace;podAffinityTerm.&ZeroWidthSpace;topologyKey | string | `"kubernetes.io/hostname"` | |
792792
| store_gateway.&ZeroWidthSpace;affinity.&ZeroWidthSpace;podAntiAffinity.&ZeroWidthSpace;preferredDuringSchedulingIgnoredDuringExecution[0].&ZeroWidthSpace;weight | int | `100` | |
793793
| store_gateway.&ZeroWidthSpace;annotations | object | `{}` | |
794+
| store_gateway.&ZeroWidthSpace;autoscaling.&ZeroWidthSpace;behavior | object | `{}` | Ref: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-configurable-scaling-behavior |
795+
| store_gateway.&ZeroWidthSpace;autoscaling.&ZeroWidthSpace;enabled | bool | `false` | |
796+
| store_gateway.&ZeroWidthSpace;autoscaling.&ZeroWidthSpace;maxReplicas | int | `30` | |
797+
| store_gateway.&ZeroWidthSpace;autoscaling.&ZeroWidthSpace;minReplicas | int | `3` | |
798+
| store_gateway.&ZeroWidthSpace;autoscaling.&ZeroWidthSpace;targetMemoryUtilizationPercentage | int | `80` | |
794799
| store_gateway.&ZeroWidthSpace;containerSecurityContext.&ZeroWidthSpace;enabled | bool | `true` | |
795800
| store_gateway.&ZeroWidthSpace;containerSecurityContext.&ZeroWidthSpace;readOnlyRootFilesystem | bool | `true` | |
796801
| store_gateway.&ZeroWidthSpace;enabled | bool | `true` | |
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{{- if and .Values.store_gateway.enabled .Values.store_gateway.autoscaling.enabled -}}
2+
{{- with .Values.store_gateway.autoscaling -}}
3+
apiVersion: autoscaling/v2beta2
4+
kind: HorizontalPodAutoscaler
5+
metadata:
6+
name: {{ include "cortex.storeGatewayFullname" $ }}
7+
namespace: {{ $.Release.Namespace }}
8+
labels:
9+
{{- include "cortex.storeGatewayLabels" $ | nindent 4 }}
10+
spec:
11+
scaleTargetRef:
12+
apiVersion: apps/v1
13+
kind: StatefulSet
14+
name: {{ include "cortex.storeGatewayFullname" $ }}
15+
minReplicas: {{ .minReplicas }}
16+
maxReplicas: {{ .maxReplicas }}
17+
metrics:
18+
- type: Resource
19+
resource:
20+
name: memory
21+
target:
22+
type: Utilization
23+
averageUtilization: {{ .targetMemoryUtilizationPercentage }}
24+
{{- with .behavior }}
25+
behavior:
26+
{{- toYaml . | nindent 4 }}
27+
{{- end }}
28+
{{- end }}
29+
{{- end }}

values.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,6 +1414,14 @@ store_gateway:
14141414

14151415
annotations: {}
14161416

1417+
autoscaling:
1418+
enabled: false
1419+
minReplicas: 3
1420+
maxReplicas: 30
1421+
targetMemoryUtilizationPercentage: 80
1422+
# -- Ref: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-configurable-scaling-behavior
1423+
behavior: {}
1424+
14171425
persistentVolume:
14181426
# -- If true Store-gateway will create/use a Persistent Volume Claim
14191427
# If false, use emptyDir

0 commit comments

Comments
 (0)