Skip to content

Commit

Permalink
add bearer token file parameter to fluentd (cluster) output
Browse files Browse the repository at this point in the history
Signed-off-by: rene <[email protected]>
  • Loading branch information
raynay-r committed Jul 2, 2024
1 parent bb019e1 commit 5e84ba0
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 0 deletions.
3 changes: 3 additions & 0 deletions apis/fluentd/v1alpha1/plugins/output/loki.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ type Loki struct {
// Password for user defined in HTTP_User
// Set HTTP basic authentication password
HTTPPasswd *plugins.Secret `json:"httpPassword,omitempty"`
// Set path to file with bearer authentication token
// Can be used as alterntative to HTTP basic authentication
BearerTokenFile *string `json:"bearerTokenFile,omitempty"`
// Tenant ID used by default to push logs to Loki.
// If omitted or empty it assumes Loki is running in single-tenant mode and no X-Scope-OrgID header is sent.
TenantID *plugins.Secret `json:"tenantID,omitempty"`
Expand Down
3 changes: 3 additions & 0 deletions apis/fluentd/v1alpha1/plugins/output/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,9 @@ func (o *Output) lokiPlugin(parent *params.PluginStore, loader plugins.SecretLoa
}
parent.InsertPairs("password", passwd)
}
if o.Loki.BearerTokenFile != nil {
parent.InsertPairs("bearer_token_file", fmt.Sprint(*o.Loki.BearerTokenFile))
}
if o.Loki.TenantID != nil {
id, err := loader.LoadSecret(*o.Loki.TenantID)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1914,6 +1914,11 @@ spec:
loki:
description: out_loki plugin
properties:
bearerTokenFile:
description: |-
Set path to file with bearer authentication token
Can be used as alterntative to HTTP basic authentication
type: string
dropSingleKey:
description: If a record only has 1 key, then just set the
log line to the value and discard the key.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1914,6 +1914,11 @@ spec:
loki:
description: out_loki plugin
properties:
bearerTokenFile:
description: |-
Set path to file with bearer authentication token
Can be used as alterntative to HTTP basic authentication
type: string
dropSingleKey:
description: If a record only has 1 key, then just set the
log line to the value and discard the key.
Expand Down
5 changes: 5 additions & 0 deletions config/crd/bases/fluentd.fluent.io_clusteroutputs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1914,6 +1914,11 @@ spec:
loki:
description: out_loki plugin
properties:
bearerTokenFile:
description: |-
Set path to file with bearer authentication token
Can be used as alterntative to HTTP basic authentication
type: string
dropSingleKey:
description: If a record only has 1 key, then just set the
log line to the value and discard the key.
Expand Down
5 changes: 5 additions & 0 deletions config/crd/bases/fluentd.fluent.io_outputs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1914,6 +1914,11 @@ spec:
loki:
description: out_loki plugin
properties:
bearerTokenFile:
description: |-
Set path to file with bearer authentication token
Can be used as alterntative to HTTP basic authentication
type: string
dropSingleKey:
description: If a record only has 1 key, then just set the
log line to the value and discard the key.
Expand Down
1 change: 1 addition & 0 deletions docs/plugins/fluentd/output/loki.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The loki output plugin, allows to ingest your records into a Loki service.
| url | Loki URL. | *string |
| httpUser | Set HTTP basic authentication user name. | *[plugins.Secret](../secret.md) |
| httpPassword | Password for user defined in HTTP_User Set HTTP basic authentication password | *[plugins.Secret](../secret.md) |
| bearerTokenFile | Set path to file with bearer authentication token Can be used as alterntative to HTTP basic authentication | *string |
| tenantID | Tenant ID used by default to push logs to Loki. If omitted or empty it assumes Loki is running in single-tenant mode and no X-Scope-OrgID header is sent. | *[plugins.Secret](../secret.md) |
| labels | Stream labels for API request. It can be multiple comma separated of strings specifying key=value pairs. In addition to fixed parameters, it also allows to add custom record keys (similar to label_keys property). | []string |
| labelKeys | Optional list of record keys that will be placed as stream labels. This configuration property is for records key only. | []string |
Expand Down
10 changes: 10 additions & 0 deletions manifests/setup/fluent-operator-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9752,6 +9752,11 @@ spec:
loki:
description: out_loki plugin
properties:
bearerTokenFile:
description: |-
Set path to file with bearer authentication token
Can be used as alterntative to HTTP basic authentication
type: string
dropSingleKey:
description: If a record only has 1 key, then just set the
log line to the value and discard the key.
Expand Down Expand Up @@ -35880,6 +35885,11 @@ spec:
loki:
description: out_loki plugin
properties:
bearerTokenFile:
description: |-
Set path to file with bearer authentication token
Can be used as alterntative to HTTP basic authentication
type: string
dropSingleKey:
description: If a record only has 1 key, then just set the
log line to the value and discard the key.
Expand Down
10 changes: 10 additions & 0 deletions manifests/setup/setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9752,6 +9752,11 @@ spec:
loki:
description: out_loki plugin
properties:
bearerTokenFile:
description: |-
Set path to file with bearer authentication token
Can be used as alterntative to HTTP basic authentication
type: string
dropSingleKey:
description: If a record only has 1 key, then just set the
log line to the value and discard the key.
Expand Down Expand Up @@ -35880,6 +35885,11 @@ spec:
loki:
description: out_loki plugin
properties:
bearerTokenFile:
description: |-
Set path to file with bearer authentication token
Can be used as alterntative to HTTP basic authentication
type: string
dropSingleKey:
description: If a record only has 1 key, then just set the
log line to the value and discard the key.
Expand Down

0 comments on commit 5e84ba0

Please sign in to comment.