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

feat: update loki version #1629

Closed
wants to merge 4 commits into from
Closed
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
2 changes: 1 addition & 1 deletion .charts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ charts:
review.opendev.org:
- 893406
- name: loki
version: 6.6.3
version: 6.7.1
repository:
url: https://grafana.github.io/helm-charts
- name: magnum
Expand Down
4 changes: 2 additions & 2 deletions charts/loki/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
appVersion: 3.0.0
appVersion: 3.1.0
dependencies:
- alias: minio
condition: minio.enabled
Expand Down Expand Up @@ -29,4 +29,4 @@ sources:
- https://grafana.com/oss/loki/
- https://grafana.com/docs/loki/latest/
type: application
version: 6.6.3
version: 6.7.1
2 changes: 1 addition & 1 deletion charts/loki/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# loki

![Version: 6.6.3](https://img.shields.io/badge/Version-6.6.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.0.0](https://img.shields.io/badge/AppVersion-3.0.0-informational?style=flat-square)
![Version: 6.7.1](https://img.shields.io/badge/Version-6.7.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.1.0](https://img.shields.io/badge/AppVersion-3.1.0-informational?style=flat-square)

Helm chart for Grafana Loki and Grafana Enterprise Logs supporting both simple, scalable and distributed modes.

Expand Down
2 changes: 1 addition & 1 deletion charts/loki/docs/examples/enterprise/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Deploy the secrets file to your k8s cluster with the command:
`kubectl apply -f enterprise-secrets.yaml`

### Configure the Helm Chart
Open [overrides-enterprise-gcs.yaml](./overrides-enterprise-gcs.yaml) and replace `{YOUR_GCS_BUCKET}` with the name of your GCS bucket. If there are other things you'd like to configure, view the core [Values.yaml file](https://github.com/grafana/helm-charts/blob/main/charts/loki-simple-scalable/values.yaml) and override anything else you need to within the overrides-enterprise-gcs.yaml file.
Open [overrides-enterprise-gcs.yaml](./overrides-enterprise-gcs.yaml) and replace `{YOUR_GCS_BUCKET}` with the name of your GCS bucket. If there are other things you'd like to configure, view the core [Values.yaml file](https://github.com/grafana/loki/blob/main/production/helm/loki/values.yaml) and override anything else you need to within the overrides-enterprise-gcs.yaml file.

### Install the Helm chart

Expand Down
2 changes: 1 addition & 1 deletion charts/loki/docs/examples/oss/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Deploy the secrets file to your k8s cluster.
`kubectl apply -f loki-secrets.yaml`

### Configure the Helm Chart
Open examples/enterprise/overides-oss-gcs.yaml and replace `{YOUR_GCS_BUCKET}` with the name of your GCS bucket. If there are other things you'd like to configure, view the core [Values.yaml file](https://github.com/grafana/helm-charts/blob/main/charts/loki-simple-scalable/values.yaml) and override anything else you need to within the overrides-enterprise-gcs.yaml file.
Open examples/enterprise/overides-oss-gcs.yaml and replace `{YOUR_GCS_BUCKET}` with the name of your GCS bucket. If there are other things you'd like to configure, view the core [Values.yaml file](https://github.com/grafana/loki/blob/main/production/helm/loki/values.yaml) and override anything else you need to within the overrides-enterprise-gcs.yaml file.

### Install the Helm chart

Expand Down
11 changes: 10 additions & 1 deletion charts/loki/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,14 @@ azure:
endpoint_suffix: {{ . }}
{{- end }}
{{- end -}}
{{- else if eq .Values.loki.storage.type "alibabacloud" -}}
{{- with .Values.loki.storage.alibabacloud }}
alibabacloud:
bucket: {{ $.Values.loki.storage.bucketNames.chunks }}
endpoint: {{ .endpoint }}
access_key_id: {{ .accessKeyId }}
secret_access_key: {{ .secretAccessKey }}
{{- end -}}
{{- else if eq .Values.loki.storage.type "swift" -}}
{{- with .Values.loki.storage.swift }}
swift:
Expand Down Expand Up @@ -1056,7 +1064,8 @@ enableServiceLinks: false
{{/* Determine querier address */}}
{{- define "loki.querierAddress" -}}
{{- $querierAddress := "" }}
{{- if "loki.deployment.isDistributed "}}
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}}
{{- if $isDistributed -}}
{{- $querierHost := include "loki.querierFullname" .}}
{{- $querierUrl := printf "http://%s.%s.svc.%s:3100" $querierHost .Release.Namespace .Values.global.clusterDomain }}
{{- $querierAddress = $querierUrl }}
Expand Down
3 changes: 1 addition & 2 deletions charts/loki/templates/backend/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{{- $isSimpleScalable := eq (include "loki.deployment.isScalable" .) "true" -}}
{{- if and $isSimpleScalable (not .Values.rbac.namespaced) (not .Values.rbac.useExistingRole) }}
{{- if and (not .Values.rbac.namespaced) (not .Values.rbac.useExistingRole) }}
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
Expand Down
2 changes: 1 addition & 1 deletion charts/loki/templates/backend/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- $isSimpleScalable := eq (include "loki.deployment.isScalable" .) "true" -}}
{{- if and $isSimpleScalable (not .Values.rbac.namespaced) }}
{{- if (not .Values.rbac.namespaced) }}
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
Expand Down
2 changes: 1 addition & 1 deletion charts/loki/templates/extra-manifests.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- range .Values.extraObjects -}}
{{- range .Values.extraObjects }}
---
{{- if kindIs "map" . }}
{{ tpl (toYaml .) $ }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ spec:
imagePullPolicy: {{ .Values.gateway.image.pullPolicy }}
ports:
- name: http-metrics
containerPort: 8080
containerPort: {{ .Values.gateway.containerPort }}
protocol: TCP
{{- with .Values.gateway.extraEnv }}
env:
Expand Down
2 changes: 1 addition & 1 deletion charts/loki/templates/ingester/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ metadata:
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Statefulset
kind: StatefulSet
name: {{ include "loki.ingesterFullname" . }}
minReplicas: {{ .Values.ingester.autoscaling.minReplicas }}
maxReplicas: {{ .Values.ingester.autoscaling.maxReplicas }}
Expand Down
2 changes: 1 addition & 1 deletion charts/loki/templates/ingester/statefulset-ingester.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ spec:
{{- end }}
args:
- -config.file=/etc/loki/config/config.yaml
- -ingester.ring.instance-availability-zone=zone-default
- -ingester.availability-zone=zone-default
- -target=ingester
{{- with .Values.ingester.extraArgs }}
{{- toYaml . | nindent 12 }}
Expand Down
82 changes: 82 additions & 0 deletions charts/loki/templates/single-binary/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,75 @@ spec:
{{- end }}
{{- end }}
containers:
{{- if .Values.sidecar.rules.enabled }}
- name: loki-sc-rules
{{- if .Values.sidecar.image.sha }}
image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}@sha256:{{ .Values.sidecar.image.sha }}"
{{- else }}
image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}"
{{- end }}
imagePullPolicy: {{ .Values.sidecar.image.pullPolicy }}
env:
- name: METHOD
value: {{ .Values.sidecar.rules.watchMethod }}
- name: LABEL
value: "{{ .Values.sidecar.rules.label }}"
{{- if .Values.sidecar.rules.labelValue }}
- name: LABEL_VALUE
value: {{ quote .Values.sidecar.rules.labelValue }}
{{- end }}
- name: FOLDER
value: "{{ .Values.sidecar.rules.folder }}"
- name: RESOURCE
value: {{ quote .Values.sidecar.rules.resource }}
{{- if .Values.sidecar.enableUniqueFilenames }}
- name: UNIQUE_FILENAMES
value: "{{ .Values.sidecar.enableUniqueFilenames }}"
{{- end }}
{{- if .Values.sidecar.rules.searchNamespace }}
- name: NAMESPACE
value: "{{ .Values.sidecar.rules.searchNamespace | join "," }}"
{{- end }}
{{- if .Values.sidecar.skipTlsVerify }}
- name: SKIP_TLS_VERIFY
value: "{{ .Values.sidecar.skipTlsVerify }}"
{{- end }}
{{- if .Values.sidecar.rules.script }}
- name: SCRIPT
value: "{{ .Values.sidecar.rules.script }}"
{{- end }}
{{- if .Values.sidecar.rules.watchServerTimeout }}
- name: WATCH_SERVER_TIMEOUT
value: "{{ .Values.sidecar.rules.watchServerTimeout }}"
{{- end }}
{{- if .Values.sidecar.rules.watchClientTimeout }}
- name: WATCH_CLIENT_TIMEOUT
value: "{{ .Values.sidecar.rules.watchClientTimeout }}"
{{- end }}
{{- if .Values.sidecar.rules.logLevel }}
- name: LOG_LEVEL
value: "{{ .Values.sidecar.rules.logLevel }}"
{{- end }}
{{- if .Values.sidecar.livenessProbe }}
livenessProbe:
{{- toYaml .Values.sidecar.livenessProbe | nindent 12 }}
{{- end }}
{{- if .Values.sidecar.readinessProbe }}
readinessProbe:
{{- toYaml .Values.sidecar.readinessProbe | nindent 12 }}
{{- end }}
{{- if .Values.sidecar.resources }}
resources:
{{- toYaml .Values.sidecar.resources | nindent 12 }}
{{- end }}
{{- if .Values.sidecar.securityContext }}
securityContext:
{{- toYaml .Values.sidecar.securityContext | nindent 12 }}
{{- end }}
volumeMounts:
- name: sc-rules-volume
mountPath: {{ .Values.sidecar.rules.folder | quote }}
{{- end}}
- name: loki
image: {{ include "loki.image" . }}
imagePullPolicy: {{ .Values.loki.image.pullPolicy }}
Expand Down Expand Up @@ -125,6 +194,10 @@ spec:
- name: license
mountPath: /etc/loki/license
{{- end }}
{{- if .Values.sidecar.rules.enabled }}
- name: sc-rules-volume
mountPath: {{ .Values.sidecar.rules.folder | quote }}
{{- end}}
{{- with .Values.singleBinary.extraVolumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
Expand Down Expand Up @@ -166,6 +239,15 @@ spec:
secretName: enterprise-logs-license
{{- end }}
{{- end }}
{{- if .Values.sidecar.rules.enabled }}
- name: sc-rules-volume
{{- if .Values.sidecar.rules.sizeLimit }}
emptyDir:
sizeLimit: {{ .Values.sidecar.rules.sizeLimit }}
{{- else }}
emptyDir: {}
{{- end -}}
{{- end -}}
{{- with .Values.singleBinary.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
6 changes: 5 additions & 1 deletion charts/loki/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ enterprise:
# Enable enterprise features, license must be provided
enabled: false
# Default verion of GEL to deploy
version: 3.0.1
version: 3.1.0
# -- Optional name of the GEL cluster, otherwise will use .Release.Name
# The cluster name must match what is in your GEL license
cluster_name: null
Expand Down Expand Up @@ -858,6 +858,8 @@ gateway:
enabled: true
# -- Number of replicas for the gateway
replicas: 1
# -- Default container port
containerPort: 8080
# -- Enable logging of 2xx and 3xx HTTP requests
verboseLogging: true
autoscaling:
Expand Down Expand Up @@ -1009,8 +1011,10 @@ gateway:
# @default -- Either `loki.tenants` or `gateway.basicAuth.username` and `gateway.basicAuth.password`.
htpasswd: >-
{{ if .Values.loki.tenants }}

{{- range $t := .Values.loki.tenants }}
{{ htpasswd (required "All tenants must have a 'name' set" $t.name) (required "All tenants must have a 'password' set" $t.password) }}

{{- end }}
{{ else }} {{ htpasswd (required "'gateway.basicAuth.username' is required" .Values.gateway.basicAuth.username) (required "'gateway.basicAuth.password' is required" .Values.gateway.basicAuth.password) }} {{ end }}
# -- Existing basic auth secret to use. Must contain '.htpasswd'
Expand Down
129 changes: 129 additions & 0 deletions charts/patches/loki/0001-support-ruler-sidecar-in-singleBinary.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
diff --git a/loki/templates/single-binary/statefulset.yaml b/loki/templates/single-binary/statefulset.yaml
index 7bd2b9813..5e28902e5 100644
--- a/loki/templates/single-binary/statefulset.yaml
+++ b/loki/templates/single-binary/statefulset.yaml
@@ -79,6 +79,75 @@ spec:
{{- end }}
{{- end }}
containers:
+ {{- if .Values.sidecar.rules.enabled }}
+ - name: loki-sc-rules
+ {{- if .Values.sidecar.image.sha }}
+ image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}@sha256:{{ .Values.sidecar.image.sha }}"
+ {{- else }}
+ image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}"
+ {{- end }}
+ imagePullPolicy: {{ .Values.sidecar.image.pullPolicy }}
+ env:
+ - name: METHOD
+ value: {{ .Values.sidecar.rules.watchMethod }}
+ - name: LABEL
+ value: "{{ .Values.sidecar.rules.label }}"
+ {{- if .Values.sidecar.rules.labelValue }}
+ - name: LABEL_VALUE
+ value: {{ quote .Values.sidecar.rules.labelValue }}
+ {{- end }}
+ - name: FOLDER
+ value: "{{ .Values.sidecar.rules.folder }}"
+ - name: RESOURCE
+ value: {{ quote .Values.sidecar.rules.resource }}
+ {{- if .Values.sidecar.enableUniqueFilenames }}
+ - name: UNIQUE_FILENAMES
+ value: "{{ .Values.sidecar.enableUniqueFilenames }}"
+ {{- end }}
+ {{- if .Values.sidecar.rules.searchNamespace }}
+ - name: NAMESPACE
+ value: "{{ .Values.sidecar.rules.searchNamespace | join "," }}"
+ {{- end }}
+ {{- if .Values.sidecar.skipTlsVerify }}
+ - name: SKIP_TLS_VERIFY
+ value: "{{ .Values.sidecar.skipTlsVerify }}"
+ {{- end }}
+ {{- if .Values.sidecar.rules.script }}
+ - name: SCRIPT
+ value: "{{ .Values.sidecar.rules.script }}"
+ {{- end }}
+ {{- if .Values.sidecar.rules.watchServerTimeout }}
+ - name: WATCH_SERVER_TIMEOUT
+ value: "{{ .Values.sidecar.rules.watchServerTimeout }}"
+ {{- end }}
+ {{- if .Values.sidecar.rules.watchClientTimeout }}
+ - name: WATCH_CLIENT_TIMEOUT
+ value: "{{ .Values.sidecar.rules.watchClientTimeout }}"
+ {{- end }}
+ {{- if .Values.sidecar.rules.logLevel }}
+ - name: LOG_LEVEL
+ value: "{{ .Values.sidecar.rules.logLevel }}"
+ {{- end }}
+ {{- if .Values.sidecar.livenessProbe }}
+ livenessProbe:
+ {{- toYaml .Values.sidecar.livenessProbe | nindent 12 }}
+ {{- end }}
+ {{- if .Values.sidecar.readinessProbe }}
+ readinessProbe:
+ {{- toYaml .Values.sidecar.readinessProbe | nindent 12 }}
+ {{- end }}
+ {{- if .Values.sidecar.resources }}
+ resources:
+ {{- toYaml .Values.sidecar.resources | nindent 12 }}
+ {{- end }}
+ {{- if .Values.sidecar.securityContext }}
+ securityContext:
+ {{- toYaml .Values.sidecar.securityContext | nindent 12 }}
+ {{- end }}
+ volumeMounts:
+ - name: sc-rules-volume
+ mountPath: {{ .Values.sidecar.rules.folder | quote }}
+ {{- end}}
- name: loki
image: {{ include "loki.image" . }}
imagePullPolicy: {{ .Values.loki.image.pullPolicy }}
@@ -125,6 +194,10 @@ spec:
- name: license
mountPath: /etc/loki/license
{{- end }}
+ {{- if .Values.sidecar.rules.enabled }}
+ - name: sc-rules-volume
+ mountPath: {{ .Values.sidecar.rules.folder | quote }}
+ {{- end}}
{{- with .Values.singleBinary.extraVolumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
@@ -166,6 +239,15 @@ spec:
secretName: enterprise-logs-license
{{- end }}
{{- end }}
+ {{- if .Values.sidecar.rules.enabled }}
+ - name: sc-rules-volume
+ {{- if .Values.sidecar.rules.sizeLimit }}
+ emptyDir:
+ sizeLimit: {{ .Values.sidecar.rules.sizeLimit }}
+ {{- else }}
+ emptyDir: {}
+ {{- end -}}
+ {{- end -}}
{{- with .Values.singleBinary.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
diff --git a/loki/templates/backend/clusterrole.yaml b/loki/templates/backend/clusterrole.yaml
index e8631c35a..36c8a0fe0 100644
--- a/loki/templates/backend/clusterrole.yaml
+++ b/loki/templates/backend/clusterrole.yaml
@@ -1,5 +1,4 @@
-{{- $isSimpleScalable := eq (include "loki.deployment.isScalable" .) "true" -}}
-{{- if and $isSimpleScalable (not .Values.rbac.namespaced) (not .Values.rbac.useExistingRole) }}
+{{- if and (not .Values.rbac.namespaced) (not .Values.rbac.useExistingRole) }}
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
diff --git a/loki/templates/backend/clusterrolebinding.yaml b/loki/templates/backend/clusterrolebinding.yaml
index 619b70260..92f86a47d 100644
--- a/loki/templates/backend/clusterrolebinding.yaml
+++ b/loki/templates/backend/clusterrolebinding.yaml
@@ -1,5 +1,5 @@
{{- $isSimpleScalable := eq (include "loki.deployment.isScalable" .) "true" -}}
-{{- if and $isSimpleScalable (not .Values.rbac.namespaced) }}
+{{- if (not .Values.rbac.namespaced) }}
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata: