Skip to content

Commit

Permalink
Merge pull request #2626 from YuleZ/feature/loki-distributed-config-a…
Browse files Browse the repository at this point in the history
…s-secret

[loki-distributed] config as secret
  • Loading branch information
zanhsieh authored Sep 9, 2023
2 parents 0fdf2e1 + d7dec4b commit df4c0ee
Show file tree
Hide file tree
Showing 17 changed files with 55 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/loki-distributed/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: loki-distributed
description: Helm chart for Grafana Loki in microservices mode
type: application
appVersion: 2.9.0
version: 0.73.0
version: 0.74.0
home: https://grafana.github.io/helm-charts
sources:
- https://github.com/grafana/loki
Expand Down
3 changes: 2 additions & 1 deletion charts/loki-distributed/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# loki-distributed

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

Helm chart for Grafana Loki in microservices mode

Expand Down Expand Up @@ -301,6 +301,7 @@ kubectl delete statefulset RELEASE_NAME-loki-distributed-querier -n LOKI_NAMESPA
| loki.appProtocol | string | `""` | Adds the appProtocol field to the memberlist service. This allows memberlist to work with istio protocol selection. Ex: "http" or "tcp" |
| loki.command | string | `nil` | Common command override for all pods (except gateway) |
| loki.config | string | See values.yaml | Config file contents for Loki |
| loki.configAsSecret | bool | `false` | Store the loki configuration as a secret. |
| loki.containerSecurityContext | object | `{"allowPrivilegeEscalation":false,"capabilities":{"drop":["ALL"]},"readOnlyRootFilesystem":true}` | The SecurityContext for Loki containers |
| loki.existingSecretForConfig | string | `""` | Specify an existing secret containing loki configuration. If non-empty, overrides `loki.config` |
| loki.image.pullPolicy | string | `"IfNotPresent"` | Docker image pull policy |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ spec:
{{- if .Values.loki.existingSecretForConfig }}
secret:
secretName: {{ .Values.loki.existingSecretForConfig }}
{{- else if .Values.loki.configAsSecret }}
secret:
secretName: {{ include "loki.fullname" . }}-config
{{- else }}
configMap:
name: {{ include "loki.fullname" . }}
Expand Down
13 changes: 13 additions & 0 deletions charts/loki-distributed/templates/config-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if and (.Values.loki.configAsSecret) (not .Values.loki.existingSecretForConfig) -}}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "loki.fullname" . }}-config
namespace: {{ .Release.Namespace }}
labels:
{{- include "loki.labels" . | nindent 4 }}
foo: bar
stringData:
config.yaml: |
{{- tpl (mergeOverwrite (tpl .Values.loki.config . | fromYaml) .Values.loki.structuredConfig | toYaml) . | nindent 4 }}
{{- end -}}
2 changes: 1 addition & 1 deletion charts/loki-distributed/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if not .Values.loki.existingSecretForConfig -}}
{{- if and (not .Values.loki.existingSecretForConfig) (not .Values.loki.configAsSecret) -}}
apiVersion: v1
kind: ConfigMap
metadata:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ spec:
{{- if .Values.loki.existingSecretForConfig }}
secret:
secretName: {{ .Values.loki.existingSecretForConfig }}
{{- else if .Values.loki.configAsSecret }}
secret:
secretName: {{ include "loki.fullname" . }}-config
{{- else }}
configMap:
name: {{ include "loki.fullname" . }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ spec:
{{- if .Values.loki.existingSecretForConfig }}
secret:
secretName: {{ .Values.loki.existingSecretForConfig }}
{{- else if .Values.loki.configAsSecret }}
secret:
secretName: {{ include "loki.fullname" . }}-config
{{- else }}
configMap:
name: {{ include "loki.fullname" . }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ spec:
{{- if .Values.loki.existingSecretForConfig }}
secret:
secretName: {{ .Values.loki.existingSecretForConfig }}
{{- else if .Values.loki.configAsSecret }}
secret:
secretName: {{ include "loki.fullname" . }}-config
{{- else }}
configMap:
name: {{ include "loki.fullname" . }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ spec:
{{- if .Values.loki.existingSecretForConfig }}
secret:
secretName: {{ .Values.loki.existingSecretForConfig }}
{{- else if .Values.loki.configAsSecret }}
secret:
secretName: {{ include "loki.fullname" . }}-config
{{- else }}
configMap:
name: {{ include "loki.fullname" . }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ spec:
{{- if .Values.loki.existingSecretForConfig }}
secret:
secretName: {{ .Values.loki.existingSecretForConfig }}
{{- else if .Values.loki.configAsSecret }}
secret:
secretName: {{ include "loki.fullname" . }}-config
{{- else }}
configMap:
name: {{ include "loki.fullname" . }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ spec:
{{- if .Values.loki.existingSecretForConfig }}
secret:
secretName: {{ .Values.loki.existingSecretForConfig }}
{{- else if .Values.loki.configAsSecret }}
secret:
secretName: {{ include "loki.fullname" . }}-config
{{- else }}
configMap:
name: {{ include "loki.fullname" . }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ spec:
{{- if .Values.loki.existingSecretForConfig }}
secret:
secretName: {{ .Values.loki.existingSecretForConfig }}
{{- else if .Values.loki.configAsSecret }}
secret:
secretName: {{ include "loki.fullname" . }}-config
{{- else }}
configMap:
name: {{ include "loki.fullname" . }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ spec:
{{- if .Values.loki.existingSecretForConfig }}
secret:
secretName: {{ .Values.loki.existingSecretForConfig }}
{{- else if .Values.loki.configAsSecret }}
secret:
secretName: {{ include "loki.fullname" . }}-config
{{- else }}
configMap:
name: {{ include "loki.fullname" . }}
Expand Down
3 changes: 3 additions & 0 deletions charts/loki-distributed/templates/ruler/deployment-ruler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ spec:
{{- if .Values.loki.existingSecretForConfig }}
secret:
secretName: {{ .Values.loki.existingSecretForConfig }}
{{- else if .Values.loki.configAsSecret }}
secret:
secretName: {{ include "loki.fullname" . }}-config
{{- else }}
configMap:
name: {{ include "loki.fullname" . }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ spec:
{{- if .Values.loki.existingSecretForConfig }}
secret:
secretName: {{ .Values.loki.existingSecretForConfig }}
{{- else if .Values.loki.configAsSecret }}
secret:
secretName: {{ include "loki.fullname" . }}-config
{{- else }}
configMap:
name: {{ include "loki.fullname" . }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ spec:
{{- if .Values.loki.existingSecretForConfig }}
secret:
secretName: {{ .Values.loki.existingSecretForConfig }}
{{- else if .Values.loki.configAsSecret }}
secret:
secretName: {{ include "loki.fullname" . }}-config
{{- else }}
configMap:
name: {{ include "loki.fullname" . }}
Expand Down
2 changes: 2 additions & 0 deletions charts/loki-distributed/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ loki:
allowPrivilegeEscalation: false
# -- Specify an existing secret containing loki configuration. If non-empty, overrides `loki.config`
existingSecretForConfig: ""
# -- Store the loki configuration as a secret.
configAsSecret: false
# -- Adds the appProtocol field to the memberlist service. This allows memberlist to work with istio protocol selection. Ex: "http" or "tcp"
appProtocol: ""
# -- Common annotations for all loki services
Expand Down

0 comments on commit df4c0ee

Please sign in to comment.