From 47ac1d3d7065fcc003a15b154c64d1deec47a175 Mon Sep 17 00:00:00 2001 From: juicer Date: Fri, 13 Sep 2024 20:31:39 -0700 Subject: [PATCH] adjust namespaced lua script name Signed-off-by: juicer --- apis/fluentbit/v1alpha2/clusterfluentbitconfig_types.go | 2 +- apis/fluentbit/v1alpha2/plugins/filter/lua_types.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apis/fluentbit/v1alpha2/clusterfluentbitconfig_types.go b/apis/fluentbit/v1alpha2/clusterfluentbitconfig_types.go index 4edeb1678..54c1d3f9f 100644 --- a/apis/fluentbit/v1alpha2/clusterfluentbitconfig_types.go +++ b/apis/fluentbit/v1alpha2/clusterfluentbitconfig_types.go @@ -550,7 +550,7 @@ func (cfg ClusterFluentBitConfig) RenderNamespacedLuaScript( if err != nil { return nil, err } - namespacedScriptName := fmt.Sprintf("%s-%x", p.Lua.Script.Key, md5.Sum([]byte(f.ObjectMeta.Namespace))) + namespacedScriptName := fmt.Sprintf("%x-%s", md5.Sum([]byte(f.ObjectMeta.Namespace)), p.Lua.Script.Key) scripts = append(scripts, Script{Name: namespacedScriptName, Content: script}) } } diff --git a/apis/fluentbit/v1alpha2/plugins/filter/lua_types.go b/apis/fluentbit/v1alpha2/plugins/filter/lua_types.go index 762d82ad2..7025b1a15 100644 --- a/apis/fluentbit/v1alpha2/plugins/filter/lua_types.go +++ b/apis/fluentbit/v1alpha2/plugins/filter/lua_types.go @@ -97,5 +97,5 @@ func (l *Lua) Params(_ plugins.SecretLoader) (*params.KVs, error) { } func (l *Lua) MakeNamespaced(ns string) { - l.Script.Key = fmt.Sprintf("%s-%x", l.Script.Key, md5.Sum([]byte(ns))) + l.Script.Key = fmt.Sprintf("%x-%s", md5.Sum([]byte(ns)), l.Script.Key) }