Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HPA to store gateway #406

Merged
merged 2 commits into from
Oct 19, 2022
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* [ENHANCEMENT] Add verboseLogging option to nginx config #402
* [DEPENDENCY] Update quay.io/cortexproject/cortex Docker tag to v1.13.1 #401
* [ENHANCEMENT] Add pod topology spread constrant option to Ingester/Alertmanager statefulset #403
* [ENHANCEMENT] Add HPA to store gateways #406

# 1.7.0 / 2022-09-23

Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,11 @@ Kubernetes: `^1.19.0-0`
| store_gateway.​affinity.​podAntiAffinity.​preferredDuringSchedulingIgnoredDuringExecution[0].​podAffinityTerm.​topologyKey | string | `"kubernetes.io/hostname"` | |
| store_gateway.​affinity.​podAntiAffinity.​preferredDuringSchedulingIgnoredDuringExecution[0].​weight | int | `100` | |
| store_gateway.​annotations | object | `{}` | |
| store_gateway.​autoscaling.​behavior | object | `{}` | Ref: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-configurable-scaling-behavior |
| store_gateway.​autoscaling.​enabled | bool | `false` | |
| store_gateway.​autoscaling.​maxReplicas | int | `30` | |
| store_gateway.​autoscaling.​minReplicas | int | `3` | |
| store_gateway.​autoscaling.​targetMemoryUtilizationPercentage | int | `80` | |
| store_gateway.​containerSecurityContext.​enabled | bool | `true` | |
| store_gateway.​containerSecurityContext.​readOnlyRootFilesystem | bool | `true` | |
| store_gateway.​enabled | bool | `true` | |
Expand Down
29 changes: 29 additions & 0 deletions templates/store-gateway/store-gateway-hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{{- if and .Values.store_gateway.enabled .Values.store_gateway.autoscaling.enabled -}}
{{- with .Values.store_gateway.autoscaling -}}
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "cortex.storeGatewayFullname" $ }}
namespace: {{ $.Release.Namespace }}
labels:
{{- include "cortex.storeGatewayLabels" $ | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: StatefulSet
name: {{ include "cortex.storeGatewayFullname" $ }}
minReplicas: {{ .minReplicas }}
maxReplicas: {{ .maxReplicas }}
metrics:
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .targetMemoryUtilizationPercentage }}
{{- with .behavior }}
behavior:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}
8 changes: 8 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1414,6 +1414,14 @@ store_gateway:

annotations: {}

autoscaling:
enabled: false
minReplicas: 3
maxReplicas: 30
targetMemoryUtilizationPercentage: 80
# -- Ref: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-configurable-scaling-behavior
behavior: {}

persistentVolume:
# -- If true Store-gateway will create/use a Persistent Volume Claim
# If false, use emptyDir
Expand Down