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

fix: support datadog plugin api key to allow for secret injection #1070

Merged
merged 1 commit into from
Apr 23, 2024
Merged
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 apis/fluentbit/v1alpha2/plugins/filter/rewritetag_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type RewriteTag struct {
// When the filter emits a record under the new Tag, there is an internal emitter
// plugin that takes care of the job. Since this emitter expose metrics as any other
// component of the pipeline, you can use this property to configure an optional name for it.
EmitterName string `json:"emitterName,omitempty"`
EmitterName string `json:"emitterName,omitempty"`
EmitterMemBufLimit string `json:"emitterMemBufLimit,omitempty"`
EmitterStorageType string `json:"emitterStorageType,omitempty"`
}
Expand Down
10 changes: 7 additions & 3 deletions apis/fluentbit/v1alpha2/plugins/output/datadog_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type DataDog struct {
// Datadog supports and recommends setting this to gzip.
Compress string `json:"compress,omitempty"`
// Your Datadog API key.
APIKey string `json:"apikey,omitempty"`
APIKey *plugins.Secret `json:"apikey,omitempty"`
// Specify an HTTP Proxy.
Proxy string `json:"proxy,omitempty"`
// To activate the remapping, specify configuration flag provider.
Expand Down Expand Up @@ -61,8 +61,12 @@ func (s *DataDog) Params(sl plugins.SecretLoader) (*params.KVs, error) {
if s.Compress != "" {
kvs.Insert("compress", s.Compress)
}
if s.APIKey != "" {
kvs.Insert("apikey", s.APIKey)
if s.APIKey != nil {
apiKey, err := sl.LoadSecret(*s.APIKey)
if err != nil {
return nil, err
}
kvs.Insert("apikey", apiKey)
}
if s.Proxy != "" {
kvs.Insert("proxy", s.Proxy)
Expand Down
2 changes: 0 additions & 2 deletions apis/fluentbit/v1alpha2/plugins/output/datadog_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ func TestOutput_DataDog_Params(t *testing.T) {

dd := DataDog{
Host: "http-intake.logs.datadoghq.com",
APIKey: "1234apikey",
TLS: ptrBool(true),
Compress: "gzip",
Service: "service_name",
Expand All @@ -31,7 +30,6 @@ func TestOutput_DataDog_Params(t *testing.T) {
expected.Insert("Host", "http-intake.logs.datadoghq.com")
expected.Insert("TLS", "true")
expected.Insert("compress", "gzip")
expected.Insert("apikey", "1234apikey")
expected.Insert("json_date_key", "timestamp")
expected.Insert("include_tag_key", "true")
expected.Insert("tag_key", "tagkey")
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,32 @@ spec:
properties:
apikey:
description: Your Datadog API key.
type: string
properties:
valueFrom:
description: ValueSource defines how to find a value's key.
properties:
secretKeyRef:
description: Selects a key of a secret in the pod's namespace
properties:
key:
description: The key of the secret to select from. Must
be a valid secret key.
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind,
uid?'
type: string
optional:
description: Specify whether the Secret or its key
must be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
type: object
type: object
compress:
description: Compress the payload in GZIP format. Datadog supports
and recommends setting this to gzip.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,32 @@ spec:
properties:
apikey:
description: Your Datadog API key.
type: string
properties:
valueFrom:
description: ValueSource defines how to find a value's key.
properties:
secretKeyRef:
description: Selects a key of a secret in the pod's namespace
properties:
key:
description: The key of the secret to select from. Must
be a valid secret key.
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind,
uid?'
type: string
optional:
description: Specify whether the Secret or its key
must be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
type: object
type: object
compress:
description: Compress the payload in GZIP format. Datadog supports
and recommends setting this to gzip.
Expand Down
27 changes: 26 additions & 1 deletion config/crd/bases/fluentbit.fluent.io_clusteroutputs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,32 @@ spec:
properties:
apikey:
description: Your Datadog API key.
type: string
properties:
valueFrom:
description: ValueSource defines how to find a value's key.
properties:
secretKeyRef:
description: Selects a key of a secret in the pod's namespace
properties:
key:
description: The key of the secret to select from. Must
be a valid secret key.
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind,
uid?'
type: string
optional:
description: Specify whether the Secret or its key
must be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
type: object
type: object
compress:
description: Compress the payload in GZIP format. Datadog supports
and recommends setting this to gzip.
Expand Down
27 changes: 26 additions & 1 deletion config/crd/bases/fluentbit.fluent.io_outputs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,32 @@ spec:
properties:
apikey:
description: Your Datadog API key.
type: string
properties:
valueFrom:
description: ValueSource defines how to find a value's key.
properties:
secretKeyRef:
description: Selects a key of a secret in the pod's namespace
properties:
key:
description: The key of the secret to select from. Must
be a valid secret key.
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind,
uid?'
type: string
optional:
description: Specify whether the Secret or its key
must be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
type: object
type: object
compress:
description: Compress the payload in GZIP format. Datadog supports
and recommends setting this to gzip.
Expand Down
2 changes: 1 addition & 1 deletion docs/plugins/fluentbit/output/datadog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ DataDog output plugin allows you to ingest your logs into Datadog. <br /> **For
| host | Host is the Datadog server where you are sending your logs. | string |
| tls | TLS controls whether to use end-to-end security communications security protocol. Datadog recommends setting this to on. | *bool |
| compress | Compress the payload in GZIP format. Datadog supports and recommends setting this to gzip. | string |
| apikey | Your Datadog API key. | string |
| apikey | Your Datadog API key. | *[plugins.Secret](../secret.md) |
| proxy | Specify an HTTP Proxy. | string |
| provider | To activate the remapping, specify configuration flag provider. | string |
| json_date_key | Date key name for output. | string |
Expand Down
54 changes: 52 additions & 2 deletions manifests/setup/fluent-operator-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2986,7 +2986,32 @@ spec:
properties:
apikey:
description: Your Datadog API key.
type: string
properties:
valueFrom:
description: ValueSource defines how to find a value's key.
properties:
secretKeyRef:
description: Selects a key of a secret in the pod's namespace
properties:
key:
description: The key of the secret to select from. Must
be a valid secret key.
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind,
uid?'
type: string
optional:
description: Specify whether the Secret or its key
must be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
type: object
type: object
compress:
description: Compress the payload in GZIP format. Datadog supports
and recommends setting this to gzip.
Expand Down Expand Up @@ -26616,7 +26641,32 @@ spec:
properties:
apikey:
description: Your Datadog API key.
type: string
properties:
valueFrom:
description: ValueSource defines how to find a value's key.
properties:
secretKeyRef:
description: Selects a key of a secret in the pod's namespace
properties:
key:
description: The key of the secret to select from. Must
be a valid secret key.
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind,
uid?'
type: string
optional:
description: Specify whether the Secret or its key
must be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
type: object
type: object
compress:
description: Compress the payload in GZIP format. Datadog supports
and recommends setting this to gzip.
Expand Down
54 changes: 52 additions & 2 deletions manifests/setup/setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2986,7 +2986,32 @@ spec:
properties:
apikey:
description: Your Datadog API key.
type: string
properties:
valueFrom:
description: ValueSource defines how to find a value's key.
properties:
secretKeyRef:
description: Selects a key of a secret in the pod's namespace
properties:
key:
description: The key of the secret to select from. Must
be a valid secret key.
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind,
uid?'
type: string
optional:
description: Specify whether the Secret or its key
must be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
type: object
type: object
compress:
description: Compress the payload in GZIP format. Datadog supports
and recommends setting this to gzip.
Expand Down Expand Up @@ -26616,7 +26641,32 @@ spec:
properties:
apikey:
description: Your Datadog API key.
type: string
properties:
valueFrom:
description: ValueSource defines how to find a value's key.
properties:
secretKeyRef:
description: Selects a key of a secret in the pod's namespace
properties:
key:
description: The key of the secret to select from. Must
be a valid secret key.
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind,
uid?'
type: string
optional:
description: Specify whether the Secret or its key
must be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
type: object
type: object
compress:
description: Compress the payload in GZIP format. Datadog supports
and recommends setting this to gzip.
Expand Down
Loading