From 1df6b27476ef165627d28216218ce8b1677461bd Mon Sep 17 00:00:00 2001 From: Marco Franssen Date: Fri, 3 Oct 2025 10:55:48 +0200 Subject: [PATCH 1/2] Refactor cyclomatic complexity for fluentbit plugins Signed-off-by: Marco Franssen --- .../clusterfluentbitconfig_types_test.go | 1 + .../v1alpha2/clusteroutput_types_test.go | 16 +- .../v1alpha2/plugins/common_types.go | 1 - .../plugins/filter/kubernetes_types.go | 147 +++------- .../v1alpha2/plugins/input/collectd.go | 17 +- .../v1alpha2/plugins/input/dummy_types.go | 21 +- .../v1alpha2/plugins/input/exec_wasi_types.go | 37 +-- .../plugins/input/fluentbit_metrics_types.go | 17 +- .../v1alpha2/plugins/input/forward.go | 40 +-- apis/fluentbit/v1alpha2/plugins/input/http.go | 34 +-- .../plugins/input/kubernetes_events_types.go | 69 ++--- apis/fluentbit/v1alpha2/plugins/input/mqtt.go | 13 +- .../fluentbit/v1alpha2/plugins/input/nginx.go | 21 +- .../input/node_exporter_metrics_types.go | 19 +- .../plugins/input/open_telemetry_types.go | 41 +-- .../input/prometheus_scrape_metrics_types.go | 22 +- .../v1alpha2/plugins/input/statsd.go | 13 +- .../v1alpha2/plugins/input/syslog.go | 44 +-- .../v1alpha2/plugins/input/systemd_types.go | 43 +-- .../v1alpha2/plugins/input/tail_types.go | 120 +++----- apis/fluentbit/v1alpha2/plugins/input/tcp.go | 29 +- apis/fluentbit/v1alpha2/plugins/input/udp.go | 36 +-- .../plugins/output/azure_blob_types.go | 40 +-- .../output/azure_log_analytics_types.go | 19 +- .../plugins/output/cloud_watch_types.go | 73 ++--- .../v1alpha2/plugins/output/data_dog_types.go | 59 +--- .../plugins/output/elasticsearch_types.go | 163 +++-------- .../v1alpha2/plugins/output/file_types.go | 26 +- .../v1alpha2/plugins/output/firehose_types.go | 6 +- .../v1alpha2/plugins/output/forward_types.go | 58 ++-- .../v1alpha2/plugins/output/gelf_types.go | 45 +-- .../v1alpha2/plugins/output/http_types.go | 84 ++---- .../v1alpha2/plugins/output/influxdb_types.go | 71 ++--- .../v1alpha2/plugins/output/loki_types.go | 93 +++---- .../plugins/output/open_search_types.go | 148 +++------- .../plugins/output/open_telemetry_types.go | 63 ++--- .../plugins/output/prometheus_exporter.go | 10 +- .../output/prometheus_remote_write_types.go | 47 ++-- .../v1alpha2/plugins/output/s3_types.go | 117 ++------ .../v1alpha2/plugins/output/splunk_types.go | 101 +++---- .../plugins/output/stackdriver_types.go | 94 ++----- .../v1alpha2/plugins/output/stdout_types.go | 14 +- .../v1alpha2/plugins/output/syslog_types.go | 61 ++-- .../v1alpha2/plugins/output/tcp_types.go | 26 +- apis/fluentbit/v1alpha2/plugins/utils.go | 36 +++ .../fluentbit.fluent.io_clusterfilters.yaml | 130 ++++++--- .../crds/fluentbit.fluent.io_filters.yaml | 130 ++++++--- .../fluentbit.fluent.io_clusterfilters.yaml | 130 ++++++--- .../bases/fluentbit.fluent.io_filters.yaml | 130 ++++++--- docs/plugins/fluentbit/common.md | 2 +- docs/plugins/fluentbit/utils.md | 0 manifests/setup/fluent-operator-crd.yaml | 260 ++++++++++++------ manifests/setup/setup.yaml | 260 ++++++++++++------ 53 files changed, 1430 insertions(+), 1867 deletions(-) create mode 100644 apis/fluentbit/v1alpha2/plugins/utils.go create mode 100644 docs/plugins/fluentbit/utils.md diff --git a/apis/fluentbit/v1alpha2/clusterfluentbitconfig_types_test.go b/apis/fluentbit/v1alpha2/clusterfluentbitconfig_types_test.go index ac5abbad1..788089a87 100644 --- a/apis/fluentbit/v1alpha2/clusterfluentbitconfig_types_test.go +++ b/apis/fluentbit/v1alpha2/clusterfluentbitconfig_types_test.go @@ -629,6 +629,7 @@ func Test_FluentBitConfig_RenderMainConfig(t *testing.T) { i++ } } + func Test_FluentBitConfig_RenderMainConfigYaml(t *testing.T) { g := NewGomegaWithT(t) diff --git a/apis/fluentbit/v1alpha2/clusteroutput_types_test.go b/apis/fluentbit/v1alpha2/clusteroutput_types_test.go index da7e6f0cd..29e4a24be 100644 --- a/apis/fluentbit/v1alpha2/clusteroutput_types_test.go +++ b/apis/fluentbit/v1alpha2/clusteroutput_types_test.go @@ -164,10 +164,10 @@ func TestClusterOutputList_Load(t *testing.T) { } headers := map[string]string{ - "Authorization": "foo:bar", - "X-Log-Header-App-Name": "app_name", - "X-Log-Header-0": "testing", - "X-Log-Header-App-ID": "9780495d9db3", + "Authorization": authorization, + "X-Log-Header-App-Name": xLogHeaderAppName, + "X-Log-Header-0": xLogHeader0, + "X-Log-Header-App-ID": xLogHeaderAppID, } httpOutput := ClusterOutput{ @@ -304,10 +304,10 @@ func TestClusterOutputList_Load_As_Yaml(t *testing.T) { } headers := map[string]string{ - "Authorization": "foo:bar", - "X-Log-Header-App-Name": "app_name", - "X-Log-Header-0": "testing", - "X-Log-Header-App-ID": "9780495d9db3", + "Authorization": authorization, + "X-Log-Header-App-Name": xLogHeaderAppName, + "X-Log-Header-0": xLogHeader0, + "X-Log-Header-App-ID": xLogHeaderAppID, } httpOutput := ClusterOutput{ diff --git a/apis/fluentbit/v1alpha2/plugins/common_types.go b/apis/fluentbit/v1alpha2/plugins/common_types.go index f3f66509e..6c26da876 100644 --- a/apis/fluentbit/v1alpha2/plugins/common_types.go +++ b/apis/fluentbit/v1alpha2/plugins/common_types.go @@ -13,7 +13,6 @@ type CommonParams struct { // Alias for the plugin Alias string `json:"alias,omitempty"` // RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - // nolint:misspell // +kubebuilder:validation:Pattern="^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$" RetryLimit string `json:"retryLimit,omitempty"` } diff --git a/apis/fluentbit/v1alpha2/plugins/filter/kubernetes_types.go b/apis/fluentbit/v1alpha2/plugins/filter/kubernetes_types.go index 9ba993b2b..2a873ac72 100644 --- a/apis/fluentbit/v1alpha2/plugins/filter/kubernetes_types.go +++ b/apis/fluentbit/v1alpha2/plugins/filter/kubernetes_types.go @@ -119,114 +119,45 @@ func (k *Kubernetes) Params(_ plugins.SecretLoader) (*params.KVs, error) { if err != nil { return kvs, err } - if k.BufferSize != "" { - kvs.Insert("Buffer_Size", k.BufferSize) - } - if k.KubeURL != "" { - kvs.Insert("Kube_URL", k.KubeURL) - } - if k.KubeCAFile != "" { - kvs.Insert("Kube_CA_File", k.KubeCAFile) - } - if k.KubeCAPath != "" { - kvs.Insert("Kube_CA_Path", k.KubeCAPath) - } - if k.KubeTokenFile != "" { - kvs.Insert("Kube_Token_File", k.KubeTokenFile) - } - if k.KubeTagPrefix != "" { - kvs.Insert("Kube_Tag_Prefix", k.KubeTagPrefix) - } - if k.MergeLog != nil { - kvs.Insert("Merge_Log", fmt.Sprint(*k.MergeLog)) - } - if k.MergeLogKey != "" { - kvs.Insert("Merge_Log_Key", k.MergeLogKey) - } - if k.MergeLogTrim != nil { - kvs.Insert("Merge_Log_Trim", fmt.Sprint(*k.MergeLogTrim)) - } - if k.MergeParser != "" { - kvs.Insert("Merge_Parser", k.MergeParser) - } - if k.KeepLog != nil { - kvs.Insert("Keep_Log", fmt.Sprint(*k.KeepLog)) - } - if k.TLSDebug != nil { - kvs.Insert("tls.debug", fmt.Sprint(*k.TLSDebug)) - } - if k.TLSVerify != nil { - kvs.Insert("tls.verify", fmt.Sprint(*k.TLSVerify)) - } - if k.UseJournal != nil { - kvs.Insert("Use_Journal", fmt.Sprint(*k.UseJournal)) - } - if k.CacheUseDockerId != nil { - kvs.Insert("Cache_Use_Docker_Id", fmt.Sprint(*k.CacheUseDockerId)) - } - if k.RegexParser != "" { - kvs.Insert("Regex_Parser", k.RegexParser) - } - if k.K8SLoggingParser != nil { - kvs.Insert("K8S-Logging.Parser", fmt.Sprint(*k.K8SLoggingParser)) - } - if k.K8SLoggingExclude != nil { - kvs.Insert("K8S-Logging.Exclude", fmt.Sprint(*k.K8SLoggingExclude)) - } - if k.Labels != nil { - kvs.Insert("Labels", fmt.Sprint(*k.Labels)) - } - if k.Annotations != nil { - kvs.Insert("Annotations", fmt.Sprint(*k.Annotations)) - } - if k.KubeMetaPreloadCacheDir != "" { - kvs.Insert("Kube_meta_preload_cache_dir", k.KubeMetaPreloadCacheDir) - } - if k.DummyMeta != nil { - kvs.Insert("Dummy_Meta", fmt.Sprint(*k.DummyMeta)) - } - if k.DNSRetries != nil { - kvs.Insert("DNS_Retries", fmt.Sprint(*k.DNSRetries)) - } - if k.DNSWaitTime != nil { - kvs.Insert("DNS_Wait_Time", fmt.Sprint(*k.DNSWaitTime)) - } - if k.UseKubelet != nil { - kvs.Insert("Use_Kubelet", fmt.Sprint(*k.UseKubelet)) - } - if k.KubeletPort != nil { - kvs.Insert("Kubelet_Port", fmt.Sprint(*k.KubeletPort)) - } - if k.KubeletHost != "" { - kvs.Insert("Kubelet_Host", k.KubeletHost) - } - if k.KubeMetaCacheTTL != "" { - kvs.Insert("Kube_Meta_Cache_TTL", k.KubeMetaCacheTTL) - } - if k.KubeTokenTTL != "" { - kvs.Insert("Kube_Token_TTL", k.KubeTokenTTL) - } - if k.KubeTokenCommand != "" { - kvs.Insert("Kube_Token_Command", fmt.Sprint(k.KubeTokenCommand)) - } - if k.KubeMetaNamespaceCacheTTL != nil { - kvs.Insert("Kube_Meta_Namespace_Cache_TTL", fmt.Sprint(*k.KubeMetaNamespaceCacheTTL)) - } - if k.NamespaceLabels != nil { - kvs.Insert("Namespace_Labels", fmt.Sprint(*k.NamespaceLabels)) - } - if k.NamespaceAnnotations != nil { - kvs.Insert("Namespace_Annotations", fmt.Sprint(*k.NamespaceAnnotations)) - } - if k.NamespaceMetadataOnly != nil { - kvs.Insert("Namespace_Metadata_Only", fmt.Sprint(*k.NamespaceMetadataOnly)) - } - if k.OwnerReferences != nil { - kvs.Insert("Owner_References", fmt.Sprint(*k.OwnerReferences)) - } - if k.UseTagForMeta != nil { - kvs.Insert("Use_Tag_For_Meta", fmt.Sprint(*k.UseTagForMeta)) - } + + plugins.InsertKVString(kvs, "Buffer_Size", k.BufferSize) + plugins.InsertKVString(kvs, "Kube_URL", k.KubeURL) + plugins.InsertKVString(kvs, "Kube_CA_File", k.KubeCAFile) + plugins.InsertKVString(kvs, "Kube_CA_Path", k.KubeCAPath) + plugins.InsertKVString(kvs, "Kube_Token_File", k.KubeTokenFile) + plugins.InsertKVString(kvs, "Kube_Tag_Prefix", k.KubeTagPrefix) + plugins.InsertKVString(kvs, "Merge_Log_Key", k.MergeLogKey) + plugins.InsertKVString(kvs, "Merge_Parser", k.MergeParser) + plugins.InsertKVString(kvs, "Regex_Parser", k.RegexParser) + plugins.InsertKVString(kvs, "Kube_meta_preload_cache_dir", k.KubeMetaPreloadCacheDir) + plugins.InsertKVString(kvs, "Kubelet_Host", k.KubeletHost) + plugins.InsertKVString(kvs, "Kube_Token_TTL", k.KubeTokenTTL) + plugins.InsertKVString(kvs, "Kube_Token_Command", k.KubeTokenCommand) + + plugins.InsertKVField(kvs, "Merge_Log", k.MergeLog) + plugins.InsertKVField(kvs, "Merge_Log_Trim", k.MergeLogTrim) + plugins.InsertKVField(kvs, "Keep_Log", k.KeepLog) + plugins.InsertKVField(kvs, "tls.debug", k.TLSDebug) + plugins.InsertKVField(kvs, "tls.verify", k.TLSVerify) + plugins.InsertKVField(kvs, "Use_Journal", k.UseJournal) + plugins.InsertKVField(kvs, "Cache_Use_Docker_Id", k.CacheUseDockerId) + plugins.InsertKVField(kvs, "K8S-Logging.Parser", k.K8SLoggingParser) + plugins.InsertKVField(kvs, "K8S-Logging.Exclude", k.K8SLoggingExclude) + plugins.InsertKVField(kvs, "Labels", k.Labels) + plugins.InsertKVField(kvs, "Annotations", k.Annotations) + plugins.InsertKVField(kvs, "Dummy_Meta", k.DummyMeta) + plugins.InsertKVField(kvs, "DNS_Retries", k.DNSRetries) + plugins.InsertKVField(kvs, "DNS_Wait_Time", k.DNSWaitTime) + plugins.InsertKVField(kvs, "Use_Kubelet", k.UseKubelet) + plugins.InsertKVField(kvs, "Kubelet_Port", k.KubeletPort) + plugins.InsertKVString(kvs, "Kube_Meta_Cache_TTL", k.KubeMetaCacheTTL) + plugins.InsertKVField(kvs, "Kube_Meta_Namespace_Cache_TTL", k.KubeMetaNamespaceCacheTTL) + plugins.InsertKVField(kvs, "Namespace_Labels", k.NamespaceLabels) + plugins.InsertKVField(kvs, "Namespace_Annotations", k.NamespaceAnnotations) + plugins.InsertKVField(kvs, "Namespace_Metadata_Only", k.NamespaceMetadataOnly) + plugins.InsertKVField(kvs, "Owner_References", k.OwnerReferences) + plugins.InsertKVField(kvs, "Use_Tag_For_Meta", k.UseTagForMeta) + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/input/collectd.go b/apis/fluentbit/v1alpha2/plugins/input/collectd.go index 380e2893e..a851c2791 100644 --- a/apis/fluentbit/v1alpha2/plugins/input/collectd.go +++ b/apis/fluentbit/v1alpha2/plugins/input/collectd.go @@ -1,8 +1,6 @@ package input import ( - "fmt" - "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins" "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins/params" ) @@ -29,14 +27,11 @@ func (*Collectd) Name() string { // implement Section() method func (c *Collectd) Params(_ plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if c.Listen != "" { - kvs.Insert("Listen", c.Listen) - } - if c.Port != nil { - kvs.Insert("Port", fmt.Sprint(*c.Port)) - } - if c.TypesDB != "" { - kvs.Insert("TypesDB", c.TypesDB) - } + + plugins.InsertKVString(kvs, "Listen", c.Listen) + plugins.InsertKVString(kvs, "TypesDB", c.TypesDB) + + plugins.InsertKVField(kvs, "Port", c.Port) + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/input/dummy_types.go b/apis/fluentbit/v1alpha2/plugins/input/dummy_types.go index 821b42528..5f1116935 100644 --- a/apis/fluentbit/v1alpha2/plugins/input/dummy_types.go +++ b/apis/fluentbit/v1alpha2/plugins/input/dummy_types.go @@ -1,8 +1,6 @@ package input import ( - "fmt" - "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins" "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins/params" ) @@ -30,17 +28,12 @@ func (*Dummy) Name() string { // implement Section() method func (d *Dummy) Params(_ plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if d.Tag != "" { - kvs.Insert("Tag", d.Tag) - } - if d.Dummy != "" { - kvs.Insert("Dummy", d.Dummy) - } - if d.Rate != nil { - kvs.Insert("Rate", fmt.Sprint(*d.Rate)) - } - if d.Samples != nil { - kvs.Insert("Samples", fmt.Sprint(*d.Samples)) - } + + plugins.InsertKVString(kvs, "Tag", d.Tag) + plugins.InsertKVString(kvs, "Dummy", d.Dummy) + + plugins.InsertKVField(kvs, "Rate", d.Rate) + plugins.InsertKVField(kvs, "Samples", d.Samples) + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/input/exec_wasi_types.go b/apis/fluentbit/v1alpha2/plugins/input/exec_wasi_types.go index 0e2291ecb..4009122d0 100644 --- a/apis/fluentbit/v1alpha2/plugins/input/exec_wasi_types.go +++ b/apis/fluentbit/v1alpha2/plugins/input/exec_wasi_types.go @@ -1,8 +1,6 @@ package input import ( - "fmt" - "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins" "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins/params" ) @@ -42,32 +40,19 @@ func (*ExecWasi) Name() string { func (w *ExecWasi) Params(_ plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if w.WASIPath != "" { - kvs.Insert("WASI_Path", w.WASIPath) - } - if w.Parser != "" { - kvs.Insert("Parser", w.Parser) - } + plugins.InsertKVString(kvs, "WASI_Path", w.WASIPath) + plugins.InsertKVString(kvs, "Parser", w.Parser) + plugins.InsertKVString(kvs, "Wasm_Heap_Size", w.WasmHeapSize) + plugins.InsertKVString(kvs, "Wasm_Stack_Size", w.WasmStackSize) + plugins.InsertKVString(kvs, "Buf_Size", w.BufSize) + + plugins.InsertKVField(kvs, "Interval_Sec", w.IntervalSec) + plugins.InsertKVField(kvs, "Interval_NSec", w.IntervalNSec) + plugins.InsertKVField(kvs, "Threaded", w.Threaded) + for _, p := range w.AccessiblePaths { kvs.Insert("Accessible_Paths", p) } - if w.IntervalSec != nil { - kvs.Insert("Interval_Sec", fmt.Sprint(*w.IntervalSec)) - } - if w.IntervalNSec != nil { - kvs.Insert("Interval_NSec", fmt.Sprint(*w.IntervalNSec)) - } - if w.WasmHeapSize != "" { - kvs.Insert("Wasm_Heap_Size", w.WasmHeapSize) - } - if w.WasmStackSize != "" { - kvs.Insert("Wasm_Stack_Size", w.WasmStackSize) - } - if w.BufSize != "" { - kvs.Insert("Buf_Size", w.BufSize) - } - if w.Threaded != nil { - kvs.Insert("Threaded", fmt.Sprint(*w.Threaded)) - } + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/input/fluentbit_metrics_types.go b/apis/fluentbit/v1alpha2/plugins/input/fluentbit_metrics_types.go index c5bb63a86..4ac44337c 100644 --- a/apis/fluentbit/v1alpha2/plugins/input/fluentbit_metrics_types.go +++ b/apis/fluentbit/v1alpha2/plugins/input/fluentbit_metrics_types.go @@ -1,8 +1,6 @@ package input import ( - "fmt" - "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins" "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins/params" ) @@ -30,14 +28,11 @@ func (*FluentbitMetrics) Name() string { func (f *FluentbitMetrics) Params(_ plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if f.Tag != "" { - kvs.Insert("Tag", f.Tag) - } - if f.ScrapeInterval != "" { - kvs.Insert("scrape_interval", f.ScrapeInterval) - } - if f.ScrapeOnStart != nil { - kvs.Insert("scrape_on_start", fmt.Sprint(*f.ScrapeOnStart)) - } + + plugins.InsertKVString(kvs, "Tag", f.Tag) + plugins.InsertKVString(kvs, "scrape_interval", f.ScrapeInterval) + + plugins.InsertKVField(kvs, "scrape_on_start", f.ScrapeOnStart) + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/input/forward.go b/apis/fluentbit/v1alpha2/plugins/input/forward.go index 56e9f94c6..22ecd48a8 100644 --- a/apis/fluentbit/v1alpha2/plugins/input/forward.go +++ b/apis/fluentbit/v1alpha2/plugins/input/forward.go @@ -1,8 +1,6 @@ package input import ( - "fmt" - "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins" "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins/params" ) @@ -46,32 +44,16 @@ func (*Forward) Name() string { // Params implement Section() method func (f *Forward) Params(_ plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if f.Port != nil { - kvs.Insert("Port", fmt.Sprint(*f.Port)) - } - if f.Listen != "" { - kvs.Insert("Listen", f.Listen) - } - if f.Tag != "" { - kvs.Insert("Tag", f.Tag) - } - if f.TagPrefix != "" { - kvs.Insert("Tag_Prefix", f.TagPrefix) - } - if f.UnixPath != "" { - kvs.Insert("Unix_Path", f.UnixPath) - } - if f.UnixPerm != "" { - kvs.Insert("Unix_Perm", f.UnixPerm) - } - if f.BufferChunkSize != "" { - kvs.Insert("Buffer_Chunk_Size", f.BufferChunkSize) - } - if f.BufferMaxSize != "" { - kvs.Insert("Buffer_Max_Size", f.BufferMaxSize) - } - if f.Threaded != "" { - kvs.Insert("threaded", f.Threaded) - } + + plugins.InsertKVField(kvs, "Port", f.Port) + plugins.InsertKVString(kvs, "Listen", f.Listen) + plugins.InsertKVString(kvs, "Tag", f.Tag) + plugins.InsertKVString(kvs, "Tag_Prefix", f.TagPrefix) + plugins.InsertKVString(kvs, "Unix_Path", f.UnixPath) + plugins.InsertKVString(kvs, "Unix_Perm", f.UnixPerm) + plugins.InsertKVString(kvs, "Buffer_Chunk_Size", f.BufferChunkSize) + plugins.InsertKVString(kvs, "Buffer_Max_Size", f.BufferMaxSize) + plugins.InsertKVString(kvs, "threaded", f.Threaded) + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/input/http.go b/apis/fluentbit/v1alpha2/plugins/input/http.go index 37421ea70..8404e0512 100644 --- a/apis/fluentbit/v1alpha2/plugins/input/http.go +++ b/apis/fluentbit/v1alpha2/plugins/input/http.go @@ -1,8 +1,6 @@ package input import ( - "fmt" - "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins" "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins/params" ) @@ -41,27 +39,7 @@ func (*HTTP) Name() string { // Params implement Section() method func (h *HTTP) Params(sl plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if h.Listen != "" { - kvs.Insert("listen", h.Listen) - } - if h.Port != nil { - kvs.Insert("port", fmt.Sprint(*h.Port)) - } - if h.Tagkey != "" { - kvs.Insert("tag_key", h.Tagkey) - } - if h.BufferMaxSize != "" { - kvs.Insert("buffer_max_size", h.BufferMaxSize) - } - if h.BufferChunkSize != "" { - kvs.Insert("buffer_chunk_size", h.BufferChunkSize) - } - if h.SuccessfulResponseCode != nil { - kvs.Insert("successful_response_code", fmt.Sprint(*h.SuccessfulResponseCode)) - } - if h.SuccessfulHeader != "" { - kvs.Insert("success_header", h.SuccessfulHeader) - } + if h.TLS != nil { tls, err := h.TLS.Params(sl) if err != nil { @@ -69,5 +47,15 @@ func (h *HTTP) Params(sl plugins.SecretLoader) (*params.KVs, error) { } kvs.Merge(tls) } + + plugins.InsertKVString(kvs, "listen", h.Listen) + plugins.InsertKVString(kvs, "tag_key", h.Tagkey) + plugins.InsertKVString(kvs, "buffer_max_size", h.BufferMaxSize) + plugins.InsertKVString(kvs, "buffer_chunk_size", h.BufferChunkSize) + plugins.InsertKVString(kvs, "success_header", h.SuccessfulHeader) + + plugins.InsertKVField(kvs, "port", h.Port) + plugins.InsertKVField(kvs, "successful_response_code", h.SuccessfulResponseCode) + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/input/kubernetes_events_types.go b/apis/fluentbit/v1alpha2/plugins/input/kubernetes_events_types.go index 46bac7ccf..a685ca2a2 100644 --- a/apis/fluentbit/v1alpha2/plugins/input/kubernetes_events_types.go +++ b/apis/fluentbit/v1alpha2/plugins/input/kubernetes_events_types.go @@ -1,8 +1,6 @@ package input import ( - "fmt" - "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins" "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins/params" ) @@ -54,53 +52,24 @@ func (*KubernetesEvents) Name() string { // implement Section() method func (k *KubernetesEvents) Params(_ plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if k.Tag != "" { - kvs.Insert("Tag", k.Tag) - } - if k.DB != "" { - kvs.Insert("DB", k.DB) - } - if k.DBSync != "" { - kvs.Insert("DB.Sync", k.DBSync) - } - if k.IntervalSec != nil { - kvs.Insert("Interval_Sec", fmt.Sprint(*k.IntervalSec)) - } - if k.IntervalNsec != nil { - kvs.Insert("Interval_Nsec", fmt.Sprint(*k.IntervalNsec)) - } - if k.KubeURL != "" { - kvs.Insert("Kube_URL", k.KubeURL) - } - if k.KubeCAFile != "" { - kvs.Insert("Kube_CA_File", k.KubeCAFile) - } - if k.KubeCAPath != "" { - kvs.Insert("Kube_CA_Path", k.KubeCAPath) - } - if k.KubeTokenFile != "" { - kvs.Insert("Kube_Token_File", k.KubeTokenFile) - } - if k.KubeTokenTTL != "" { - kvs.Insert("Kube_Token_TTL", k.KubeTokenTTL) - } - if k.KubeRequestLimit != nil { - kvs.Insert("Kube_Request_Limit", fmt.Sprint(*k.KubeRequestLimit)) - } - if k.KubeRetentionTime != "" { - kvs.Insert("Kube_Retention_Time", k.KubeRetentionTime) - } - if k.KubeNamespace != "" { - kvs.Insert("Kube_Namespace", k.KubeNamespace) - } - if k.TLSDebug != nil { - kvs.Insert("tls.Debug", fmt.Sprint(*k.TLSDebug)) - } - if k.TLSVerify != nil { - kvs.Insert("tls.Verify", fmt.Sprint(*k.TLSVerify)) - } - if k.TLSVhost != "" { - kvs.Insert("tls.Vhost", k.TLSVhost) - } + + plugins.InsertKVString(kvs, "Tag", k.Tag) + plugins.InsertKVString(kvs, "DB", k.DB) + plugins.InsertKVString(kvs, "DB.Sync", k.DBSync) + plugins.InsertKVString(kvs, "Kube_URL", k.KubeURL) + plugins.InsertKVString(kvs, "Kube_CA_File", k.KubeCAFile) + plugins.InsertKVString(kvs, "Kube_CA_Path", k.KubeCAPath) + plugins.InsertKVString(kvs, "Kube_Token_File", k.KubeTokenFile) + plugins.InsertKVString(kvs, "Kube_Token_TTL", k.KubeTokenTTL) + plugins.InsertKVString(kvs, "Kube_Retention_Time", k.KubeRetentionTime) + plugins.InsertKVString(kvs, "Kube_Namespace", k.KubeNamespace) + plugins.InsertKVString(kvs, "tls.Vhost", k.TLSVhost) + + plugins.InsertKVField(kvs, "Interval_Sec", k.IntervalSec) + plugins.InsertKVField(kvs, "Interval_Nsec", k.IntervalNsec) + plugins.InsertKVField(kvs, "Kube_Request_Limit", k.KubeRequestLimit) + plugins.InsertKVField(kvs, "tls.Debug", k.TLSDebug) + plugins.InsertKVField(kvs, "tls.Verify", k.TLSVerify) + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/input/mqtt.go b/apis/fluentbit/v1alpha2/plugins/input/mqtt.go index 51c0b47ef..2270454d0 100644 --- a/apis/fluentbit/v1alpha2/plugins/input/mqtt.go +++ b/apis/fluentbit/v1alpha2/plugins/input/mqtt.go @@ -1,8 +1,6 @@ package input import ( - "fmt" - "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins" "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins/params" ) @@ -28,11 +26,10 @@ func (*MQTT) Name() string { // implement Section() method func (m *MQTT) Params(_ plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if m.Listen != "" { - kvs.Insert("Listen", m.Listen) - } - if m.Port != nil { - kvs.Insert("Port", fmt.Sprint(*m.Port)) - } + + plugins.InsertKVString(kvs, "Listen", m.Listen) + + plugins.InsertKVField(kvs, "Port", m.Port) + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/input/nginx.go b/apis/fluentbit/v1alpha2/plugins/input/nginx.go index 99aa0ebdb..207e22fe0 100644 --- a/apis/fluentbit/v1alpha2/plugins/input/nginx.go +++ b/apis/fluentbit/v1alpha2/plugins/input/nginx.go @@ -1,8 +1,6 @@ package input import ( - "fmt" - "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins" "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins/params" ) @@ -31,17 +29,12 @@ func (*Nginx) Name() string { // implement Section() method func (n *Nginx) Params(_ plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if n.Host != "" { - kvs.Insert("Host", n.Host) - } - if n.Port != nil { - kvs.Insert("Port", fmt.Sprint(*n.Port)) - } - if n.StatusURL != "" { - kvs.Insert("Status_URL", n.StatusURL) - } - if n.NginxPlus != nil { - kvs.Insert("Nginx_Plus", fmt.Sprint(*n.NginxPlus)) - } + + plugins.InsertKVString(kvs, "Host", n.Host) + plugins.InsertKVString(kvs, "Status_URL", n.StatusURL) + + plugins.InsertKVField(kvs, "Port", n.Port) + plugins.InsertKVField(kvs, "Nginx_Plus", n.NginxPlus) + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/input/node_exporter_metrics_types.go b/apis/fluentbit/v1alpha2/plugins/input/node_exporter_metrics_types.go index e03b19464..ae80a081d 100644 --- a/apis/fluentbit/v1alpha2/plugins/input/node_exporter_metrics_types.go +++ b/apis/fluentbit/v1alpha2/plugins/input/node_exporter_metrics_types.go @@ -33,19 +33,14 @@ func (*NodeExporterMetrics) Name() string { // Params implement Section() method func (d *NodeExporterMetrics) Params(_ plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if d.Tag != "" { - kvs.Insert("Tag", d.Tag) - } - if d.ScrapeInterval != "" { - kvs.Insert("scrape_interval", d.ScrapeInterval) - } + + plugins.InsertKVString(kvs, "Tag", d.Tag) + plugins.InsertKVString(kvs, "scrape_interval", d.ScrapeInterval) + if d.Path != nil { - if d.Path.Procfs != "" { - kvs.Insert("path.procfs", d.Path.Procfs) - } - if d.Path.Sysfs != "" { - kvs.Insert("path.sysfs", d.Path.Sysfs) - } + plugins.InsertKVString(kvs, "path.procfs", d.Path.Procfs) + plugins.InsertKVString(kvs, "path.sysfs", d.Path.Sysfs) } + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/input/open_telemetry_types.go b/apis/fluentbit/v1alpha2/plugins/input/open_telemetry_types.go index 213320002..f66ca87f0 100644 --- a/apis/fluentbit/v1alpha2/plugins/input/open_telemetry_types.go +++ b/apis/fluentbit/v1alpha2/plugins/input/open_telemetry_types.go @@ -1,8 +1,6 @@ package input import ( - "fmt" - "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins" "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins/params" ) @@ -44,32 +42,17 @@ func (*OpenTelemetry) Name() string { // implement Section() method func (ot *OpenTelemetry) Params(_ plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if ot.Listen != "" { - kvs.Insert("listen", ot.Listen) - } - if ot.Port != nil { - kvs.Insert("port", fmt.Sprint(*ot.Port)) - } - if ot.Tagkey != "" { - kvs.Insert("tag_key", ot.Tagkey) - } - if ot.RawTraces != nil { - kvs.Insert("raw_traces", fmt.Sprint(*ot.RawTraces)) - } - if ot.BufferMaxSize != "" { - kvs.Insert("buffer_max_size", ot.BufferMaxSize) - } - if ot.BufferChunkSize != "" { - kvs.Insert("buffer_chunk_size", ot.BufferChunkSize) - } - if ot.SuccessfulResponseCode != nil { - kvs.Insert("successful_response_code", fmt.Sprint(*ot.SuccessfulResponseCode)) - } - if ot.Tag != "" { - kvs.Insert("tag", ot.Tag) - } - if ot.TagFromURI != nil { - kvs.Insert("tag_from_uri", fmt.Sprint(*ot.TagFromURI)) - } + + plugins.InsertKVString(kvs, "listen", ot.Listen) + plugins.InsertKVString(kvs, "tag_key", ot.Tagkey) + plugins.InsertKVString(kvs, "buffer_max_size", ot.BufferMaxSize) + plugins.InsertKVString(kvs, "buffer_chunk_size", ot.BufferChunkSize) + plugins.InsertKVString(kvs, "tag", ot.Tag) + + plugins.InsertKVField(kvs, "port", ot.Port) + plugins.InsertKVField(kvs, "raw_traces", ot.RawTraces) + plugins.InsertKVField(kvs, "successful_response_code", ot.SuccessfulResponseCode) + plugins.InsertKVField(kvs, "tag_from_uri", ot.TagFromURI) + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/input/prometheus_scrape_metrics_types.go b/apis/fluentbit/v1alpha2/plugins/input/prometheus_scrape_metrics_types.go index 4f6ee679e..6129945b9 100644 --- a/apis/fluentbit/v1alpha2/plugins/input/prometheus_scrape_metrics_types.go +++ b/apis/fluentbit/v1alpha2/plugins/input/prometheus_scrape_metrics_types.go @@ -1,7 +1,6 @@ package input import ( - "fmt" "strings" "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins" @@ -36,23 +35,20 @@ func (*PrometheusScrapeMetrics) Name() string { // Params implement Section() method func (p *PrometheusScrapeMetrics) Params(_ plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if p.Tag != "" { - kvs.Insert("tag", p.Tag) - } + + plugins.InsertKVString(kvs, "tag", p.Tag) + + // Special case: host handling host := strings.ToLower(p.Host) if host == "" || host == "host" { kvs.Insert("host", "${HOST_IP}") } else { kvs.Insert("host", p.Host) } - if p.Port != nil { - kvs.Insert("port", fmt.Sprint(*p.Port)) - } - if p.ScrapeInterval != "" { - kvs.Insert("scrape_interval", p.ScrapeInterval) - } - if p.MetricsPath != "" { - kvs.Insert("metrics_path", p.MetricsPath) - } + + plugins.InsertKVField(kvs, "port", p.Port) + plugins.InsertKVString(kvs, "scrape_interval", p.ScrapeInterval) + plugins.InsertKVString(kvs, "metrics_path", p.MetricsPath) + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/input/statsd.go b/apis/fluentbit/v1alpha2/plugins/input/statsd.go index 6a25cadae..53f2d9495 100644 --- a/apis/fluentbit/v1alpha2/plugins/input/statsd.go +++ b/apis/fluentbit/v1alpha2/plugins/input/statsd.go @@ -1,8 +1,6 @@ package input import ( - "fmt" - "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins" "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins/params" ) @@ -27,11 +25,10 @@ func (*StatsD) Name() string { // implement Section() method func (s *StatsD) Params(_ plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if s.Listen != "" { - kvs.Insert("Listen", s.Listen) - } - if s.Port != nil { - kvs.Insert("Port", fmt.Sprint(*s.Port)) - } + + plugins.InsertKVString(kvs, "Listen", s.Listen) + + plugins.InsertKVField(kvs, "Port", s.Port) + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/input/syslog.go b/apis/fluentbit/v1alpha2/plugins/input/syslog.go index 22cd1fad4..aac71b598 100644 --- a/apis/fluentbit/v1alpha2/plugins/input/syslog.go +++ b/apis/fluentbit/v1alpha2/plugins/input/syslog.go @@ -1,8 +1,6 @@ package input import ( - "fmt" - "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins" "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins/params" ) @@ -52,36 +50,18 @@ func (*Syslog) Name() string { func (s *Syslog) Params(sl plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if s.Mode != "" { - kvs.Insert("Mode", s.Mode) - } - if s.Listen != "" { - kvs.Insert("Listen", s.Listen) - } - if s.Port != nil { - kvs.Insert("Port", fmt.Sprint(*s.Port)) - } - if s.Path != "" { - kvs.Insert("Path", s.Path) - } - if s.UnixPerm != nil { - kvs.Insert("Unix_Perm", fmt.Sprint(*s.UnixPerm)) - } - if s.Parser != "" { - kvs.Insert("Parser", s.Parser) - } - if s.BufferChunkSize != "" { - kvs.Insert("Buffer_Chunk_Size", s.BufferChunkSize) - } - if s.BufferMaxSize != "" { - kvs.Insert("Buffer_Max_Size", s.BufferMaxSize) - } - if s.ReceiveBufferSize != "" { - kvs.Insert("Receive_Buffer_Size", s.ReceiveBufferSize) - } - if s.SourceAddressKey != "" { - kvs.Insert("Source_Address_Key", s.SourceAddressKey) - } + plugins.InsertKVString(kvs, "Mode", s.Mode) + plugins.InsertKVString(kvs, "Listen", s.Listen) + plugins.InsertKVString(kvs, "Path", s.Path) + plugins.InsertKVString(kvs, "Parser", s.Parser) + plugins.InsertKVString(kvs, "Buffer_Chunk_Size", s.BufferChunkSize) + plugins.InsertKVString(kvs, "Buffer_Max_Size", s.BufferMaxSize) + plugins.InsertKVString(kvs, "Receive_Buffer_Size", s.ReceiveBufferSize) + plugins.InsertKVString(kvs, "Source_Address_Key", s.SourceAddressKey) + + plugins.InsertKVField(kvs, "Port", s.Port) + plugins.InsertKVField(kvs, "Unix_Perm", s.UnixPerm) + if s.TLS != nil { tls, err := s.TLS.Params(sl) if err != nil { diff --git a/apis/fluentbit/v1alpha2/plugins/input/systemd_types.go b/apis/fluentbit/v1alpha2/plugins/input/systemd_types.go index f4b5c4796..ab52b3838 100644 --- a/apis/fluentbit/v1alpha2/plugins/input/systemd_types.go +++ b/apis/fluentbit/v1alpha2/plugins/input/systemd_types.go @@ -1,6 +1,8 @@ package input import ( + "strconv" + "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins" "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins/params" ) @@ -59,44 +61,27 @@ func (*Systemd) Name() string { func (s *Systemd) Params(_ plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if s.Path != "" { - kvs.Insert("Path", s.Path) - } - if s.DB != "" { - kvs.Insert("DB", s.DB) - } - if s.DBSync != "" { - kvs.Insert("DB.Sync", s.DBSync) - } - if s.Tag != "" { - kvs.Insert("Tag", s.Tag) - } + plugins.InsertKVString(kvs, "Path", s.Path) + plugins.InsertKVString(kvs, "DB", s.DB) + plugins.InsertKVString(kvs, "DB.Sync", s.DBSync) + plugins.InsertKVString(kvs, "Tag", s.Tag) + plugins.InsertKVString(kvs, "Systemd_Filter_Type", s.SystemdFilterType) + plugins.InsertKVString(kvs, "Read_From_Tail", s.ReadFromTail) + plugins.InsertKVString(kvs, "Strip_Underscores", s.StripUnderscores) + plugins.InsertKVString(kvs, "storage.type", s.StorageType) + plugins.InsertKVString(kvs, "storage.pause_on_chunks_overlimit", s.PauseOnChunksOverlimit) + if s.MaxFields > 0 { - kvs.Insert("Max_Fields", string(rune(s.MaxFields))) + kvs.Insert("Max_Fields", strconv.Itoa(s.MaxFields)) } if s.MaxEntries > 0 { - kvs.Insert("Max_Entries", string(rune(s.MaxEntries))) + kvs.Insert("Max_Entries", strconv.Itoa(s.MaxEntries)) } if len(s.SystemdFilter) > 0 { for _, v := range s.SystemdFilter { kvs.Insert("Systemd_Filter", v) } } - if s.SystemdFilterType != "" { - kvs.Insert("Systemd_Filter_Type", s.SystemdFilterType) - } - if s.ReadFromTail != "" { - kvs.Insert("Read_From_Tail", s.ReadFromTail) - } - if s.StripUnderscores != "" { - kvs.Insert("Strip_Underscores", s.StripUnderscores) - } - if s.StorageType != "" { - kvs.Insert("storage.type", s.StorageType) - } - if s.PauseOnChunksOverlimit != "" { - kvs.Insert("storage.pause_on_chunks_overlimit", s.PauseOnChunksOverlimit) - } return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/input/tail_types.go b/apis/fluentbit/v1alpha2/plugins/input/tail_types.go index ef250f5ea..815daff1a 100644 --- a/apis/fluentbit/v1alpha2/plugins/input/tail_types.go +++ b/apis/fluentbit/v1alpha2/plugins/input/tail_types.go @@ -116,101 +116,47 @@ func (*Tail) Name() string { func (t *Tail) Params(_ plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if t.BufferChunkSize != "" { - kvs.Insert("Buffer_Chunk_Size", t.BufferChunkSize) - } - if t.BufferMaxSize != "" { - kvs.Insert("Buffer_Max_Size", t.BufferMaxSize) - } - if t.Path != "" { - kvs.Insert("Path", t.Path) - } - if t.PathKey != "" { - kvs.Insert("Path_Key", t.PathKey) - } - if t.ExcludePath != "" { - kvs.Insert("Exclude_Path", t.ExcludePath) - } - if t.OffsetKey != "" { - kvs.Insert("Offset_Key", t.OffsetKey) - } - if t.ReadFromHead != nil { - kvs.Insert("Read_from_Head", fmt.Sprint(*t.ReadFromHead)) - } - if t.RefreshIntervalSeconds != nil { - kvs.Insert("Refresh_Interval", fmt.Sprint(*t.RefreshIntervalSeconds)) - } - if t.RotateWaitSeconds != nil { - kvs.Insert("Rotate_Wait", fmt.Sprint(*t.RotateWaitSeconds)) - } - if t.IgnoreOlder != "" { - kvs.Insert("Ignore_Older", t.IgnoreOlder) - } - if t.SkipLongLines != nil { - kvs.Insert("Skip_Long_Lines", fmt.Sprint(*t.SkipLongLines)) - } - if t.DB != "" { - kvs.Insert("DB", t.DB) - } - if t.DBSync != "" { - kvs.Insert("DB.Sync", t.DBSync) - } - if t.DBLocking != nil { - kvs.Insert("DB.locking", fmt.Sprint(*t.DBLocking)) - } - if t.MemBufLimit != "" { - kvs.Insert("Mem_Buf_Limit", t.MemBufLimit) - } - if t.Parser != "" { - kvs.Insert("Parser", t.Parser) - } - if t.Key != "" { - kvs.Insert("Key", t.Key) - } - if t.Tag != "" { - kvs.Insert("Tag", t.Tag) - } - if t.TagRegex != "" { - kvs.Insert("Tag_Regex", t.TagRegex) - } - if t.Multiline != nil { - kvs.Insert("Multiline", fmt.Sprint(*t.Multiline)) - } - if t.MultilineFlushSeconds != nil { - kvs.Insert("Multiline_Flush", fmt.Sprint(*t.MultilineFlushSeconds)) - } - if t.ParserFirstline != "" { - kvs.Insert("Parser_Firstline", t.ParserFirstline) - } + + plugins.InsertKVString(kvs, "Buffer_Chunk_Size", t.BufferChunkSize) + plugins.InsertKVString(kvs, "Buffer_Max_Size", t.BufferMaxSize) + plugins.InsertKVString(kvs, "Path", t.Path) + plugins.InsertKVString(kvs, "Path_Key", t.PathKey) + plugins.InsertKVString(kvs, "Exclude_Path", t.ExcludePath) + plugins.InsertKVString(kvs, "Offset_Key", t.OffsetKey) + plugins.InsertKVField(kvs, "Refresh_Interval", t.RefreshIntervalSeconds) + plugins.InsertKVString(kvs, "Ignore_Older", t.IgnoreOlder) + plugins.InsertKVField(kvs, "Skip_Long_Lines", t.SkipLongLines) + plugins.InsertKVString(kvs, "DB", t.DB) + plugins.InsertKVString(kvs, "DB.Sync", t.DBSync) + plugins.InsertKVString(kvs, "Mem_Buf_Limit", t.MemBufLimit) + plugins.InsertKVString(kvs, "Parser", t.Parser) + plugins.InsertKVString(kvs, "Key", t.Key) + plugins.InsertKVString(kvs, "Tag", t.Tag) + plugins.InsertKVString(kvs, "Tag_Regex", t.TagRegex) + plugins.InsertKVField(kvs, "Docker_Mode", t.DockerMode) + plugins.InsertKVField(kvs, "Docker_Mode_Flush", t.DockerModeFlushSeconds) + plugins.InsertKVString(kvs, "Docker_Mode_Parser", t.DockerModeParser) + plugins.InsertKVString(kvs, "Parser_Firstline", t.ParserFirstline) + plugins.InsertKVString(kvs, "multiline.parser", t.MultilineParser) + plugins.InsertKVString(kvs, "storage.type", t.StorageType) + plugins.InsertKVString(kvs, "storage.pause_on_chunks_overlimit", t.PauseOnChunksOverlimit) + + plugins.InsertKVField(kvs, "Read_from_Head", t.ReadFromHead) + plugins.InsertKVField(kvs, "Rotate_Wait", t.RotateWaitSeconds) + plugins.InsertKVField(kvs, "DB.locking", t.DBLocking) + plugins.InsertKVField(kvs, "Multiline", t.Multiline) + plugins.InsertKVField(kvs, "Multiline_Flush", t.MultilineFlushSeconds) + plugins.InsertKVField(kvs, "Skip_Empty_Lines", t.SkipEmptyLines) + for i, parser := range t.ParserN { kvs.Insert(fmt.Sprintf("Parser_%d", i+1), parser) } - if t.DockerMode != nil { - kvs.Insert("Docker_Mode", fmt.Sprint(*t.DockerMode)) - } - if t.DockerModeFlushSeconds != nil { - kvs.Insert("Docker_Mode_Flush", fmt.Sprint(*t.DockerModeFlushSeconds)) - } - if t.DockerModeParser != "" { - kvs.Insert("Docker_Mode_Parser", fmt.Sprint(t.DockerModeParser)) - } if t.DisableInotifyWatcher != nil { kvs.Insert("Inotify_Watcher", fmt.Sprint(!*t.DisableInotifyWatcher)) } - if t.MultilineParser != "" { - kvs.Insert("multiline.parser", t.MultilineParser) - } - if t.StorageType != "" { - kvs.Insert("storage.type", t.StorageType) - } - if t.PauseOnChunksOverlimit != "" { - kvs.Insert("storage.pause_on_chunks_overlimit", t.PauseOnChunksOverlimit) - } - if t.SkipEmptyLines != nil { - kvs.Insert("Skip_Empty_Lines", fmt.Sprint(*t.SkipEmptyLines)) - } if t.Threaded != nil { kvs.Insert("Threaded", *t.Threaded) } + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/input/tcp.go b/apis/fluentbit/v1alpha2/plugins/input/tcp.go index a9fb1c122..e8acabd3a 100644 --- a/apis/fluentbit/v1alpha2/plugins/input/tcp.go +++ b/apis/fluentbit/v1alpha2/plugins/input/tcp.go @@ -1,8 +1,6 @@ package input import ( - "fmt" - "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins" "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins/params" ) @@ -39,23 +37,14 @@ func (*TCP) Name() string { // Params implement Section() method func (t *TCP) Params(sl plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if t.Listen != "" { - kvs.Insert("listen", t.Listen) - } - if t.Port != nil { - kvs.Insert("port", fmt.Sprint(*t.Port)) - } - if t.BufferSize != "" { - kvs.Insert("Buffer_Size", t.BufferSize) - } - if t.ChunkSize != "" { - kvs.Insert("Chunk_Size", t.ChunkSize) - } - if t.Format != "" { - kvs.Insert("Format", t.Format) - } - if t.Separator != "" { - kvs.Insert("Separator", t.Separator) - } + + plugins.InsertKVString(kvs, "listen", t.Listen) + plugins.InsertKVString(kvs, "Separator", t.Separator) + plugins.InsertKVString(kvs, "Buffer_Size", t.BufferSize) + plugins.InsertKVString(kvs, "Chunk_Size", t.ChunkSize) + plugins.InsertKVString(kvs, "Format", t.Format) + + plugins.InsertKVField(kvs, "port", t.Port) + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/input/udp.go b/apis/fluentbit/v1alpha2/plugins/input/udp.go index dabcc73ec..344b7429a 100644 --- a/apis/fluentbit/v1alpha2/plugins/input/udp.go +++ b/apis/fluentbit/v1alpha2/plugins/input/udp.go @@ -1,8 +1,6 @@ package input import ( - "fmt" - "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins" "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins/params" ) @@ -46,29 +44,15 @@ func (*UDP) Name() string { func (u *UDP) Params(_ plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if u.Listen != nil { - kvs.Insert("Listen", *u.Listen) - } - if u.Port != nil { - kvs.Insert("Port", fmt.Sprint(*u.Port)) - } - if u.BufferSize != nil { - kvs.Insert("Buffer_Size", *u.BufferSize) - } - if u.ChunkSize != nil { - kvs.Insert("Chunk_Size", *u.ChunkSize) - } - if u.Format != nil { - kvs.Insert("Format", *u.Format) - } - if u.Separator != nil { - kvs.Insert("Separator", *u.Separator) - } - if u.SourceAddressKey != nil { - kvs.Insert("Source_Address_Key", *u.SourceAddressKey) - } - if u.Threaded != nil { - kvs.Insert("Threaded", *u.Threaded) - } + + plugins.InsertKVField(kvs, "Port", u.Port) + plugins.InsertKVField(kvs, "Listen", u.Listen) + plugins.InsertKVField(kvs, "Buffer_Size", u.BufferSize) + plugins.InsertKVField(kvs, "Chunk_Size", u.ChunkSize) + plugins.InsertKVField(kvs, "Format", u.Format) + plugins.InsertKVField(kvs, "Separator", u.Separator) + plugins.InsertKVField(kvs, "Source_Address_Key", u.SourceAddressKey) + plugins.InsertKVField(kvs, "Threaded", u.Threaded) + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/output/azure_blob_types.go b/apis/fluentbit/v1alpha2/plugins/output/azure_blob_types.go index 3be14ad47..89f03a691 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/azure_blob_types.go +++ b/apis/fluentbit/v1alpha2/plugins/output/azure_blob_types.go @@ -43,34 +43,11 @@ func (*AzureBlob) Name() string { // Params implement Section() method func (o *AzureBlob) Params(sl plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if o.AccountName != "" { - kvs.Insert("account_name", o.AccountName) - } - if o.SharedKey != nil { - u, err := sl.LoadSecret(*o.SharedKey) - if err != nil { - return nil, err - } - kvs.Insert("shared_key", u) - } - if o.ContainerName != "" { - kvs.Insert("container_name", o.ContainerName) - } - if o.BlobType != "" { - kvs.Insert("blob_type", o.BlobType) - } - if o.AutoCreateContainer != "" { - kvs.Insert("auto_create_container", o.AutoCreateContainer) - } - if o.Path != "" { - kvs.Insert("path", o.Path) - } - if o.EmulatorMode != "" { - kvs.Insert("emulator_mode", o.EmulatorMode) - } - if o.Endpoint != "" { - kvs.Insert("endpoint", o.Endpoint) + + if err := plugins.InsertKVSecret(kvs, "shared_key", o.SharedKey, sl); err != nil { + return nil, err } + if o.TLS != nil { tls, err := o.TLS.Params(sl) if err != nil { @@ -85,5 +62,14 @@ func (o *AzureBlob) Params(sl plugins.SecretLoader) (*params.KVs, error) { } kvs.Merge(net) } + + plugins.InsertKVString(kvs, "account_name", o.AccountName) + plugins.InsertKVString(kvs, "container_name", o.ContainerName) + plugins.InsertKVString(kvs, "blob_type", o.BlobType) + plugins.InsertKVString(kvs, "auto_create_container", o.AutoCreateContainer) + plugins.InsertKVString(kvs, "path", o.Path) + plugins.InsertKVString(kvs, "emulator_mode", o.EmulatorMode) + plugins.InsertKVString(kvs, "endpoint", o.Endpoint) + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/output/azure_log_analytics_types.go b/apis/fluentbit/v1alpha2/plugins/output/azure_log_analytics_types.go index 020bfcc34..0040d9e69 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/azure_log_analytics_types.go +++ b/apis/fluentbit/v1alpha2/plugins/output/azure_log_analytics_types.go @@ -1,8 +1,6 @@ package output import ( - "fmt" - "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins" "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins/params" ) @@ -48,17 +46,10 @@ func (o *AzureLogAnalytics) Params(sl plugins.SecretLoader) (*params.KVs, error) } kvs.Insert("Shared_Key", u) } - if o.LogType != "" { - kvs.Insert("Log_Type", o.LogType) - } - if o.LogTypeKey != "" { - kvs.Insert("Log_Type_Key", o.LogTypeKey) - } - if o.TimeKey != "" { - kvs.Insert("Time_Key", o.TimeKey) - } - if o.TimeGenerated != nil { - kvs.Insert("Time_Generated", fmt.Sprint(*o.TimeGenerated)) - } + plugins.InsertKVString(kvs, "Log_Type", o.LogType) + plugins.InsertKVString(kvs, "Log_Type_Key", o.LogTypeKey) + plugins.InsertKVString(kvs, "Time_Key", o.TimeKey) + plugins.InsertKVField(kvs, "Time_Generated", o.TimeGenerated) + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/output/cloud_watch_types.go b/apis/fluentbit/v1alpha2/plugins/output/cloud_watch_types.go index ef3d95cfb..19e7f3dfb 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/cloud_watch_types.go +++ b/apis/fluentbit/v1alpha2/plugins/output/cloud_watch_types.go @@ -1,8 +1,6 @@ package output import ( - "fmt" - "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins" "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins/params" ) @@ -58,56 +56,25 @@ func (*CloudWatch) Name() string { // Params implement Section() method func (o *CloudWatch) Params(sl plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if o.Region != "" { - kvs.Insert("region", o.Region) - } - if o.LogGroupName != "" { - kvs.Insert("log_group_name", o.LogGroupName) - } - if o.LogGroupTemplate != "" { - kvs.Insert("log_group_template", o.LogGroupTemplate) - } - if o.LogStreamName != "" { - kvs.Insert("log_stream_name", o.LogStreamName) - } - if o.LogStreamPrefix != "" { - kvs.Insert("log_stream_prefix", o.LogStreamPrefix) - } - if o.LogStreamTemplate != "" { - kvs.Insert("log_stream_template", o.LogStreamTemplate) - } - if o.LogKey != "" { - kvs.Insert("log_key", o.LogKey) - } - if o.LogFormat != "" { - kvs.Insert("log_format", o.LogFormat) - } - if o.AutoCreateGroup != nil { - kvs.Insert("auto_create_group", fmt.Sprint(*o.AutoCreateGroup)) - } - if o.LogRetentionDays != nil { - kvs.Insert("log_retention_days", fmt.Sprint(*o.LogRetentionDays)) - } - if o.RoleArn != "" { - kvs.Insert("role_arn", o.RoleArn) - } - if o.Endpoint != "" { - kvs.Insert("endpoint", o.Endpoint) - } - if o.MetricNamespace != "" { - kvs.Insert("metric_namespace", o.MetricNamespace) - } - if o.MetricDimensions != "" { - kvs.Insert("metric_dimensions", o.MetricDimensions) - } - if o.StsEndpoint != "" { - kvs.Insert("sts_endpoint", o.StsEndpoint) - } - if o.AutoRetryRequests != nil { - kvs.Insert("auto_retry_requests", fmt.Sprint(*o.AutoRetryRequests)) - } - if o.ExternalID != "" { - kvs.Insert("external_id", o.ExternalID) - } + + plugins.InsertKVString(kvs, "region", o.Region) + plugins.InsertKVString(kvs, "log_group_name", o.LogGroupName) + plugins.InsertKVString(kvs, "log_group_template", o.LogGroupTemplate) + plugins.InsertKVString(kvs, "log_stream_name", o.LogStreamName) + plugins.InsertKVString(kvs, "log_stream_prefix", o.LogStreamPrefix) + plugins.InsertKVString(kvs, "log_stream_template", o.LogStreamTemplate) + plugins.InsertKVString(kvs, "log_key", o.LogKey) + plugins.InsertKVString(kvs, "log_format", o.LogFormat) + plugins.InsertKVString(kvs, "role_arn", o.RoleArn) + plugins.InsertKVString(kvs, "endpoint", o.Endpoint) + plugins.InsertKVString(kvs, "metric_namespace", o.MetricNamespace) + plugins.InsertKVString(kvs, "metric_dimensions", o.MetricDimensions) + plugins.InsertKVString(kvs, "sts_endpoint", o.StsEndpoint) + plugins.InsertKVString(kvs, "external_id", o.ExternalID) + + plugins.InsertKVField(kvs, "log_retention_days", o.LogRetentionDays) + plugins.InsertKVField(kvs, "auto_retry_requests", o.AutoRetryRequests) + plugins.InsertKVField(kvs, "auto_create_group", o.AutoCreateGroup) + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/output/data_dog_types.go b/apis/fluentbit/v1alpha2/plugins/output/data_dog_types.go index 0a214aea3..540d3765a 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/data_dog_types.go +++ b/apis/fluentbit/v1alpha2/plugins/output/data_dog_types.go @@ -1,8 +1,6 @@ package output import ( - "fmt" - "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins" "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins/params" ) @@ -52,49 +50,22 @@ func (*DataDog) Name() string { func (s *DataDog) Params(sl plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if s.Host != "" { - kvs.Insert("Host", s.Host) - } - if s.TLS != nil { - kvs.Insert("TLS", fmt.Sprint(*s.TLS)) - } - if s.Compress != "" { - kvs.Insert("compress", s.Compress) - } - 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) - } - if s.Provider != "" { - kvs.Insert("provider", s.Provider) - } - if s.JSONDateKey != "" { - kvs.Insert("json_date_key", s.JSONDateKey) - } - if s.IncludeTagKey != nil { - kvs.Insert("include_tag_key", fmt.Sprint(*s.IncludeTagKey)) - } - if s.TagKey != "" { - kvs.Insert("tag_key", s.TagKey) - } - if s.Service != "" { - kvs.Insert("dd_service", s.Service) - } - if s.Source != "" { - kvs.Insert("dd_source", s.Source) - } - if s.Tags != "" { - kvs.Insert("dd_tags", s.Tags) - } - if s.MessageKey != "" { - kvs.Insert("dd_message_key", s.MessageKey) + plugins.InsertKVString(kvs, "Host", s.Host) + plugins.InsertKVField(kvs, "TLS", s.TLS) + plugins.InsertKVString(kvs, "compress", s.Compress) + plugins.InsertKVString(kvs, "json_date_key", s.JSONDateKey) + plugins.InsertKVField(kvs, "include_tag_key", s.IncludeTagKey) + plugins.InsertKVString(kvs, "tag_key", s.TagKey) + plugins.InsertKVString(kvs, "dd_service", s.Service) + plugins.InsertKVString(kvs, "dd_source", s.Source) + plugins.InsertKVString(kvs, "dd_tags", s.Tags) + plugins.InsertKVString(kvs, "dd_message_key", s.MessageKey) + + if err := plugins.InsertKVSecret(kvs, "apikey", s.APIKey, sl); err != nil { + return nil, err } + plugins.InsertKVString(kvs, "proxy", s.Proxy) + plugins.InsertKVString(kvs, "provider", s.Provider) return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/output/elasticsearch_types.go b/apis/fluentbit/v1alpha2/plugins/output/elasticsearch_types.go index e2a019202..be52de1c3 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/elasticsearch_types.go +++ b/apis/fluentbit/v1alpha2/plugins/output/elasticsearch_types.go @@ -1,8 +1,6 @@ package output import ( - "fmt" - "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins" "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins/params" ) @@ -118,130 +116,59 @@ func (*Elasticsearch) Name() string { // Params implement Section() method func (es *Elasticsearch) Params(sl plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if es.Host != "" { - kvs.Insert("Host", es.Host) - } - if es.Port != nil { - kvs.Insert("Port", fmt.Sprint(*es.Port)) - } - if es.Path != "" { - kvs.Insert("Path", es.Path) - } - if es.Compress != "" { - kvs.Insert("Compress", es.Compress) - } - if es.BufferSize != "" { - kvs.Insert("Buffer_Size", es.BufferSize) - } - if es.Pipeline != "" { - kvs.Insert("Pipeline", es.Pipeline) - } - if es.AWSAuth != "" { - kvs.Insert("AWS_Auth", es.AWSAuth) - } + if es.AWSAuthSecret != nil { - u, err := sl.LoadSecret(*es.AWSAuthSecret) - if err != nil { + if err := plugins.InsertKVSecret(kvs, "AWS_Auth", es.AWSAuthSecret, sl); err != nil { return nil, err } - kvs.Insert("AWS_Auth", u) - } - if es.AWSRegion != "" { - kvs.Insert("AWS_Region", es.AWSRegion) - } - if es.AWSSTSEndpoint != "" { - kvs.Insert("AWS_STS_Endpoint", es.AWSSTSEndpoint) - } - if es.AWSRoleARN != "" { - kvs.Insert("AWS_Role_ARN", es.AWSRoleARN) - } - if es.CloudID != "" { - kvs.Insert("Cloud_ID", es.CloudID) - } - if es.CloudAuth != "" { - kvs.Insert("Cloud_Auth", es.CloudAuth) } if es.CloudAuthSecret != nil { - u, err := sl.LoadSecret(*es.CloudAuthSecret) - if err != nil { - return nil, err - } - kvs.Insert("Cloud_Auth", u) - } - if es.AWSExternalID != "" { - kvs.Insert("AWS_External_ID", es.AWSExternalID) - } - if es.HTTPUser != nil { - u, err := sl.LoadSecret(*es.HTTPUser) - if err != nil { + if err := plugins.InsertKVSecret(kvs, "Cloud_Auth", es.CloudAuthSecret, sl); err != nil { return nil, err } - kvs.Insert("HTTP_User", u) } - if es.HTTPPasswd != nil { - pwd, err := sl.LoadSecret(*es.HTTPPasswd) - if err != nil { - return nil, err - } - kvs.Insert("HTTP_Passwd", pwd) + if err := plugins.InsertKVSecret(kvs, "HTTP_User", es.HTTPUser, sl); err != nil { + return nil, err } - if es.Index != "" { - kvs.Insert("Index", es.Index) - } - if es.Type != "" { - kvs.Insert("Type", es.Type) - } - if es.LogstashFormat != nil { - kvs.Insert("Logstash_Format", fmt.Sprint(*es.LogstashFormat)) - } - if es.LogstashPrefix != "" { - kvs.Insert("Logstash_Prefix", es.LogstashPrefix) - } - if es.LogstashDateFormat != "" { - kvs.Insert("Logstash_DateFormat", es.LogstashDateFormat) - } - if es.TimeKey != "" { - kvs.Insert("Time_Key", es.TimeKey) - } - if es.TimeKeyFormat != "" { - kvs.Insert("Time_Key_Format", es.TimeKeyFormat) - } - if es.TimeKeyNanos != nil { - kvs.Insert("Time_Key_Nanos", fmt.Sprint(*es.TimeKeyNanos)) - } - if es.IncludeTagKey != nil { - kvs.Insert("Include_Tag_Key", fmt.Sprint(*es.IncludeTagKey)) - } - if es.TagKey != "" { - kvs.Insert("Tag_Key", es.TagKey) - } - if es.GenerateID != nil { - kvs.Insert("Generate_ID", fmt.Sprint(*es.GenerateID)) - } - if es.IdKey != "" { - kvs.Insert("ID_KEY", es.IdKey) - } - if es.WriteOperation != "" { - kvs.Insert("Write_Operation", es.WriteOperation) - } - if es.ReplaceDots != nil { - kvs.Insert("Replace_Dots", fmt.Sprint(*es.ReplaceDots)) - } - if es.TraceOutput != nil { - kvs.Insert("Trace_Output", fmt.Sprint(*es.TraceOutput)) - } - if es.TraceError != nil { - kvs.Insert("Trace_Error", fmt.Sprint(*es.TraceError)) - } - if es.CurrentTimeIndex != nil { - kvs.Insert("Current_Time_Index", fmt.Sprint(*es.CurrentTimeIndex)) - } - if es.LogstashPrefixKey != "" { - kvs.Insert("Logstash_Prefix_Key", es.LogstashPrefixKey) - } - if es.SuppressTypeName != "" { - kvs.Insert("Suppress_Type_Name", es.SuppressTypeName) + if err := plugins.InsertKVSecret(kvs, "HTTP_Passwd", es.HTTPPasswd, sl); err != nil { + return nil, err } + + plugins.InsertKVString(kvs, "Host", es.Host) + plugins.InsertKVField(kvs, "Port", es.Port) + plugins.InsertKVString(kvs, "Index", es.Index) + plugins.InsertKVString(kvs, "Type", es.Type) + plugins.InsertKVString(kvs, "Path", es.Path) + plugins.InsertKVString(kvs, "Compress", es.Compress) + plugins.InsertKVString(kvs, "Buffer_Size", es.BufferSize) + plugins.InsertKVString(kvs, "Pipeline", es.Pipeline) + plugins.InsertKVString(kvs, "AWS_Auth", es.AWSAuth) + plugins.InsertKVString(kvs, "AWS_Region", es.AWSRegion) + plugins.InsertKVString(kvs, "AWS_STS_Endpoint", es.AWSSTSEndpoint) + plugins.InsertKVString(kvs, "AWS_Role_ARN", es.AWSRoleARN) + plugins.InsertKVString(kvs, "Cloud_ID", es.CloudID) + plugins.InsertKVString(kvs, "Cloud_Auth", es.CloudAuth) + plugins.InsertKVString(kvs, "AWS_External_ID", es.AWSExternalID) + plugins.InsertKVString(kvs, "Logstash_Prefix", es.LogstashPrefix) + plugins.InsertKVString(kvs, "Logstash_DateFormat", es.LogstashDateFormat) + plugins.InsertKVString(kvs, "Time_Key", es.TimeKey) + plugins.InsertKVString(kvs, "Time_Key_Format", es.TimeKeyFormat) + plugins.InsertKVString(kvs, "Tag_Key", es.TagKey) + plugins.InsertKVString(kvs, "ID_KEY", es.IdKey) + plugins.InsertKVString(kvs, "Write_Operation", es.WriteOperation) + plugins.InsertKVString(kvs, "Logstash_Prefix_Key", es.LogstashPrefixKey) + plugins.InsertKVString(kvs, "Suppress_Type_Name", es.SuppressTypeName) + plugins.InsertKVString(kvs, "storage.total_limit_size", es.TotalLimitSize) + + plugins.InsertKVField(kvs, "Logstash_Format", es.LogstashFormat) + plugins.InsertKVField(kvs, "Time_Key_Nanos", es.TimeKeyNanos) + plugins.InsertKVField(kvs, "Include_Tag_Key", es.IncludeTagKey) + plugins.InsertKVField(kvs, "Generate_ID", es.GenerateID) + plugins.InsertKVField(kvs, "Replace_Dots", es.ReplaceDots) + plugins.InsertKVField(kvs, "Trace_Output", es.TraceOutput) + plugins.InsertKVField(kvs, "Trace_Error", es.TraceError) + plugins.InsertKVField(kvs, "Current_Time_Index", es.CurrentTimeIndex) + if es.TLS != nil { tls, err := es.TLS.Params(sl) if err != nil { @@ -256,8 +183,6 @@ func (es *Elasticsearch) Params(sl plugins.SecretLoader) (*params.KVs, error) { } kvs.Merge(net) } - if es.TotalLimitSize != "" { - kvs.Insert("storage.total_limit_size", es.TotalLimitSize) - } + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/output/file_types.go b/apis/fluentbit/v1alpha2/plugins/output/file_types.go index 385ba0634..bcf97db1e 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/file_types.go +++ b/apis/fluentbit/v1alpha2/plugins/output/file_types.go @@ -31,23 +31,13 @@ func (*File) Name() string { func (f *File) Params(_ plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if f.Path != "" { - kvs.Insert("Path", f.Path) - } - if f.File != "" { - kvs.Insert("File", f.File) - } - if f.Format != "" { - kvs.Insert("Format", f.Format) - } - if f.Delimiter != "" { - kvs.Insert("Delimiter", f.Delimiter) - } - if f.LabelDelimiter != "" { - kvs.Insert("Label_Delimiter", f.LabelDelimiter) - } - if f.Template != "" { - kvs.Insert("Template", f.Template) - } + + plugins.InsertKVString(kvs, "Path", f.Path) + plugins.InsertKVString(kvs, "File", f.File) + plugins.InsertKVString(kvs, "Format", f.Format) + plugins.InsertKVString(kvs, "Delimiter", f.Delimiter) + plugins.InsertKVString(kvs, "Label_Delimiter", f.LabelDelimiter) + plugins.InsertKVString(kvs, "Template", f.Template) + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/output/firehose_types.go b/apis/fluentbit/v1alpha2/plugins/output/firehose_types.go index bc8deef46..0f42a1f22 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/firehose_types.go +++ b/apis/fluentbit/v1alpha2/plugins/output/firehose_types.go @@ -46,8 +46,9 @@ func (*Firehose) Name() string { // implement Section() method func (l *Firehose) Params(sl plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - kvs.Insert("region", l.Region) - kvs.Insert("delivery_stream", l.DeliveryStream) + + plugins.InsertKVString(kvs, "region", l.Region) + plugins.InsertKVString(kvs, "delivery_stream", l.DeliveryStream) if l.DataKeys != nil && *l.DataKeys != "" { kvs.Insert("data_keys", *l.DataKeys) @@ -70,6 +71,7 @@ func (l *Firehose) Params(sl plugins.SecretLoader) (*params.KVs, error) { if l.TimeKeyFormat != nil && *l.TimeKeyFormat != "" { kvs.Insert("time_key_format", *l.TimeKeyFormat) } + if l.AutoRetryRequests != nil { kvs.Insert("auto_retry_requests", strconv.FormatBool(*l.AutoRetryRequests)) } diff --git a/apis/fluentbit/v1alpha2/plugins/output/forward_types.go b/apis/fluentbit/v1alpha2/plugins/output/forward_types.go index 99000f1ce..f4bf27460 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/forward_types.go +++ b/apis/fluentbit/v1alpha2/plugins/output/forward_types.go @@ -1,8 +1,6 @@ package output import ( - "fmt" - "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins" "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins/params" ) @@ -52,46 +50,12 @@ func (*Forward) Name() string { // implement Section() method func (f *Forward) Params(sl plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if f.Host != "" { - kvs.Insert("Host", f.Host) - } - if f.Port != nil { - kvs.Insert("Port", fmt.Sprint(*f.Port)) - } - if f.Tag != "" { - kvs.Insert("Tag", f.Tag) - } - if f.TimeAsInteger != nil { - kvs.Insert("Time_as_Integer", fmt.Sprint(*f.TimeAsInteger)) - } - if f.SendOptions != nil { - kvs.Insert("Send_options", fmt.Sprint(*f.SendOptions)) - } - if f.RequireAckResponse != nil { - kvs.Insert("Require_ack_response", fmt.Sprint(*f.RequireAckResponse)) - } - if f.SharedKey != "" { - kvs.Insert("Shared_Key", f.SharedKey) - } - if f.EmptySharedKey != nil { - kvs.Insert("Empty_Shared_Key", fmt.Sprint(*f.EmptySharedKey)) - } - if f.Username != nil { - u, err := sl.LoadSecret(*f.Username) - if err != nil { - return nil, err - } - kvs.Insert("Username", u) - } - if f.Password != nil { - pwd, err := sl.LoadSecret(*f.Password) - if err != nil { - return nil, err - } - kvs.Insert("Password", pwd) + + if err := plugins.InsertKVSecret(kvs, "Username", f.Username, sl); err != nil { + return nil, err } - if f.SelfHostname != "" { - kvs.Insert("Self_Hostname", f.SelfHostname) + if err := plugins.InsertKVSecret(kvs, "Password", f.Password, sl); err != nil { + return nil, err } if f.TLS != nil { tls, err := f.TLS.Params(sl) @@ -107,5 +71,17 @@ func (f *Forward) Params(sl plugins.SecretLoader) (*params.KVs, error) { } kvs.Merge(net) } + + plugins.InsertKVString(kvs, "Host", f.Host) + plugins.InsertKVString(kvs, "Tag", f.Tag) + plugins.InsertKVString(kvs, "Shared_Key", f.SharedKey) + plugins.InsertKVString(kvs, "Self_Hostname", f.SelfHostname) + + plugins.InsertKVField(kvs, "Port", f.Port) + plugins.InsertKVField(kvs, "Empty_Shared_Key", f.EmptySharedKey) + plugins.InsertKVField(kvs, "Time_as_Integer", f.TimeAsInteger) + plugins.InsertKVField(kvs, "Send_options", f.SendOptions) + plugins.InsertKVField(kvs, "Require_ack_response", f.RequireAckResponse) + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/output/gelf_types.go b/apis/fluentbit/v1alpha2/plugins/output/gelf_types.go index 4181ed6ea..29caf59cd 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/gelf_types.go +++ b/apis/fluentbit/v1alpha2/plugins/output/gelf_types.go @@ -1,8 +1,6 @@ package output import ( - "fmt" - "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins" "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins/params" ) @@ -46,36 +44,18 @@ func (*Gelf) Name() string { func (g *Gelf) Params(sl plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if g.Host != "" { - kvs.Insert("Host", g.Host) - } - if g.Port != nil { - kvs.Insert("Port", fmt.Sprint(*g.Port)) - } - if g.Mode != "" { - kvs.Insert("Mode", g.Mode) - } - if g.ShortMessageKey != "" { - kvs.Insert("Gelf_Short_Message_Key", g.ShortMessageKey) - } - if g.TimestampKey != "" { - kvs.Insert("Gelf_Timestamp_Key", g.TimestampKey) - } - if g.HostKey != "" { - kvs.Insert("Gelf_Host_Key", g.HostKey) - } - if g.FullMessageKey != "" { - kvs.Insert("Gelf_Full_Message_Key", g.FullMessageKey) - } - if g.LevelKey != "" { - kvs.Insert("Gelf_Level_Key", g.LevelKey) - } - if g.PacketSize != nil { - kvs.Insert("Packet_Size", fmt.Sprint(*g.PacketSize)) - } - if g.Compress != nil { - kvs.Insert("Compress", fmt.Sprint(*g.Compress)) - } + + plugins.InsertKVString(kvs, "Host", g.Host) + plugins.InsertKVField(kvs, "Port", g.Port) + plugins.InsertKVString(kvs, "Mode", g.Mode) + plugins.InsertKVString(kvs, "Gelf_Short_Message_Key", g.ShortMessageKey) + plugins.InsertKVString(kvs, "Gelf_Timestamp_Key", g.TimestampKey) + plugins.InsertKVString(kvs, "Gelf_Host_Key", g.HostKey) + plugins.InsertKVString(kvs, "Gelf_Full_Message_Key", g.FullMessageKey) + plugins.InsertKVString(kvs, "Gelf_Level_Key", g.LevelKey) + plugins.InsertKVField(kvs, "Packet_Size", g.PacketSize) + plugins.InsertKVField(kvs, "Compress", g.Compress) + if g.TLS != nil { tls, err := g.TLS.Params(sl) if err != nil { @@ -90,5 +70,6 @@ func (g *Gelf) Params(sl plugins.SecretLoader) (*params.KVs, error) { } kvs.Merge(net) } + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/output/http_types.go b/apis/fluentbit/v1alpha2/plugins/output/http_types.go index 5143cb27a..9f90e732b 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/http_types.go +++ b/apis/fluentbit/v1alpha2/plugins/output/http_types.go @@ -72,69 +72,38 @@ func (*HTTP) Name() string { // implement Params method func (h *HTTP) Params(sl plugins.SecretLoader) (*params.KVs, error) { + const header = "header" + kvs := params.NewKVs() - if h.Host != "" { - kvs.Insert("host", h.Host) - } - if h.HTTPUser != nil { - u, err := sl.LoadSecret(*h.HTTPUser) - if err != nil { - return nil, err - } - kvs.Insert("http_User", u) - } - if h.HTTPPasswd != nil { - pwd, err := sl.LoadSecret(*h.HTTPPasswd) - if err != nil { - return nil, err - } - kvs.Insert("http_Passwd", pwd) - } - if h.Port != nil { - kvs.Insert("port", fmt.Sprint(*h.Port)) - } - if h.Proxy != "" { - kvs.Insert("Proxy", h.Proxy) - } - if h.Uri != "" { - kvs.Insert("uri", h.Uri) - } - if h.Compress != "" { - kvs.Insert("compress", h.Compress) - } - if h.Format != "" { - kvs.Insert("format", h.Format) - } - if h.AllowDuplicatedHeaders != nil { - kvs.Insert("allow_duplicated_headers", fmt.Sprint(*h.AllowDuplicatedHeaders)) + + if err := plugins.InsertKVSecret(kvs, "http_User", h.HTTPUser, sl); err != nil { + return nil, err } - if h.HeaderTag != "" { - kvs.Insert("header_tag", h.HeaderTag) + if err := plugins.InsertKVSecret(kvs, "http_Passwd", h.HTTPPasswd, sl); err != nil { + return nil, err } + + plugins.InsertKVString(kvs, "host", h.Host) + plugins.InsertKVField(kvs, "port", h.Port) + plugins.InsertKVString(kvs, "uri", h.Uri) + plugins.InsertKVString(kvs, "format", h.Format) + kvs.InsertStringMap(h.Headers, func(k, v string) (string, string) { return header, fmt.Sprintf(" %s %s", k, v) }) - if h.JsonDateKey != "" { - kvs.Insert("json_date_key", h.JsonDateKey) - } - if h.JsonDateFormat != "" { - kvs.Insert("json_date_format", h.JsonDateFormat) - } - if h.GelfTimestampKey != "" { - kvs.Insert("gelf_timestamp_key", h.GelfTimestampKey) - } - if h.GelfHostKey != "" { - kvs.Insert("gelf_host_key", h.GelfHostKey) - } - if h.GelfShortMessageKey != "" { - kvs.Insert("gelf_short_message_key", h.GelfShortMessageKey) - } - if h.GelfFullMessageKey != "" { - kvs.Insert("gelf_full_message_key", h.GelfFullMessageKey) - } - if h.GelfLevelKey != "" { - kvs.Insert("gelf_level_key", h.GelfLevelKey) - } + + plugins.InsertKVString(kvs, "json_date_key", h.JsonDateKey) + plugins.InsertKVString(kvs, "json_date_format", h.JsonDateFormat) + plugins.InsertKVString(kvs, "Proxy", h.Proxy) + plugins.InsertKVString(kvs, "compress", h.Compress) + plugins.InsertKVString(kvs, "header_tag", h.HeaderTag) + plugins.InsertKVString(kvs, "gelf_timestamp_key", h.GelfTimestampKey) + plugins.InsertKVString(kvs, "gelf_host_key", h.GelfHostKey) + plugins.InsertKVString(kvs, "gelf_short_message_key", h.GelfShortMessageKey) + plugins.InsertKVString(kvs, "gelf_full_message_key", h.GelfFullMessageKey) + plugins.InsertKVString(kvs, "gelf_level_key", h.GelfLevelKey) + plugins.InsertKVField(kvs, "allow_duplicated_headers", h.AllowDuplicatedHeaders) + if h.TLS != nil { tls, err := h.TLS.Params(sl) if err != nil { @@ -149,5 +118,6 @@ func (h *HTTP) Params(sl plugins.SecretLoader) (*params.KVs, error) { } kvs.Merge(net) } + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/output/influxdb_types.go b/apis/fluentbit/v1alpha2/plugins/output/influxdb_types.go index 9cd239845..c26088efa 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/influxdb_types.go +++ b/apis/fluentbit/v1alpha2/plugins/output/influxdb_types.go @@ -1,7 +1,6 @@ package output import ( - "fmt" "strings" "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins" @@ -53,61 +52,32 @@ func (*InfluxDB) Name() string { func (o *InfluxDB) Params(sl plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - // InfluxDB Validation - if o.HTTPToken != nil { - } - if o.Host != "" { - kvs.Insert("Host", o.Host) - } - if o.Port != nil { - kvs.Insert("Port", fmt.Sprint(*o.Port)) - } - if o.Database != "" { - kvs.Insert("Database", o.Database) - } - if o.Bucket != "" { - kvs.Insert("Bucket", o.Bucket) - } - if o.Org != "" { - kvs.Insert("Org", o.Org) - } - if o.SequenceTag != "" { - kvs.Insert("Sequence_Tag", o.SequenceTag) - } - if o.HTTPUser != nil { - u, err := sl.LoadSecret(*o.HTTPUser) - if err != nil { - return nil, err - } - kvs.Insert("HTTP_User", u) - } - if o.HTTPPasswd != nil { - pwd, err := sl.LoadSecret(*o.HTTPPasswd) - if err != nil { - return nil, err - } - kvs.Insert("HTTP_Passwd", pwd) - } - if o.HTTPToken != nil { - pwd, err := sl.LoadSecret(*o.HTTPToken) - if err != nil { - return nil, err - } - kvs.Insert("HTTP_Token", pwd) - } - if o.TagKeys != nil { + plugins.InsertKVString(kvs, "Host", o.Host) + plugins.InsertKVField(kvs, "Port", o.Port) + plugins.InsertKVString(kvs, "Database", o.Database) + plugins.InsertKVString(kvs, "Bucket", o.Bucket) + plugins.InsertKVString(kvs, "Org", o.Org) + plugins.InsertKVString(kvs, "Sequence_Tag", o.SequenceTag) + + if len(o.TagKeys) > 0 { kvs.Insert("Tag_Keys", strings.Join(o.TagKeys, " ")) } - if o.AutoTags != nil { - kvs.Insert("Auto_Tags", fmt.Sprint(*o.AutoTags)) + + plugins.InsertKVField(kvs, "Auto_Tags", o.AutoTags) + plugins.InsertKVField(kvs, "Tags_List_Enabled", o.TagsListEnabled) + plugins.InsertKVString(kvs, "Tags_List_Key", o.TagsListKey) + + if err := plugins.InsertKVSecret(kvs, "HTTP_User", o.HTTPUser, sl); err != nil { + return nil, err } - if o.TagsListEnabled != nil { - kvs.Insert("Tags_List_Enabled", fmt.Sprint(*o.TagsListEnabled)) + if err := plugins.InsertKVSecret(kvs, "HTTP_Passwd", o.HTTPPasswd, sl); err != nil { + return nil, err } - if o.TagsListKey != "" { - kvs.Insert("Tags_List_Key", o.TagsListKey) + if err := plugins.InsertKVSecret(kvs, "HTTP_Token", o.HTTPToken, sl); err != nil { + return nil, err } + if o.TLS != nil { tls, err := o.TLS.Params(sl) if err != nil { @@ -122,5 +92,6 @@ func (o *InfluxDB) Params(sl plugins.SecretLoader) (*params.KVs, error) { } kvs.Merge(net) } + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/output/loki_types.go b/apis/fluentbit/v1alpha2/plugins/output/loki_types.go index 56724683a..4c1709f59 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/loki_types.go +++ b/apis/fluentbit/v1alpha2/plugins/output/loki_types.go @@ -81,43 +81,45 @@ func (*Loki) Name() string { // implement Section() method func (l *Loki) Params(sl plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if l.Host != "" { - kvs.Insert("host", l.Host) + + if err := plugins.InsertKVSecret(kvs, "http_user", l.HTTPUser, sl); err != nil { + return nil, err } - if l.Port != nil { - kvs.Insert("port", fmt.Sprint(*l.Port)) + if err := plugins.InsertKVSecret(kvs, "http_passwd", l.HTTPPasswd, sl); err != nil { + return nil, err } - if l.Uri != "" { - kvs.Insert("uri", l.Uri) + if err := plugins.InsertKVSecret(kvs, "bearer_token", l.BearerToken, sl); err != nil { + return nil, err } - if l.HTTPUser != nil { - u, err := sl.LoadSecret(*l.HTTPUser) - if err != nil { - return nil, err - } - kvs.Insert("http_user", u) + if err := plugins.InsertKVSecret(kvs, "tenant_id", l.TenantID, sl); err != nil { + return nil, err } - if l.HTTPPasswd != nil { - pwd, err := sl.LoadSecret(*l.HTTPPasswd) - if err != nil { - return nil, err - } - kvs.Insert("http_passwd", pwd) - } - if l.BearerToken != nil { - bearerToken, err := sl.LoadSecret(*l.BearerToken) + if l.TLS != nil { + tls, err := l.TLS.Params(sl) if err != nil { return nil, err } - kvs.Insert("bearer_token", bearerToken) + kvs.Merge(tls) } - if l.TenantID != nil { - id, err := sl.LoadSecret(*l.TenantID) + if l.Networking != nil { + net, err := l.Networking.Params(sl) if err != nil { return nil, err } - kvs.Insert("tenant_id", id) + kvs.Merge(net) } + + plugins.InsertKVString(kvs, "host", l.Host) + plugins.InsertKVString(kvs, "uri", l.Uri) + plugins.InsertKVString(kvs, "label_map_path", l.LabelMapPath) + plugins.InsertKVString(kvs, "drop_single_key", l.DropSingleKey) + plugins.InsertKVString(kvs, "line_format", l.LineFormat) + plugins.InsertKVString(kvs, "auto_kubernetes_labels", l.AutoKubernetesLabels) + plugins.InsertKVString(kvs, "tenant_id_key", l.TenantIDKey) + plugins.InsertKVString(kvs, "storage.total_limit_size", l.TotalLimitSize) + + plugins.InsertKVField(kvs, "port", l.Port) + plugins.InsertKVField(kvs, "workers", l.Workers) if len(l.Labels) > 0 { // Sort labels to ensure deterministic output sortedLabels := make([]string, len(l.Labels)) @@ -142,28 +144,14 @@ func (l *Loki) Params(sl plugins.SecretLoader) (*params.KVs, error) { kvs.Insert("labels", strings.Join(sortedLabels, ",")) } + if len(l.LabelKeys) > 0 { kvs.Insert("label_keys", strings.Join(l.LabelKeys, ",")) } - if l.LabelMapPath != "" { - kvs.Insert("label_map_path", l.LabelMapPath) - } if len(l.RemoveKeys) > 0 { kvs.Insert("remove_keys", strings.Join(l.RemoveKeys, ",")) } - if l.DropSingleKey != "" { - kvs.Insert("drop_single_key", l.DropSingleKey) - } - if l.LineFormat != "" { - kvs.Insert("line_format", l.LineFormat) - } - if l.AutoKubernetesLabels != "" { - kvs.Insert("auto_kubernetes_labels", l.AutoKubernetesLabels) - } - if l.TenantIDKey != "" { - kvs.Insert("tenant_id_key", l.TenantIDKey) - } - // Handle structured metadata + if len(l.StructuredMetadata) > 0 { var metadataPairs []string for k, v := range l.StructuredMetadata { @@ -174,29 +162,10 @@ func (l *Loki) Params(sl plugins.SecretLoader) (*params.KVs, error) { kvs.Insert("structured_metadata", strings.Join(metadataPairs, ",")) } } - // Handle structured metadata keys + if len(l.StructuredMetadataKeys) > 0 { kvs.Insert("structured_metadata_keys", strings.Join(l.StructuredMetadataKeys, ",")) } - if l.TLS != nil { - tls, err := l.TLS.Params(sl) - if err != nil { - return nil, err - } - kvs.Merge(tls) - } - if l.Networking != nil { - net, err := l.Networking.Params(sl) - if err != nil { - return nil, err - } - kvs.Merge(net) - } - if l.TotalLimitSize != "" { - kvs.Insert("storage.total_limit_size", l.TotalLimitSize) - } - if l.Workers != nil { - kvs.Insert("workers", fmt.Sprint(*l.Workers)) - } + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/output/open_search_types.go b/apis/fluentbit/v1alpha2/plugins/output/open_search_types.go index dcf02ee16..454a8c5c2 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/open_search_types.go +++ b/apis/fluentbit/v1alpha2/plugins/output/open_search_types.go @@ -1,8 +1,6 @@ package output import ( - "fmt" - "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins" "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins/params" ) @@ -111,110 +109,48 @@ func (*OpenSearch) Name() string { // Params implement Section() method func (o *OpenSearch) Params(sl plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if o.Host != "" { - kvs.Insert("Host", o.Host) - } - if o.Port != nil { - kvs.Insert("Port", fmt.Sprint(*o.Port)) - } - if o.Path != "" { - kvs.Insert("Path", o.Path) - } - if o.BufferSize != "" { - kvs.Insert("Buffer_Size", o.BufferSize) - } - if o.Pipeline != "" { - kvs.Insert("Pipeline", o.Pipeline) - } - if o.AWSAuth != "" { - kvs.Insert("AWS_Auth", o.AWSAuth) - } - if o.AWSRegion != "" { - kvs.Insert("AWS_Region", o.AWSRegion) - } - if o.AWSSTSEndpoint != "" { - kvs.Insert("AWS_STS_Endpoint", o.AWSSTSEndpoint) - } - if o.AWSRoleARN != "" { - kvs.Insert("AWS_Role_ARN", o.AWSRoleARN) - } - if o.AWSExternalID != "" { - kvs.Insert("AWS_External_ID", o.AWSExternalID) - } - if o.HTTPUser != nil { - u, err := sl.LoadSecret(*o.HTTPUser) - if err != nil { - return nil, err - } - kvs.Insert("HTTP_User", u) - } - if o.HTTPPasswd != nil { - pwd, err := sl.LoadSecret(*o.HTTPPasswd) - if err != nil { - return nil, err - } - kvs.Insert("HTTP_Passwd", pwd) - } - if o.Index != "" { - kvs.Insert("Index", o.Index) - } - if o.Type != "" { - kvs.Insert("Type", o.Type) - } - if o.LogstashFormat != nil { - kvs.Insert("Logstash_Format", fmt.Sprint(*o.LogstashFormat)) - } - if o.LogstashPrefix != "" { - kvs.Insert("Logstash_Prefix", o.LogstashPrefix) - } - if o.LogstashDateFormat != "" { - kvs.Insert("Logstash_DateFormat", o.LogstashDateFormat) - } - if o.TimeKey != "" { - kvs.Insert("Time_Key", o.TimeKey) - } - if o.TimeKeyFormat != "" { - kvs.Insert("Time_Key_Format", o.TimeKeyFormat) - } - if o.TimeKeyNanos != nil { - kvs.Insert("Time_Key_Nanos", fmt.Sprint(*o.TimeKeyNanos)) - } - if o.IncludeTagKey != nil { - kvs.Insert("Include_Tag_Key", fmt.Sprint(*o.IncludeTagKey)) - } - if o.TagKey != "" { - kvs.Insert("Tag_Key", o.TagKey) - } - if o.GenerateID != nil { - kvs.Insert("Generate_ID", fmt.Sprint(*o.GenerateID)) - } - if o.IdKey != "" { - kvs.Insert("ID_KEY", o.IdKey) - } - if o.WriteOperation != "" { - kvs.Insert("Write_Operation", o.WriteOperation) - } - if o.ReplaceDots != nil { - kvs.Insert("Replace_Dots", fmt.Sprint(*o.ReplaceDots)) - } - if o.TraceOutput != nil { - kvs.Insert("Trace_Output", fmt.Sprint(*o.TraceOutput)) - } - if o.TraceError != nil { - kvs.Insert("Trace_Error", fmt.Sprint(*o.TraceError)) - } - if o.CurrentTimeIndex != nil { - kvs.Insert("Current_Time_Index", fmt.Sprint(*o.CurrentTimeIndex)) - } - if o.LogstashPrefixKey != "" { - kvs.Insert("Logstash_Prefix_Key", o.LogstashPrefixKey) - } - if o.SuppressTypeName != nil { - kvs.Insert("Suppress_Type_Name", fmt.Sprint(*o.SuppressTypeName)) + + if err := plugins.InsertKVSecret(kvs, "HTTP_User", o.HTTPUser, sl); err != nil { + return nil, err } - if o.Workers != nil { - kvs.Insert("Workers", fmt.Sprint(*o.Workers)) + if err := plugins.InsertKVSecret(kvs, "HTTP_Passwd", o.HTTPPasswd, sl); err != nil { + return nil, err } + + plugins.InsertKVString(kvs, "Host", o.Host) + plugins.InsertKVField(kvs, "Port", o.Port) + plugins.InsertKVString(kvs, "Index", o.Index) + plugins.InsertKVString(kvs, "Type", o.Type) + plugins.InsertKVString(kvs, "Path", o.Path) + plugins.InsertKVString(kvs, "Buffer_Size", o.BufferSize) + plugins.InsertKVString(kvs, "Pipeline", o.Pipeline) + plugins.InsertKVString(kvs, "AWS_Auth", o.AWSAuth) + plugins.InsertKVString(kvs, "AWS_Region", o.AWSRegion) + plugins.InsertKVString(kvs, "AWS_STS_Endpoint", o.AWSSTSEndpoint) + plugins.InsertKVString(kvs, "AWS_Role_ARN", o.AWSRoleARN) + plugins.InsertKVString(kvs, "AWS_External_ID", o.AWSExternalID) + plugins.InsertKVString(kvs, "Logstash_Prefix", o.LogstashPrefix) + plugins.InsertKVString(kvs, "Logstash_DateFormat", o.LogstashDateFormat) + plugins.InsertKVString(kvs, "Time_Key", o.TimeKey) + plugins.InsertKVString(kvs, "Time_Key_Format", o.TimeKeyFormat) + plugins.InsertKVString(kvs, "Tag_Key", o.TagKey) + plugins.InsertKVString(kvs, "ID_KEY", o.IdKey) + plugins.InsertKVString(kvs, "Write_Operation", o.WriteOperation) + plugins.InsertKVString(kvs, "Logstash_Prefix_Key", o.LogstashPrefixKey) + plugins.InsertKVString(kvs, "storage.total_limit_size", o.TotalLimitSize) + plugins.InsertKVString(kvs, "Compress", o.Compress) + + plugins.InsertKVField(kvs, "Logstash_Format", o.LogstashFormat) + plugins.InsertKVField(kvs, "Time_Key_Nanos", o.TimeKeyNanos) + plugins.InsertKVField(kvs, "Include_Tag_Key", o.IncludeTagKey) + plugins.InsertKVField(kvs, "Generate_ID", o.GenerateID) + plugins.InsertKVField(kvs, "Replace_Dots", o.ReplaceDots) + plugins.InsertKVField(kvs, "Trace_Output", o.TraceOutput) + plugins.InsertKVField(kvs, "Trace_Error", o.TraceError) + plugins.InsertKVField(kvs, "Current_Time_Index", o.CurrentTimeIndex) + plugins.InsertKVField(kvs, "Suppress_Type_Name", o.SuppressTypeName) + plugins.InsertKVField(kvs, "Workers", o.Workers) + if o.TLS != nil { tls, err := o.TLS.Params(sl) if err != nil { @@ -229,8 +165,6 @@ func (o *OpenSearch) Params(sl plugins.SecretLoader) (*params.KVs, error) { } kvs.Merge(net) } - if o.TotalLimitSize != "" { - kvs.Insert("storage.total_limit_size", o.TotalLimitSize) - } + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/output/open_telemetry_types.go b/apis/fluentbit/v1alpha2/plugins/output/open_telemetry_types.go index fa11b9106..1d34323b2 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/open_telemetry_types.go +++ b/apis/fluentbit/v1alpha2/plugins/output/open_telemetry_types.go @@ -53,54 +53,38 @@ func (*OpenTelemetry) Name() string { // Params implement Section() method func (o *OpenTelemetry) Params(sl plugins.SecretLoader) (*params.KVs, error) { + const ADD_LABEL = "add_label" + kvs := params.NewKVs() - if o.Host != "" { - kvs.Insert("host", o.Host) - } - if o.Port != nil { - kvs.Insert("port", fmt.Sprint(*o.Port)) - } - if o.HTTPUser != nil { - u, err := sl.LoadSecret(*o.HTTPUser) - if err != nil { - return nil, err - } - kvs.Insert("http_user", u) - } - if o.HTTPPasswd != nil { - pwd, err := sl.LoadSecret(*o.HTTPPasswd) - if err != nil { - return nil, err - } - kvs.Insert("http_passwd", pwd) - } - if o.Proxy != "" { - kvs.Insert("proxy", o.Proxy) - } - if o.MetricsUri != "" { - kvs.Insert("metrics_uri", o.MetricsUri) - } - if o.LogsUri != "" { - kvs.Insert("logs_uri", o.LogsUri) + + plugins.InsertKVString(kvs, "host", o.Host) + plugins.InsertKVField(kvs, "port", o.Port) + + if err := plugins.InsertKVSecret(kvs, "http_user", o.HTTPUser, sl); err != nil { + return nil, err } - if o.TracesUri != "" { - kvs.Insert("traces_uri", o.TracesUri) + if err := plugins.InsertKVSecret(kvs, "http_passwd", o.HTTPPasswd, sl); err != nil { + return nil, err } + + plugins.InsertKVString(kvs, "proxy", o.Proxy) + plugins.InsertKVString(kvs, "metrics_uri", o.MetricsUri) + plugins.InsertKVString(kvs, "logs_uri", o.LogsUri) + plugins.InsertKVString(kvs, "traces_uri", o.TracesUri) + kvs.InsertStringMap(o.Header, func(k, v string) (string, string) { return header, fmt.Sprintf(" %s %s", k, v) }) - if o.LogResponsePayload != nil { - kvs.Insert("log_response_payload", fmt.Sprint(*o.LogResponsePayload)) - } + + plugins.InsertKVField(kvs, "log_response_payload", o.LogResponsePayload) + kvs.InsertStringMap(o.AddLabel, func(k, v string) (string, string) { return addLabel, fmt.Sprintf(" %s %s", k, v) }) - if o.LogsBodyKeyAttributes != nil { - kvs.Insert("logs_body_key_attributes", fmt.Sprint(*o.LogsBodyKeyAttributes)) - } - if o.LogsBodyKey != "" { - kvs.Insert("logs_body_key", o.LogsBodyKey) - } + + plugins.InsertKVField(kvs, "logs_body_key_attributes", o.LogsBodyKeyAttributes) + plugins.InsertKVString(kvs, "logs_body_key", o.LogsBodyKey) + if o.TLS != nil { tls, err := o.TLS.Params(sl) if err != nil { @@ -115,5 +99,6 @@ func (o *OpenTelemetry) Params(sl plugins.SecretLoader) (*params.KVs, error) { } kvs.Merge(net) } + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/output/prometheus_exporter.go b/apis/fluentbit/v1alpha2/plugins/output/prometheus_exporter.go index 727e1561e..97b1de508 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/prometheus_exporter.go +++ b/apis/fluentbit/v1alpha2/plugins/output/prometheus_exporter.go @@ -32,12 +32,10 @@ func (*PrometheusExporter) Name() string { // implement Section() method func (p *PrometheusExporter) Params(sl plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if p.Host != "" { - kvs.Insert("host", p.Host) - } - if p.Port != nil { - kvs.Insert("port", fmt.Sprint(*p.Port)) - } + + plugins.InsertKVString(kvs, "Host", p.Host) + plugins.InsertKVField(kvs, "Port", p.Port) + kvs.InsertStringMap(p.AddLabels, func(k, v string) (string, string) { return addLabel, fmt.Sprintf(" %s %s", k, v) }) diff --git a/apis/fluentbit/v1alpha2/plugins/output/prometheus_remote_write_types.go b/apis/fluentbit/v1alpha2/plugins/output/prometheus_remote_write_types.go index 74e4b79cf..71f3c0362 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/prometheus_remote_write_types.go +++ b/apis/fluentbit/v1alpha2/plugins/output/prometheus_remote_write_types.go @@ -51,45 +51,31 @@ func (*PrometheusRemoteWrite) Name() string { // implement Section() method func (p *PrometheusRemoteWrite) Params(sl plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if p.Host != "" { - kvs.Insert("host", p.Host) - } - if p.Port != nil { - kvs.Insert("port", fmt.Sprint(*p.Port)) - } - if p.HTTPUser != nil { - u, err := sl.LoadSecret(*p.HTTPUser) - if err != nil { - return nil, err - } - kvs.Insert("http_user", u) - } - if p.HTTPPasswd != nil { - pwd, err := sl.LoadSecret(*p.HTTPPasswd) - if err != nil { - return nil, err - } - kvs.Insert("http_passwd", pwd) - } - if p.Proxy != "" { - kvs.Insert("proxy", p.Proxy) + + if err := plugins.InsertKVSecret(kvs, "http_user", p.HTTPUser, sl); err != nil { + return nil, err } - if p.URI != "" { - kvs.Insert("uri", p.URI) + if err := plugins.InsertKVSecret(kvs, "http_passwd", p.HTTPPasswd, sl); err != nil { + return nil, err } + + plugins.InsertKVString(kvs, "host", p.Host) + plugins.InsertKVField(kvs, "port", p.Port) + plugins.InsertKVString(kvs, "proxy", p.Proxy) + plugins.InsertKVString(kvs, "uri", p.URI) + kvs.InsertStringMap(p.Headers, func(k, v string) (string, string) { return header, fmt.Sprintf(" %s %s", k, v) }) - if p.LogResponsePayload != nil { - kvs.Insert("log_response_payload", fmt.Sprint(*p.LogResponsePayload)) - } + plugins.InsertKVField(kvs, "log_response_payload", p.LogResponsePayload) + kvs.InsertStringMap(p.AddLabels, func(k, v string) (string, string) { return addLabel, fmt.Sprintf(" %s %s", k, v) }) - if p.Workers != nil { - kvs.Insert("workers", fmt.Sprint(*p.Workers)) - } + + plugins.InsertKVField(kvs, "workers", p.Workers) + if p.TLS != nil { tls, err := p.TLS.Params(sl) if err != nil { @@ -104,5 +90,6 @@ func (p *PrometheusRemoteWrite) Params(sl plugins.SecretLoader) (*params.KVs, er } kvs.Merge(net) } + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/output/s3_types.go b/apis/fluentbit/v1alpha2/plugins/output/s3_types.go index fb857a116..f4d9deec4 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/s3_types.go +++ b/apis/fluentbit/v1alpha2/plugins/output/s3_types.go @@ -1,8 +1,6 @@ package output import ( - "fmt" - "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins" "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins/params" ) @@ -78,92 +76,36 @@ func (*S3) Name() string { func (o *S3) Params(sl plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - // S3 Validation - if o.Region != "" { - kvs.Insert("region", o.Region) - } - if o.Bucket != "" { - kvs.Insert("bucket", o.Bucket) - } - if o.JsonDateKey != "" { - kvs.Insert("json_date_key", o.JsonDateKey) - } - if o.JsonDateFormat != "" { - kvs.Insert("json_date_format", o.JsonDateFormat) - } - if o.TotalFileSize != "" { - kvs.Insert("total_file_size", o.TotalFileSize) - } - if o.UploadChunkSize != "" { - kvs.Insert("upload_chunk_size", o.UploadChunkSize) - } - if o.UploadTimeout != "" { - kvs.Insert("upload_timeout", o.UploadTimeout) - } - if o.StoreDir != "" { - kvs.Insert("store_dir", o.StoreDir) - } - if o.StoreDirLimitSize != "" { - kvs.Insert("store_dir_limit_size", o.StoreDirLimitSize) - } - if o.S3KeyFormat != "" { - kvs.Insert("s3_key_format", o.S3KeyFormat) - } - if o.S3KeyFormatTagDelimiters != "" { - kvs.Insert("s3_key_format_tag_delimiters", o.S3KeyFormatTagDelimiters) - } - if o.StaticFilePath != nil { - kvs.Insert("static_file_path", fmt.Sprint(*o.StaticFilePath)) - } - if o.UsePutObject != nil { - kvs.Insert("use_put_object", fmt.Sprint(*o.UsePutObject)) - } - if o.RoleArn != "" { - kvs.Insert("role_arn", o.RoleArn) - } - if o.Endpoint != "" { - kvs.Insert("endpoint", o.Endpoint) - } - if o.StsEndpoint != "" { - kvs.Insert("sts_endpoint", o.StsEndpoint) - } - if o.CannedAcl != "" { - kvs.Insert("canned_acl", o.CannedAcl) - } - if o.Compression != "" { - kvs.Insert("compression", o.Compression) - } - if o.ContentType != "" { - kvs.Insert("content_type", o.ContentType) - } - if o.SendContentMd5 != nil { - kvs.Insert("send_content_md5", fmt.Sprint(*o.SendContentMd5)) - } - if o.AutoRetryRequests != nil { - kvs.Insert("auto_retry_requests", fmt.Sprint(*o.AutoRetryRequests)) - } - if o.LogKey != "" { - kvs.Insert("log_key", o.LogKey) - } - if o.PreserveDataOrdering != nil { - kvs.Insert("preserve_data_ordering", fmt.Sprint(*o.PreserveDataOrdering)) - } - if o.StorageClass != "" { - kvs.Insert("storage_class", o.StorageClass) - } - if o.RetryLimit != nil { - kvs.Insert("retry_limit", fmt.Sprint(*o.RetryLimit)) - } - if o.ExternalId != "" { - kvs.Insert("external_id", o.ExternalId) - } - if o.Profile != "" { - kvs.Insert("profile", o.Profile) - } - if o.Workers != nil { - kvs.Insert("workers", fmt.Sprint(*o.Workers)) - } + plugins.InsertKVString(kvs, "region", o.Region) + plugins.InsertKVString(kvs, "bucket", o.Bucket) + plugins.InsertKVString(kvs, "json_date_key", o.JsonDateKey) + plugins.InsertKVString(kvs, "json_date_format", o.JsonDateFormat) + plugins.InsertKVString(kvs, "total_file_size", o.TotalFileSize) + plugins.InsertKVString(kvs, "upload_chunk_size", o.UploadChunkSize) + plugins.InsertKVString(kvs, "upload_timeout", o.UploadTimeout) + plugins.InsertKVString(kvs, "store_dir", o.StoreDir) + plugins.InsertKVString(kvs, "store_dir_limit_size", o.StoreDirLimitSize) + plugins.InsertKVString(kvs, "s3_key_format", o.S3KeyFormat) + plugins.InsertKVString(kvs, "s3_key_format_tag_delimiters", o.S3KeyFormatTagDelimiters) + plugins.InsertKVField(kvs, "static_file_path", o.StaticFilePath) + plugins.InsertKVField(kvs, "use_put_object", o.UsePutObject) + plugins.InsertKVString(kvs, "role_arn", o.RoleArn) + plugins.InsertKVString(kvs, "endpoint", o.Endpoint) + plugins.InsertKVString(kvs, "sts_endpoint", o.StsEndpoint) + plugins.InsertKVString(kvs, "canned_acl", o.CannedAcl) + plugins.InsertKVString(kvs, "compression", o.Compression) + plugins.InsertKVString(kvs, "content_type", o.ContentType) + plugins.InsertKVField(kvs, "send_content_md5", o.SendContentMd5) + plugins.InsertKVField(kvs, "auto_retry_requests", o.AutoRetryRequests) + plugins.InsertKVString(kvs, "log_key", o.LogKey) + plugins.InsertKVField(kvs, "preserve_data_ordering", o.PreserveDataOrdering) + plugins.InsertKVString(kvs, "storage_class", o.StorageClass) + plugins.InsertKVField(kvs, "retry_limit", o.RetryLimit) + plugins.InsertKVString(kvs, "external_id", o.ExternalId) + plugins.InsertKVString(kvs, "profile", o.Profile) + plugins.InsertKVField(kvs, "workers", o.Workers) + if o.TLS != nil { tls, err := o.TLS.Params(sl) if err != nil { @@ -171,5 +113,6 @@ func (o *S3) Params(sl plugins.SecretLoader) (*params.KVs, error) { } kvs.Merge(tls) } + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/output/splunk_types.go b/apis/fluentbit/v1alpha2/plugins/output/splunk_types.go index 817092dc4..56075a22e 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/splunk_types.go +++ b/apis/fluentbit/v1alpha2/plugins/output/splunk_types.go @@ -1,8 +1,6 @@ package output import ( - "fmt" - "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins" "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins/params" ) @@ -73,76 +71,15 @@ func (*Splunk) Name() string { // Params implement Section() method func (o *Splunk) Params(sl plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if o.Host != "" { - kvs.Insert("host", o.Host) - } - if o.Port != nil { - kvs.Insert("port", fmt.Sprint(*o.Port)) - } - if o.SplunkToken != nil { - u, err := sl.LoadSecret(*o.SplunkToken) - if err != nil { - return nil, err - } - kvs.Insert("splunk_token", u) - } - if o.HTTPBufferSize != "" { - kvs.Insert("http_buffer_size", o.HTTPBufferSize) - } - if o.HTTPUser != nil { - u, err := sl.LoadSecret(*o.HTTPUser) - if err != nil { - return nil, err - } - kvs.Insert("http_user", u) - } - if o.HTTPPasswd != nil { - pwd, err := sl.LoadSecret(*o.HTTPPasswd) - if err != nil { - return nil, err - } - kvs.Insert("http_passwd", pwd) - } - if o.Compress != "" { - kvs.Insert("compress", o.Compress) - } - if o.Channel != "" { - kvs.Insert("channel", o.Channel) - } - if o.HTTPDebugBadRequest != nil { - kvs.Insert("http_debug_bad_request", fmt.Sprint(*o.HTTPDebugBadRequest)) - } - if o.SplunkSendRaw != nil { - kvs.Insert("splunk_send_raw", fmt.Sprint(*o.SplunkSendRaw)) - } - if o.EventKey != "" { - kvs.Insert("event_key", o.EventKey) - } - if o.EventHost != "" { - kvs.Insert("event_host", o.EventHost) - } - if o.EventSource != "" { - kvs.Insert("event_source", o.EventSource) - } - if o.EventSourcetype != "" { - kvs.Insert("event_sourcetype", o.EventSourcetype) - } - if o.EventSourcetypeKey != "" { - kvs.Insert("event_sourcetype_key", o.EventSourcetypeKey) - } - if o.EventIndex != "" { - kvs.Insert("event_index", o.EventIndex) - } - if o.EventIndexKey != "" { - kvs.Insert("event_index_key", o.EventIndexKey) + + if err := plugins.InsertKVSecret(kvs, "splunk_token", o.SplunkToken, sl); err != nil { + return nil, err } - if len(o.EventFields) > 0 { - for _, v := range o.EventFields { - kvs.Insert("event_field", v) - } + if err := plugins.InsertKVSecret(kvs, "http_user", o.HTTPUser, sl); err != nil { + return nil, err } - if o.Workers != nil { - kvs.Insert("workers", fmt.Sprint(*o.Workers)) + if err := plugins.InsertKVSecret(kvs, "http_passwd", o.HTTPPasswd, sl); err != nil { + return nil, err } if o.TLS != nil { tls, err := o.TLS.Params(sl) @@ -158,5 +95,29 @@ func (o *Splunk) Params(sl plugins.SecretLoader) (*params.KVs, error) { } kvs.Merge(net) } + + plugins.InsertKVString(kvs, "host", o.Host) + plugins.InsertKVString(kvs, "http_buffer_size", o.HTTPBufferSize) + plugins.InsertKVString(kvs, "compress", o.Compress) + plugins.InsertKVString(kvs, "channel", o.Channel) + plugins.InsertKVString(kvs, "event_key", o.EventKey) + plugins.InsertKVString(kvs, "event_host", o.EventHost) + plugins.InsertKVString(kvs, "event_source", o.EventSource) + plugins.InsertKVString(kvs, "event_sourcetype", o.EventSourcetype) + plugins.InsertKVString(kvs, "event_sourcetype_key", o.EventSourcetypeKey) + plugins.InsertKVString(kvs, "event_index", o.EventIndex) + plugins.InsertKVString(kvs, "event_index_key", o.EventIndexKey) + + plugins.InsertKVField(kvs, "port", o.Port) + plugins.InsertKVField(kvs, "http_debug_bad_request", o.HTTPDebugBadRequest) + plugins.InsertKVField(kvs, "splunk_send_raw", o.SplunkSendRaw) + plugins.InsertKVField(kvs, "workers", o.Workers) + + if len(o.EventFields) > 0 { + for _, v := range o.EventFields { + kvs.Insert("event_field", v) + } + } + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/output/stackdriver_types.go b/apis/fluentbit/v1alpha2/plugins/output/stackdriver_types.go index bb1ff2aa0..fc3172afd 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/stackdriver_types.go +++ b/apis/fluentbit/v1alpha2/plugins/output/stackdriver_types.go @@ -1,7 +1,6 @@ package output import ( - "fmt" "strings" "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins" @@ -67,79 +66,40 @@ func (*Stackdriver) Name() string { // Params implement Section() method func (o *Stackdriver) Params(sl plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if o.GoogleServiceCredentials != "" { - kvs.Insert("google_service_credentials", o.GoogleServiceCredentials) - } - if o.ServiceAccountEmail != nil { - u, err := sl.LoadSecret(*o.ServiceAccountEmail) - if err != nil { - return nil, err - } - kvs.Insert("service_account_email", u) - } - if o.ServiceAccountSecret != nil { - u, err := sl.LoadSecret(*o.ServiceAccountSecret) - if err != nil { - return nil, err - } - kvs.Insert("service_account_secret", u) - } - if o.MetadataServer != "" { - kvs.Insert("metadata_server", o.MetadataServer) - } - if o.Location != "" { - kvs.Insert("location", o.Location) - } - if o.Namespace != "" { - kvs.Insert("namespace", o.Namespace) - } - if o.NodeID != "" { - kvs.Insert("node_id", o.NodeID) - } - if o.Job != "" { - kvs.Insert("job", o.Job) - } - if o.TaskID != "" { - kvs.Insert("task_id", o.TaskID) - } - if o.ExportToProjectID != "" { - kvs.Insert("export_to_project_id", o.ExportToProjectID) - } - if o.Resource != "" { - kvs.Insert("resource", o.Resource) - } - if o.K8sClusterName != "" { - kvs.Insert("k8s_cluster_name", o.K8sClusterName) - } - if o.K8sClusterLocation != "" { - kvs.Insert("k8s_cluster_location", o.K8sClusterLocation) + + if err := plugins.InsertKVSecret(kvs, "service_account_email", o.ServiceAccountEmail, sl); err != nil { + return nil, err } - if o.LabelsKey != "" { - kvs.Insert("labels_key", o.LabelsKey) + if err := plugins.InsertKVSecret(kvs, "service_account_secret", o.ServiceAccountSecret, sl); err != nil { + return nil, err } + + plugins.InsertKVString(kvs, "google_service_credentials", o.GoogleServiceCredentials) + plugins.InsertKVString(kvs, "metadata_server", o.MetadataServer) + plugins.InsertKVString(kvs, "location", o.Location) + plugins.InsertKVString(kvs, "namespace", o.Namespace) + plugins.InsertKVString(kvs, "node_id", o.NodeID) + plugins.InsertKVString(kvs, "job", o.Job) + plugins.InsertKVString(kvs, "task_id", o.TaskID) + plugins.InsertKVString(kvs, "export_to_project_id", o.ExportToProjectID) + plugins.InsertKVString(kvs, "resource", o.Resource) + plugins.InsertKVString(kvs, "k8s_cluster_name", o.K8sClusterName) + plugins.InsertKVString(kvs, "k8s_cluster_location", o.K8sClusterLocation) + plugins.InsertKVString(kvs, "labels_key", o.LabelsKey) + plugins.InsertKVString(kvs, "log_name_key", o.LogNameKey) + plugins.InsertKVString(kvs, "tag_prefix", o.TagPrefix) + plugins.InsertKVString(kvs, "severity_key", o.SeverityKey) + plugins.InsertKVString(kvs, "custom_k8s_regex", o.CustomK8sRegex) + + plugins.InsertKVField(kvs, "autoformat_stackdriver_trace", o.AutoformatStackdriverTrace) + plugins.InsertKVField(kvs, "workers", o.Workers) + if len(o.Labels) > 0 { kvs.Insert("labels", strings.Join(o.Labels, ",")) } - if o.LogNameKey != "" { - kvs.Insert("log_name_key", o.LogNameKey) - } - if o.TagPrefix != "" { - kvs.Insert("tag_prefix", o.TagPrefix) - } - if o.SeverityKey != "" { - kvs.Insert("severity_key", o.SeverityKey) - } - if o.AutoformatStackdriverTrace != nil { - kvs.Insert("autoformat_stackdriver_trace", fmt.Sprint(*o.AutoformatStackdriverTrace)) - } - if o.Workers != nil { - kvs.Insert("Workers", fmt.Sprint(*o.Workers)) - } - if o.CustomK8sRegex != "" { - kvs.Insert("custom_k8s_regex", o.CustomK8sRegex) - } if len(o.ResourceLabels) > 0 { kvs.Insert("resource_labels", strings.Join(o.ResourceLabels, ",")) } + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/output/stdout_types.go b/apis/fluentbit/v1alpha2/plugins/output/stdout_types.go index 635686575..9aea20d90 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/stdout_types.go +++ b/apis/fluentbit/v1alpha2/plugins/output/stdout_types.go @@ -27,14 +27,10 @@ func (*Stdout) Name() string { // implement Section() method func (s *Stdout) Params(_ plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if s.Format != "" { - kvs.Insert("Format", s.Format) - } - if s.JsonDateKey != "" { - kvs.Insert("json_date_key", s.JsonDateKey) - } - if s.JsonDateFormat != "" { - kvs.Insert("json_date_format", s.JsonDateFormat) - } + + plugins.InsertKVString(kvs, "Format", s.Format) + plugins.InsertKVString(kvs, "json_date_key", s.JsonDateKey) + plugins.InsertKVString(kvs, "json_date_format", s.JsonDateFormat) + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/output/syslog_types.go b/apis/fluentbit/v1alpha2/plugins/output/syslog_types.go index 883a33e5e..ec3bb1e69 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/syslog_types.go +++ b/apis/fluentbit/v1alpha2/plugins/output/syslog_types.go @@ -1,8 +1,6 @@ package output import ( - "fmt" - "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins" "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins/params" ) @@ -56,45 +54,22 @@ func (*Syslog) Name() string { // implement Section() method func (s *Syslog) Params(sl plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if s.Host != "" { - kvs.Insert("Host", s.Host) - } - if s.Port != nil { - kvs.Insert("port", fmt.Sprint(*s.Port)) - } - if s.Mode != "" { - kvs.Insert("mode", s.Mode) - } - if s.SyslogFormat != "" { - kvs.Insert("syslog_format", s.SyslogFormat) - } - if s.SyslogMaxSize != nil { - kvs.Insert("syslog_maxsize", fmt.Sprint(s.SyslogMaxSize)) - } - if s.SyslogSeverityKey != "" { - kvs.Insert("syslog_severity_key", s.SyslogSeverityKey) - } - if s.SyslogFacilityKey != "" { - kvs.Insert("syslog_facility_key", s.SyslogFacilityKey) - } - if s.SyslogHostnameKey != "" { - kvs.Insert("syslog_hostname_key", s.SyslogHostnameKey) - } - if s.SyslogAppnameKey != "" { - kvs.Insert("syslog_appname_key", s.SyslogAppnameKey) - } - if s.SyslogProcessIDKey != "" { - kvs.Insert("syslog_procid_key", s.SyslogProcessIDKey) - } - if s.SyslogMessageIDKey != "" { - kvs.Insert("syslog_msgid_key", s.SyslogMessageIDKey) - } - if s.SyslogSDKey != "" { - kvs.Insert("syslog_sd_key", s.SyslogSDKey) - } - if s.SyslogMessageKey != "" { - kvs.Insert("syslog_message_key", s.SyslogMessageKey) - } + + plugins.InsertKVString(kvs, "Host", s.Host) + plugins.InsertKVField(kvs, "port", s.Port) + plugins.InsertKVString(kvs, "mode", s.Mode) + plugins.InsertKVString(kvs, "syslog_hostname_key", s.SyslogHostnameKey) + plugins.InsertKVString(kvs, "syslog_appname_key", s.SyslogAppnameKey) + plugins.InsertKVString(kvs, "syslog_message_key", s.SyslogMessageKey) + plugins.InsertKVString(kvs, "syslog_format", s.SyslogFormat) + plugins.InsertKVString(kvs, "syslog_severity_key", s.SyslogSeverityKey) + plugins.InsertKVString(kvs, "syslog_facility_key", s.SyslogFacilityKey) + plugins.InsertKVString(kvs, "syslog_procid_key", s.SyslogProcessIDKey) + plugins.InsertKVString(kvs, "syslog_msgid_key", s.SyslogMessageIDKey) + plugins.InsertKVString(kvs, "syslog_sd_key", s.SyslogSDKey) + plugins.InsertKVString(kvs, "storage.total_limit_size", s.TotalLimitSize) + plugins.InsertKVField(kvs, "syslog_maxsize", s.SyslogMaxSize) + if s.TLS != nil { tls, err := s.TLS.Params(sl) if err != nil { @@ -109,8 +84,6 @@ func (s *Syslog) Params(sl plugins.SecretLoader) (*params.KVs, error) { } kvs.Merge(net) } - if s.TotalLimitSize != "" { - kvs.Insert("storage.total_limit_size", s.TotalLimitSize) - } + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/output/tcp_types.go b/apis/fluentbit/v1alpha2/plugins/output/tcp_types.go index 0b9316c2f..0e66c622b 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/tcp_types.go +++ b/apis/fluentbit/v1alpha2/plugins/output/tcp_types.go @@ -1,8 +1,6 @@ package output import ( - "fmt" - "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins" "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins/params" ) @@ -40,21 +38,7 @@ func (*TCP) Name() string { func (t *TCP) Params(sl plugins.SecretLoader) (*params.KVs, error) { kvs := params.NewKVs() - if t.Host != "" { - kvs.Insert("Host", t.Host) - } - if t.Port != nil { - kvs.Insert("Port", fmt.Sprint(*t.Port)) - } - if t.Format != "" { - kvs.Insert("Format", t.Format) - } - if t.JsonDateKey != "" { - kvs.Insert("json_date_key", t.JsonDateKey) - } - if t.JsonDateFormat != "" { - kvs.Insert("json_date_format", t.JsonDateFormat) - } + if t.TLS != nil { tls, err := t.TLS.Params(sl) if err != nil { @@ -76,5 +60,13 @@ func (t *TCP) Params(sl plugins.SecretLoader) (*params.KVs, error) { } kvs.Merge(net) } + + plugins.InsertKVString(kvs, "Host", t.Host) + plugins.InsertKVString(kvs, "Format", t.Format) + plugins.InsertKVString(kvs, "json_date_key", t.JsonDateKey) + plugins.InsertKVString(kvs, "json_date_format", t.JsonDateFormat) + + plugins.InsertKVField(kvs, "Port", t.Port) + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/utils.go b/apis/fluentbit/v1alpha2/plugins/utils.go new file mode 100644 index 000000000..4c4f7d33a --- /dev/null +++ b/apis/fluentbit/v1alpha2/plugins/utils.go @@ -0,0 +1,36 @@ +package plugins + +import ( + "fmt" + + "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins/params" +) + +// InsertKVField is a generic helper to insert fields into KVs with type conversion +func InsertKVField[T any](kvs *params.KVs, key string, value *T) { + if value != nil { + converted := fmt.Sprint(*value) + if converted != "" { + kvs.Insert(key, converted) + } + } +} + +// InsertKVString is a helper for string fields (replaces the old insertKVStore) +func InsertKVString(kvs *params.KVs, key string, value string) { + if value != "" { + kvs.Insert(key, value) + } +} + +// InsertKVSecret is a helper for secret fields with error handling +func InsertKVSecret(kvs *params.KVs, key string, secret *Secret, sl SecretLoader) error { + if secret != nil { + value, err := sl.LoadSecret(*secret) + if err != nil { + return err + } + kvs.Insert(key, value) + } + return nil +} diff --git a/charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_clusterfilters.yaml b/charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_clusterfilters.yaml index 61b6eb953..191d0bb6f 100644 --- a/charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_clusterfilters.yaml +++ b/charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_clusterfilters.yaml @@ -83,9 +83,13 @@ spec: description: The EC2 instance private ip.Default is false. type: boolean retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string vpcID: @@ -125,9 +129,13 @@ spec: Value Format: FIELD REGEX type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string type: object @@ -281,9 +289,13 @@ spec: The parser must be registered in a parsers file (refer to parser filter-kube-test as an example). type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string tlsDebug: @@ -382,9 +394,13 @@ spec: type: string type: array retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string tag: @@ -416,9 +432,13 @@ spec: It prevents to crash when invalid Lua script is executed. Default is true. type: boolean retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string script: @@ -535,9 +555,13 @@ spec: type: object type: array retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string rules: @@ -654,9 +678,13 @@ spec: You can specify multiple multiline parsers to detect different formats by separating them with a comma. type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string required: @@ -690,9 +718,13 @@ spec: this string type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string wildcard: @@ -726,9 +758,13 @@ spec: If false, all other original fields will be removed. type: boolean retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string unescapeKey: @@ -759,9 +795,13 @@ spec: type: string type: array retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string uuidKeys: @@ -793,9 +833,13 @@ spec: emitterStorageType: type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string rules: @@ -827,9 +871,13 @@ spec: format: int64 type: integer retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string window: @@ -860,9 +908,13 @@ spec: inside the Wasm program specified above. type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string wasmHeapSize: diff --git a/charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_filters.yaml b/charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_filters.yaml index 93dcc7dd0..2d3f2a111 100644 --- a/charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_filters.yaml +++ b/charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_filters.yaml @@ -83,9 +83,13 @@ spec: description: The EC2 instance private ip.Default is false. type: boolean retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string vpcID: @@ -125,9 +129,13 @@ spec: Value Format: FIELD REGEX type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string type: object @@ -281,9 +289,13 @@ spec: The parser must be registered in a parsers file (refer to parser filter-kube-test as an example). type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string tlsDebug: @@ -382,9 +394,13 @@ spec: type: string type: array retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string tag: @@ -416,9 +432,13 @@ spec: It prevents to crash when invalid Lua script is executed. Default is true. type: boolean retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string script: @@ -535,9 +555,13 @@ spec: type: object type: array retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string rules: @@ -654,9 +678,13 @@ spec: You can specify multiple multiline parsers to detect different formats by separating them with a comma. type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string required: @@ -690,9 +718,13 @@ spec: this string type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string wildcard: @@ -726,9 +758,13 @@ spec: If false, all other original fields will be removed. type: boolean retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string unescapeKey: @@ -759,9 +795,13 @@ spec: type: string type: array retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string uuidKeys: @@ -793,9 +833,13 @@ spec: emitterStorageType: type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string rules: @@ -827,9 +871,13 @@ spec: format: int64 type: integer retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string window: @@ -860,9 +908,13 @@ spec: inside the Wasm program specified above. type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string wasmHeapSize: diff --git a/config/crd/bases/fluentbit.fluent.io_clusterfilters.yaml b/config/crd/bases/fluentbit.fluent.io_clusterfilters.yaml index 61b6eb953..191d0bb6f 100644 --- a/config/crd/bases/fluentbit.fluent.io_clusterfilters.yaml +++ b/config/crd/bases/fluentbit.fluent.io_clusterfilters.yaml @@ -83,9 +83,13 @@ spec: description: The EC2 instance private ip.Default is false. type: boolean retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string vpcID: @@ -125,9 +129,13 @@ spec: Value Format: FIELD REGEX type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string type: object @@ -281,9 +289,13 @@ spec: The parser must be registered in a parsers file (refer to parser filter-kube-test as an example). type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string tlsDebug: @@ -382,9 +394,13 @@ spec: type: string type: array retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string tag: @@ -416,9 +432,13 @@ spec: It prevents to crash when invalid Lua script is executed. Default is true. type: boolean retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string script: @@ -535,9 +555,13 @@ spec: type: object type: array retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string rules: @@ -654,9 +678,13 @@ spec: You can specify multiple multiline parsers to detect different formats by separating them with a comma. type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string required: @@ -690,9 +718,13 @@ spec: this string type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string wildcard: @@ -726,9 +758,13 @@ spec: If false, all other original fields will be removed. type: boolean retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string unescapeKey: @@ -759,9 +795,13 @@ spec: type: string type: array retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string uuidKeys: @@ -793,9 +833,13 @@ spec: emitterStorageType: type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string rules: @@ -827,9 +871,13 @@ spec: format: int64 type: integer retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string window: @@ -860,9 +908,13 @@ spec: inside the Wasm program specified above. type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string wasmHeapSize: diff --git a/config/crd/bases/fluentbit.fluent.io_filters.yaml b/config/crd/bases/fluentbit.fluent.io_filters.yaml index 93dcc7dd0..2d3f2a111 100644 --- a/config/crd/bases/fluentbit.fluent.io_filters.yaml +++ b/config/crd/bases/fluentbit.fluent.io_filters.yaml @@ -83,9 +83,13 @@ spec: description: The EC2 instance private ip.Default is false. type: boolean retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string vpcID: @@ -125,9 +129,13 @@ spec: Value Format: FIELD REGEX type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string type: object @@ -281,9 +289,13 @@ spec: The parser must be registered in a parsers file (refer to parser filter-kube-test as an example). type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string tlsDebug: @@ -382,9 +394,13 @@ spec: type: string type: array retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string tag: @@ -416,9 +432,13 @@ spec: It prevents to crash when invalid Lua script is executed. Default is true. type: boolean retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string script: @@ -535,9 +555,13 @@ spec: type: object type: array retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string rules: @@ -654,9 +678,13 @@ spec: You can specify multiple multiline parsers to detect different formats by separating them with a comma. type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string required: @@ -690,9 +718,13 @@ spec: this string type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string wildcard: @@ -726,9 +758,13 @@ spec: If false, all other original fields will be removed. type: boolean retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string unescapeKey: @@ -759,9 +795,13 @@ spec: type: string type: array retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string uuidKeys: @@ -793,9 +833,13 @@ spec: emitterStorageType: type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string rules: @@ -827,9 +871,13 @@ spec: format: int64 type: integer retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string window: @@ -860,9 +908,13 @@ spec: inside the Wasm program specified above. type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string wasmHeapSize: diff --git a/docs/plugins/fluentbit/common.md b/docs/plugins/fluentbit/common.md index 1d9d742a2..5fb123c49 100644 --- a/docs/plugins/fluentbit/common.md +++ b/docs/plugins/fluentbit/common.md @@ -6,4 +6,4 @@ | Field | Description | Scheme | | ----- | ----------- | ------ | | alias | Alias for the plugin | string | -| retryLimit | RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. nolint:misspell | string | +| retryLimit | RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. | string | diff --git a/docs/plugins/fluentbit/utils.md b/docs/plugins/fluentbit/utils.md new file mode 100644 index 000000000..e69de29bb diff --git a/manifests/setup/fluent-operator-crd.yaml b/manifests/setup/fluent-operator-crd.yaml index 9b8e71863..53013ca70 100644 --- a/manifests/setup/fluent-operator-crd.yaml +++ b/manifests/setup/fluent-operator-crd.yaml @@ -82,9 +82,13 @@ spec: description: The EC2 instance private ip.Default is false. type: boolean retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string vpcID: @@ -124,9 +128,13 @@ spec: Value Format: FIELD REGEX type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string type: object @@ -280,9 +288,13 @@ spec: The parser must be registered in a parsers file (refer to parser filter-kube-test as an example). type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string tlsDebug: @@ -381,9 +393,13 @@ spec: type: string type: array retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string tag: @@ -415,9 +431,13 @@ spec: It prevents to crash when invalid Lua script is executed. Default is true. type: boolean retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string script: @@ -534,9 +554,13 @@ spec: type: object type: array retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string rules: @@ -653,9 +677,13 @@ spec: You can specify multiple multiline parsers to detect different formats by separating them with a comma. type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string required: @@ -689,9 +717,13 @@ spec: this string type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string wildcard: @@ -725,9 +757,13 @@ spec: If false, all other original fields will be removed. type: boolean retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string unescapeKey: @@ -758,9 +794,13 @@ spec: type: string type: array retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string uuidKeys: @@ -792,9 +832,13 @@ spec: emitterStorageType: type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string rules: @@ -826,9 +870,13 @@ spec: format: int64 type: integer retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string window: @@ -859,9 +907,13 @@ spec: inside the Wasm program specified above. type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string wasmHeapSize: @@ -14866,9 +14918,13 @@ spec: description: The EC2 instance private ip.Default is false. type: boolean retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string vpcID: @@ -14908,9 +14964,13 @@ spec: Value Format: FIELD REGEX type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string type: object @@ -15064,9 +15124,13 @@ spec: The parser must be registered in a parsers file (refer to parser filter-kube-test as an example). type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string tlsDebug: @@ -15165,9 +15229,13 @@ spec: type: string type: array retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string tag: @@ -15199,9 +15267,13 @@ spec: It prevents to crash when invalid Lua script is executed. Default is true. type: boolean retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string script: @@ -15318,9 +15390,13 @@ spec: type: object type: array retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string rules: @@ -15437,9 +15513,13 @@ spec: You can specify multiple multiline parsers to detect different formats by separating them with a comma. type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string required: @@ -15473,9 +15553,13 @@ spec: this string type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string wildcard: @@ -15509,9 +15593,13 @@ spec: If false, all other original fields will be removed. type: boolean retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string unescapeKey: @@ -15542,9 +15630,13 @@ spec: type: string type: array retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string uuidKeys: @@ -15576,9 +15668,13 @@ spec: emitterStorageType: type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string rules: @@ -15610,9 +15706,13 @@ spec: format: int64 type: integer retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string window: @@ -15643,9 +15743,13 @@ spec: inside the Wasm program specified above. type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string wasmHeapSize: diff --git a/manifests/setup/setup.yaml b/manifests/setup/setup.yaml index 13a74da5d..071f7e9a1 100644 --- a/manifests/setup/setup.yaml +++ b/manifests/setup/setup.yaml @@ -82,9 +82,13 @@ spec: description: The EC2 instance private ip.Default is false. type: boolean retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string vpcID: @@ -124,9 +128,13 @@ spec: Value Format: FIELD REGEX type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string type: object @@ -280,9 +288,13 @@ spec: The parser must be registered in a parsers file (refer to parser filter-kube-test as an example). type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string tlsDebug: @@ -381,9 +393,13 @@ spec: type: string type: array retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string tag: @@ -415,9 +431,13 @@ spec: It prevents to crash when invalid Lua script is executed. Default is true. type: boolean retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string script: @@ -534,9 +554,13 @@ spec: type: object type: array retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string rules: @@ -653,9 +677,13 @@ spec: You can specify multiple multiline parsers to detect different formats by separating them with a comma. type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string required: @@ -689,9 +717,13 @@ spec: this string type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string wildcard: @@ -725,9 +757,13 @@ spec: If false, all other original fields will be removed. type: boolean retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string unescapeKey: @@ -758,9 +794,13 @@ spec: type: string type: array retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string uuidKeys: @@ -792,9 +832,13 @@ spec: emitterStorageType: type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string rules: @@ -826,9 +870,13 @@ spec: format: int64 type: integer retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string window: @@ -859,9 +907,13 @@ spec: inside the Wasm program specified above. type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string wasmHeapSize: @@ -14866,9 +14918,13 @@ spec: description: The EC2 instance private ip.Default is false. type: boolean retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string vpcID: @@ -14908,9 +14964,13 @@ spec: Value Format: FIELD REGEX type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string type: object @@ -15064,9 +15124,13 @@ spec: The parser must be registered in a parsers file (refer to parser filter-kube-test as an example). type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string tlsDebug: @@ -15165,9 +15229,13 @@ spec: type: string type: array retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string tag: @@ -15199,9 +15267,13 @@ spec: It prevents to crash when invalid Lua script is executed. Default is true. type: boolean retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string script: @@ -15318,9 +15390,13 @@ spec: type: object type: array retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string rules: @@ -15437,9 +15513,13 @@ spec: You can specify multiple multiline parsers to detect different formats by separating them with a comma. type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string required: @@ -15473,9 +15553,13 @@ spec: this string type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string wildcard: @@ -15509,9 +15593,13 @@ spec: If false, all other original fields will be removed. type: boolean retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string unescapeKey: @@ -15542,9 +15630,13 @@ spec: type: string type: array retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string uuidKeys: @@ -15576,9 +15668,13 @@ spec: emitterStorageType: type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string rules: @@ -15610,9 +15706,13 @@ spec: format: int64 type: integer retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string window: @@ -15643,9 +15743,13 @@ spec: inside the Wasm program specified above. type: string retryLimit: - description: |- - RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1. - nolint:misspell + description: 'RetryLimit describes how many times fluent-bit + should retry to send data to a specific output. If set + to false fluent-bit will try indefinitely. If set to any + integer N>0 it will try at most N+1 times. Leading zeros + are not allowed (values such as 007, 0150, 01 do not work). + If this property is not defined fluent-bit will use the + default value: 1.' pattern: ^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$ type: string wasmHeapSize: From 30cd0c372a255d430fdd5f2cdbe5d39548f12110 Mon Sep 17 00:00:00 2001 From: Marco Franssen Date: Fri, 3 Oct 2025 17:42:27 +0200 Subject: [PATCH 2/2] Refactor cyclomatic complexity for fluentbitconfig controller Signed-off-by: Marco Franssen --- controllers/fluentbitconfig_controller.go | 112 ++++++++-------------- 1 file changed, 38 insertions(+), 74 deletions(-) diff --git a/controllers/fluentbitconfig_controller.go b/controllers/fluentbitconfig_controller.go index 16c3e1466..703d63020 100644 --- a/controllers/fluentbitconfig_controller.go +++ b/controllers/fluentbitconfig_controller.go @@ -81,7 +81,6 @@ func (r *FluentBitConfigReconciler) Reconcile(ctx context.Context, req ctrl.Requ } for _, fb := range fbs.Items { - var cfgs fluentbitv1alpha2.ClusterFluentBitConfigList if err := r.List(ctx, &cfgs); err != nil { if errors.IsNotFound(err) { @@ -95,54 +94,29 @@ func (r *FluentBitConfigReconciler) Reconcile(ctx context.Context, req ctrl.Requ if cfg.Name != fb.Spec.FluentBitConfigName { continue } + var inputs fluentbitv1alpha2.ClusterInputList - selector, err := metav1.LabelSelectorAsSelector(&cfg.Spec.InputSelector) - if err != nil { - return ctrl.Result{}, err - } - if err = r.List(ctx, &inputs, client.MatchingLabelsSelector{Selector: selector}); err != nil { + if err := listClusterResources(ctx, r.Client, &cfg.Spec.InputSelector, &inputs); err != nil { return ctrl.Result{}, err } - // List all filters matching the label selector. var filters fluentbitv1alpha2.ClusterFilterList - selector, err = metav1.LabelSelectorAsSelector(&cfg.Spec.FilterSelector) - if err != nil { - return ctrl.Result{}, err - } - if err = r.List(ctx, &filters, client.MatchingLabelsSelector{Selector: selector}); err != nil { + if err := listClusterResources(ctx, r.Client, &cfg.Spec.FilterSelector, &filters); err != nil { return ctrl.Result{}, err } - // List all outputs matching the label selector. var outputs fluentbitv1alpha2.ClusterOutputList - selector, err = metav1.LabelSelectorAsSelector(&cfg.Spec.OutputSelector) - if err != nil { - return ctrl.Result{}, err - } - if err = r.List(ctx, &outputs, client.MatchingLabelsSelector{Selector: selector}); err != nil { + if err := listClusterResources(ctx, r.Client, &cfg.Spec.OutputSelector, &outputs); err != nil { return ctrl.Result{}, err } - // List all parsers matching the label selector. var parsers fluentbitv1alpha2.ClusterParserList - selector, err = metav1.LabelSelectorAsSelector(&cfg.Spec.ParserSelector) - if err != nil { - return ctrl.Result{}, err - } - if err = r.List(ctx, &parsers, client.MatchingLabelsSelector{Selector: selector}); err != nil { + if err := listClusterResources(ctx, r.Client, &cfg.Spec.ParserSelector, &parsers); err != nil { return ctrl.Result{}, err } - // List all multiline parsers matching the label selector. var multilineParsers fluentbitv1alpha2.ClusterMultilineParserList - selector, err = metav1.LabelSelectorAsSelector(&cfg.Spec.MultilineParserSelector) - if err != nil { - return ctrl.Result{}, err - } - if err = r.List( - ctx, &multilineParsers, client.MatchingLabelsSelector{Selector: selector}, - ); err != nil { + if err := listClusterResources(ctx, r.Client, &cfg.Spec.MultilineParserSelector, &multilineParsers); err != nil { return ctrl.Result{}, err } @@ -292,6 +266,32 @@ func (r *FluentBitConfigReconciler) processNamespacedFluentBitCfgs( return filters, outputs, parsers, clusterParsers, multilineParsers, clusterMultilineParsers, rewriteTagConfigs, nil } +func listClusterResources[T client.ObjectList]( + ctx context.Context, cli client.Client, selector *metav1.LabelSelector, list T, +) error { + sel, err := metav1.LabelSelectorAsSelector(selector) + if err != nil { + return err + } + if err := cli.List(ctx, list, client.MatchingLabelsSelector{Selector: sel}); err != nil { + return err + } + return nil +} + +func listNamespacedResources[T client.ObjectList]( + ctx context.Context, cli client.Client, list T, namespace string, selector *metav1.LabelSelector, +) error { + sel, err := metav1.LabelSelectorAsSelector(selector) + if err != nil { + return err + } + if err := cli.List(ctx, list, client.InNamespace(namespace), client.MatchingLabelsSelector{Selector: sel}); err != nil { + return err + } + return nil +} + func (r *FluentBitConfigReconciler) ListNamespacedResources( ctx context.Context, cfg fluentbitv1alpha2.FluentBitConfig, ) ( @@ -306,62 +306,26 @@ func (r *FluentBitConfigReconciler) ListNamespacedResources( var multipleParsers fluentbitv1alpha2.MultilineParserList var clusterMultipleParsers fluentbitv1alpha2.ClusterMultilineParserList - selector, err := metav1.LabelSelectorAsSelector(&cfg.Spec.FilterSelector) - if err != nil { - return filters, outputs, parsers, clusterParsers, multipleParsers, clusterMultipleParsers, err - } - if err := r.List( - ctx, &filters, client.InNamespace(cfg.Namespace), client.MatchingLabelsSelector{Selector: selector}, - ); err != nil { - return filters, outputs, parsers, clusterParsers, multipleParsers, clusterMultipleParsers, err - } - - selector, err = metav1.LabelSelectorAsSelector(&cfg.Spec.OutputSelector) - if err != nil { - return filters, outputs, parsers, clusterParsers, multipleParsers, clusterMultipleParsers, err - } - if err := r.List( - ctx, &outputs, client.InNamespace(cfg.Namespace), client.MatchingLabelsSelector{Selector: selector}, - ); err != nil { + if err := listNamespacedResources(ctx, r.Client, &filters, cfg.Namespace, &cfg.Spec.FilterSelector); err != nil { return filters, outputs, parsers, clusterParsers, multipleParsers, clusterMultipleParsers, err } - selector, err = metav1.LabelSelectorAsSelector(&cfg.Spec.ParserSelector) - if err != nil { + if err := listNamespacedResources(ctx, r.Client, &outputs, cfg.Namespace, &cfg.Spec.OutputSelector); err != nil { return filters, outputs, parsers, clusterParsers, multipleParsers, clusterMultipleParsers, err } - if err := r.List( - ctx, &parsers, client.InNamespace(cfg.Namespace), client.MatchingLabelsSelector{Selector: selector}, - ); err != nil { + if err := listNamespacedResources(ctx, r.Client, &parsers, cfg.Namespace, &cfg.Spec.ParserSelector); err != nil { return filters, outputs, parsers, clusterParsers, multipleParsers, clusterMultipleParsers, err } - selector, err = metav1.LabelSelectorAsSelector(&cfg.Spec.ClusterParserSelector) - if err != nil { - return filters, outputs, parsers, clusterParsers, multipleParsers, clusterMultipleParsers, err - } - if err := r.List(ctx, &clusterParsers, client.MatchingLabelsSelector{Selector: selector}); err != nil { + if err := listNamespacedResources(ctx, r.Client, &clusterParsers, cfg.Namespace, &cfg.Spec.ClusterParserSelector); err != nil { return filters, outputs, parsers, clusterParsers, multipleParsers, clusterMultipleParsers, err } - selector, err = metav1.LabelSelectorAsSelector(&cfg.Spec.MultilineParserSelector) - if err != nil { - return filters, outputs, parsers, clusterParsers, multipleParsers, clusterMultipleParsers, err - } - if err := r.List( - ctx, &multipleParsers, client.InNamespace(cfg.Namespace), client.MatchingLabelsSelector{Selector: selector}, - ); err != nil { + if err := listNamespacedResources(ctx, r.Client, &multipleParsers, cfg.Namespace, &cfg.Spec.MultilineParserSelector); err != nil { return filters, outputs, parsers, clusterParsers, multipleParsers, clusterMultipleParsers, err } - selector, err = metav1.LabelSelectorAsSelector(&cfg.Spec.ClusterMultilineParserSelector) - if err != nil { - return filters, outputs, parsers, clusterParsers, multipleParsers, clusterMultipleParsers, err - } - if err := r.List( - ctx, &clusterMultipleParsers, client.InNamespace(cfg.Namespace), - client.MatchingLabelsSelector{Selector: selector}, - ); err != nil { + if err := listNamespacedResources(ctx, r.Client, &clusterMultipleParsers, cfg.Namespace, &cfg.Spec.ClusterMultilineParserSelector); err != nil { return filters, outputs, parsers, clusterParsers, multipleParsers, clusterMultipleParsers, err }