diff --git a/apis/fluentbit/v1alpha2/plugins/filter/rewritetag_types.go b/apis/fluentbit/v1alpha2/plugins/filter/rewritetag_types.go index fd724316d..0ddf950de 100644 --- a/apis/fluentbit/v1alpha2/plugins/filter/rewritetag_types.go +++ b/apis/fluentbit/v1alpha2/plugins/filter/rewritetag_types.go @@ -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"` } diff --git a/apis/fluentbit/v1alpha2/plugins/output/datadog_types.go b/apis/fluentbit/v1alpha2/plugins/output/datadog_types.go index 84f7094f9..b417dbcd6 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/datadog_types.go +++ b/apis/fluentbit/v1alpha2/plugins/output/datadog_types.go @@ -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. @@ -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) diff --git a/apis/fluentbit/v1alpha2/plugins/output/datadog_types_test.go b/apis/fluentbit/v1alpha2/plugins/output/datadog_types_test.go index 648e4eaab..b68a70482 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/datadog_types_test.go +++ b/apis/fluentbit/v1alpha2/plugins/output/datadog_types_test.go @@ -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", @@ -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") diff --git a/apis/fluentbit/v1alpha2/plugins/output/zz_generated.deepcopy.go b/apis/fluentbit/v1alpha2/plugins/output/zz_generated.deepcopy.go index 9911151c5..38e03392b 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/zz_generated.deepcopy.go +++ b/apis/fluentbit/v1alpha2/plugins/output/zz_generated.deepcopy.go @@ -118,6 +118,11 @@ func (in *DataDog) DeepCopyInto(out *DataDog) { *out = new(bool) **out = **in } + if in.APIKey != nil { + in, out := &in.APIKey, &out.APIKey + *out = new(plugins.Secret) + (*in).DeepCopyInto(*out) + } if in.IncludeTagKey != nil { in, out := &in.IncludeTagKey, &out.IncludeTagKey *out = new(bool) diff --git a/charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_clusteroutputs.yaml b/charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_clusteroutputs.yaml index d32f7cc50..df2bd306f 100644 --- a/charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_clusteroutputs.yaml +++ b/charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_clusteroutputs.yaml @@ -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. diff --git a/charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_outputs.yaml b/charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_outputs.yaml index 3949e9bce..3fb357c56 100644 --- a/charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_outputs.yaml +++ b/charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_outputs.yaml @@ -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. diff --git a/config/crd/bases/fluentbit.fluent.io_clusteroutputs.yaml b/config/crd/bases/fluentbit.fluent.io_clusteroutputs.yaml index d32f7cc50..df2bd306f 100644 --- a/config/crd/bases/fluentbit.fluent.io_clusteroutputs.yaml +++ b/config/crd/bases/fluentbit.fluent.io_clusteroutputs.yaml @@ -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. diff --git a/config/crd/bases/fluentbit.fluent.io_outputs.yaml b/config/crd/bases/fluentbit.fluent.io_outputs.yaml index 3949e9bce..3fb357c56 100644 --- a/config/crd/bases/fluentbit.fluent.io_outputs.yaml +++ b/config/crd/bases/fluentbit.fluent.io_outputs.yaml @@ -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. diff --git a/docs/plugins/fluentbit/output/datadog.md b/docs/plugins/fluentbit/output/datadog.md index 7fea0a1c7..89db88bb3 100644 --- a/docs/plugins/fluentbit/output/datadog.md +++ b/docs/plugins/fluentbit/output/datadog.md @@ -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 | diff --git a/manifests/setup/fluent-operator-crd.yaml b/manifests/setup/fluent-operator-crd.yaml index 51cc79adb..c9cc0c583 100644 --- a/manifests/setup/fluent-operator-crd.yaml +++ b/manifests/setup/fluent-operator-crd.yaml @@ -3889,7 +3889,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. @@ -28422,7 +28447,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. diff --git a/manifests/setup/setup.yaml b/manifests/setup/setup.yaml index 65113ee3e..636544995 100644 --- a/manifests/setup/setup.yaml +++ b/manifests/setup/setup.yaml @@ -3889,7 +3889,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. @@ -28422,7 +28447,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.