From 412c85ada640233fc707bec3b5d1eb7def8f7dd3 Mon Sep 17 00:00:00 2001 From: Onecer Date: Tue, 16 Apr 2024 18:55:52 +0800 Subject: [PATCH] make lua scripts `code` and `script` not required Signed-off-by: Onecer --- apis/fluentbit/v1alpha2/plugins/filter/lua_types.go | 6 +++--- .../crds/fluentbit.fluent.io_clusterfilters.yaml | 2 -- .../fluent-bit-crds/crds/fluentbit.fluent.io_filters.yaml | 2 -- config/crd/bases/fluentbit.fluent.io_clusterfilters.yaml | 2 -- config/crd/bases/fluentbit.fluent.io_filters.yaml | 2 -- manifests/setup/fluent-operator-crd.yaml | 4 ---- manifests/setup/setup.yaml | 4 ---- 7 files changed, 3 insertions(+), 19 deletions(-) diff --git a/apis/fluentbit/v1alpha2/plugins/filter/lua_types.go b/apis/fluentbit/v1alpha2/plugins/filter/lua_types.go index b64e839a5..0911ada38 100644 --- a/apis/fluentbit/v1alpha2/plugins/filter/lua_types.go +++ b/apis/fluentbit/v1alpha2/plugins/filter/lua_types.go @@ -1,9 +1,9 @@ package filter import ( + "regexp" "strconv" "strings" - "regexp" "github.com/fluent/fluent-operator/v2/apis/fluentbit/v1alpha2/plugins" "github.com/fluent/fluent-operator/v2/apis/fluentbit/v1alpha2/plugins/params" @@ -17,12 +17,12 @@ import ( type Lua struct { plugins.CommonParams `json:",inline"` // Path to the Lua script that will be used. - Script v1.ConfigMapKeySelector `json:"script"` + Script v1.ConfigMapKeySelector `json:"script,omitempty"` // Lua function name that will be triggered to do filtering. // It's assumed that the function is declared inside the Script defined above. Call string `json:"call"` // Inline LUA code instead of loading from a path via script. - Code string `json:"code"` + Code string `json:"code,omitempty"` // If these keys are matched, the fields are converted to integer. // If more than one key, delimit by space. // Note that starting from Fluent Bit v1.6 integer data types are preserved 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 5bc319a7b..e327e3227 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 @@ -345,8 +345,6 @@ spec: type: array required: - call - - code - - script type: object modify: description: Modify defines Modify Filter configuration. 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 dd166771a..1a0145ba8 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 @@ -345,8 +345,6 @@ spec: type: array required: - call - - code - - script type: object modify: description: Modify defines Modify Filter configuration. diff --git a/config/crd/bases/fluentbit.fluent.io_clusterfilters.yaml b/config/crd/bases/fluentbit.fluent.io_clusterfilters.yaml index 5bc319a7b..e327e3227 100644 --- a/config/crd/bases/fluentbit.fluent.io_clusterfilters.yaml +++ b/config/crd/bases/fluentbit.fluent.io_clusterfilters.yaml @@ -345,8 +345,6 @@ spec: type: array required: - call - - code - - script type: object modify: description: Modify defines Modify Filter configuration. diff --git a/config/crd/bases/fluentbit.fluent.io_filters.yaml b/config/crd/bases/fluentbit.fluent.io_filters.yaml index dd166771a..1a0145ba8 100644 --- a/config/crd/bases/fluentbit.fluent.io_filters.yaml +++ b/config/crd/bases/fluentbit.fluent.io_filters.yaml @@ -345,8 +345,6 @@ spec: type: array required: - call - - code - - script type: object modify: description: Modify defines Modify Filter configuration. diff --git a/manifests/setup/fluent-operator-crd.yaml b/manifests/setup/fluent-operator-crd.yaml index 69259298c..9a9c61a10 100644 --- a/manifests/setup/fluent-operator-crd.yaml +++ b/manifests/setup/fluent-operator-crd.yaml @@ -343,8 +343,6 @@ spec: type: array required: - call - - code - - script type: object modify: description: Modify defines Modify Filter configuration. @@ -11438,8 +11436,6 @@ spec: type: array required: - call - - code - - script type: object modify: description: Modify defines Modify Filter configuration. diff --git a/manifests/setup/setup.yaml b/manifests/setup/setup.yaml index 845c0f7fd..999f40b50 100644 --- a/manifests/setup/setup.yaml +++ b/manifests/setup/setup.yaml @@ -343,8 +343,6 @@ spec: type: array required: - call - - code - - script type: object modify: description: Modify defines Modify Filter configuration. @@ -11438,8 +11436,6 @@ spec: type: array required: - call - - code - - script type: object modify: description: Modify defines Modify Filter configuration.