Skip to content

Commit f11d4c1

Browse files
committed
add bearer token support in the helm chart for fluentbit loki output
Signed-off-by: rene <[email protected]>
1 parent 5e84ba0 commit f11d4c1

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

charts/fluent-operator/templates/fluentbit-output-loki.yaml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55

66
{{ with .Values.fluentbit.output.loki -}}
77
{{/*
8-
When http{User,Password} or tenantID is a string, make a secret for them
8+
When http{User,Password}, bearerToken, or tenantID is a string, make a secret for them
99
When these keys are objects, they specify a secret to use generated elsewhere, assumed to exist in the k8s cluster
1010
*/}}
1111
{{ $userSecret := "loki-http-auth" -}}
1212
{{ $passSecret := "loki-http-pass" -}}
13+
{{ $bearerTokenSecret := "loki-bearer-token" -}}
1314
{{ $tenantIDSecret := "loki-tenant-id" -}}
1415

15-
{{ range $k, $v := dict $userSecret .httpUser $passSecret .httpPassword $tenantIDSecret .tenantID -}}
16+
{{ range $k, $v := dict $userSecret .httpUser $passSecret .httpPassword $tenantIDSecret .tenantID $bearerTokenSecret .bearerToken -}}
1617
{{ if kindIs "string" $v -}}
1718
---
1819
apiVersion: v1
@@ -81,6 +82,19 @@ spec:
8182
{{- end }}
8283
{{- end }}
8384

85+
{{- if .bearerToken }}
86+
bearerToken:
87+
{{- if kindIs "string" .bearerToken }}
88+
valueFrom:
89+
secretKeyRef:
90+
key: 'value'
91+
name: {{ $bearerTokenSecret }}
92+
optional: false
93+
{{- else }}
94+
{{ .bearerToken | toYaml | indent 6 }}
95+
{{- end }}
96+
{{- end }}
97+
8498
{{- if .tenantID }}
8599
tenantID:
86100
{{- if kindIs "string" .tenantID }}

charts/fluent-operator/values.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ fluentbit:
278278
# See https://docs.fluentbit.io/manual/pipeline/outputs/loki
279279
loki:
280280
# Switch for generation of fluentbit loki ClusterOutput (and loki basic auth http user and pass secrets if required)
281-
enable: false # Bool
281+
enable: false # Bool
282282
host: 127.0.0.1 # String
283283
port: 3100 # Int
284284
# Either, give http{User,Password},tenantID string values specifying them directly
@@ -305,6 +305,15 @@ fluentbit:
305305
# name: tenantsecret
306306
# optional: true
307307
#
308+
# To use bearer token auth instead of http basic auth
309+
#bearerToken: ey....
310+
# or with existing secret
311+
#bearerToken:
312+
# valueFrom:
313+
# secretKeyRef:
314+
# key: value
315+
# name: bearerTokenSecret
316+
# optional: true
308317
#labels: [] # String list of <name>=<value>
309318
#labelKeys: [] # String list of <key>
310319
#removeKeys: [] # String list of <key>

0 commit comments

Comments
 (0)