github.com/verrazzano/verrazzano@v1.7.0/platform-operator/thirdparty/charts/thanos/templates/storegateway/hpa-sharded.yaml (about) 1 {{- if and .Values.storegateway.enabled .Values.storegateway.autoscaling.enabled .Values.storegateway.sharded.enabled }} 2 3 {{- $shards := int 0 }} 4 {{- if .Values.storegateway.sharded.hashPartitioning.shards }} 5 {{- $shards = int .Values.storegateway.sharded.hashPartitioning.shards }} 6 {{- else }} 7 {{- $shards = len .Values.storegateway.sharded.timePartitioning }} 8 {{- end }} 9 10 {{- range $index, $_ := until $shards }} 11 apiVersion: {{ include "common.capabilities.hpa.apiVersion" ( dict "context" $ ) }} 12 kind: HorizontalPodAutoscaler 13 metadata: 14 name: {{ printf "%s-storegateway-%s" (include "common.names.fullname" $) (toString $index) | trunc 63 | trimSuffix "-" }} 15 namespace: {{ $.Release.Namespace | quote }} 16 labels: {{- include "common.labels.standard" $ | nindent 4 }} 17 app.kubernetes.io/component: storegateway 18 shard: {{ $index | quote }} 19 {{- if $.Values.commonLabels }} 20 {{- include "common.tplvalues.render" ( dict "value" $.Values.commonLabels "context" $ ) | nindent 4 }} 21 {{- end }} 22 {{- if $.Values.commonAnnotations }} 23 annotations: {{- include "common.tplvalues.render" ( dict "value" $.Values.commonAnnotations "context" $ ) | nindent 4 }} 24 {{- end }} 25 spec: 26 scaleTargetRef: 27 apiVersion: {{ include "common.capabilities.statefulset.apiVersion" $ }} 28 kind: StatefulSet 29 name: {{ printf "%s-storegateway-%s" (include "common.names.fullname" $) (toString $index) | trunc 63 | trimSuffix "-" }} 30 minReplicas: {{ $.Values.storegateway.autoscaling.minReplicas }} 31 maxReplicas: {{ $.Values.storegateway.autoscaling.maxReplicas }} 32 metrics: 33 {{- if $.Values.storegateway.autoscaling.targetMemory }} 34 - type: Resource 35 resource: 36 name: memory 37 {{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" $) }} 38 targetAverageUtilization: {{ $.Values.storegateway.autoscaling.targetMemory }} 39 {{- else }} 40 target: 41 type: Utilization 42 averageUtilization: {{ $.Values.storegateway.autoscaling.targetMemory }} 43 {{- end }} 44 {{- end }} 45 {{- if $.Values.storegateway.autoscaling.targetCPU }} 46 - type: Resource 47 resource: 48 name: cpu 49 {{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" $) }} 50 targetAverageUtilization: {{ $.Values.storegateway.autoscaling.targetCPU }} 51 {{- else }} 52 target: 53 type: Utilization 54 averageUtilization: {{ $.Values.storegateway.autoscaling.targetCPU }} 55 {{- end }} 56 {{- end }} 57 --- 58 {{- end }} 59 {{- end }}