Skip to content

Commit

Permalink
Merge pull request #1956 from MioOgbeni/main
Browse files Browse the repository at this point in the history
[loki-distributed] Add HPA support for k8s >=1.25-0
  • Loading branch information
zanhsieh committed Dec 2, 2022
2 parents 991a7fa + 78a98ca commit 340ceac
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion charts/loki-distributed/Chart.yaml
Expand Up @@ -3,7 +3,7 @@ name: loki-distributed
description: Helm chart for Grafana Loki in microservices mode
type: application
appVersion: 2.6.1
version: 0.66.4
version: 0.66.6
home: https://grafana.github.io/helm-charts
sources:
- https://github.com/grafana/loki
Expand Down
2 changes: 1 addition & 1 deletion charts/loki-distributed/README.md
@@ -1,6 +1,6 @@
# loki-distributed

![Version: 0.66.4](https://img.shields.io/badge/Version-0.66.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.6.1](https://img.shields.io/badge/AppVersion-2.6.1-informational?style=flat-square)
![Version: 0.66.6](https://img.shields.io/badge/Version-0.66.6-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.6.1](https://img.shields.io/badge/AppVersion-2.6.1-informational?style=flat-square)

Helm chart for Grafana Loki in microservices mode

Expand Down
11 changes: 11 additions & 0 deletions charts/loki-distributed/templates/_helpers.tpl
Expand Up @@ -141,6 +141,17 @@ Return the appropriate apiVersion for PodDisruptionBudget.
{{- end -}}
{{- end -}}

{{/*
Return the appropriate apiVersion for HorizontalPodAutoscaler.
*/}}
{{- define "loki.hpa.apiVersion" -}}
{{- if and (.Capabilities.APIVersions.Has "autoscaling/v2") (semverCompare ">=1.25-0" .Capabilities.KubeVersion.Version) -}}
{{- print "autoscaling/v2" -}}
{{- else -}}
{{- print "autoscaling/v2beta1" -}}
{{- end -}}
{{- end -}}

{{- define "loki.ingester.readinessProbe" -}}
{{- with .Values.ingester.readinessProbe }}
readinessProbe:
Expand Down
2 changes: 1 addition & 1 deletion charts/loki-distributed/templates/distributor/hpa.yaml
@@ -1,5 +1,5 @@
{{- if .Values.distributor.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
apiVersion: {{ include "loki.hpa.apiVersion" . }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "loki.distributorFullname" . }}
Expand Down
2 changes: 1 addition & 1 deletion charts/loki-distributed/templates/gateway/hpa.yaml
@@ -1,5 +1,5 @@
{{- if .Values.gateway.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
apiVersion: {{ include "loki.hpa.apiVersion" . }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "loki.gatewayFullname" . }}
Expand Down
2 changes: 1 addition & 1 deletion charts/loki-distributed/templates/ingester/hpa.yaml
@@ -1,5 +1,5 @@
{{- if .Values.ingester.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
apiVersion: {{ include "loki.hpa.apiVersion" . }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "loki.ingesterFullname" . }}
Expand Down
2 changes: 1 addition & 1 deletion charts/loki-distributed/templates/querier/hpa.yaml
@@ -1,5 +1,5 @@
{{- if and .Values.indexGateway.enabled .Values.querier.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
apiVersion: {{ include "loki.hpa.apiVersion" . }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "loki.querierFullname" . }}
Expand Down
2 changes: 1 addition & 1 deletion charts/loki-distributed/templates/query-frontend/hpa.yaml
@@ -1,5 +1,5 @@
{{- if .Values.queryFrontend.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
apiVersion: {{ include "loki.hpa.apiVersion" . }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "loki.queryFrontendFullname" . }}
Expand Down

0 comments on commit 340ceac

Please sign in to comment.