Closed alternaivan closed 2 months ago
the configmap's namespace should be the same with the ClusterFluentBitConfig. see https://github.com/fluent/fluent-operator/blob/master/apis/fluentbit/v1alpha2/clusterfluentbitconfig_types.go#L49-L51
Hi @cw-Guo,
Thanks for the response! I understand that if you specify the namespace in the ClusterFluentBitConfig
, the secrets and configmaps will be loaded from that namespace. However, this is not what we want to achieve.
We want to be able to add a lua Filter
in the specific namespace e.g. default
for which the script is defined as a ConfigMap
in the same namespace as the Filter
(e.g. default
), while on the other hand default configmaps and secrets can be taken from the namespace where fluent-bit is deployed (e.g. logging
).
Is it possible to do that?
Thanks, Marjan
Hi @alternaivan , you can try FluentBitConfig, basically, the namespaced CR solution.
Hi @cw-Guo,
I checked it out, and it doesn't have the namespace
field as ClusterFluentBitConfig
.
Am I missing something?
Thanks!
Hi @cw-Guo,
I checked it out, and it doesn't have the
namespace
field asClusterFluentBitConfig
.Am I missing something?
Thanks!
@alternaivan no, it has to be the same namespace as your configmap (default)
@alternaivan no, it has to be the same namespace as your configmap (default)
@cw-Guo, yes, we have it deployed and that is how we configure the filter selection. But, this doesn't help with ConfigMaps for lua scripts. The ConfigMaps will be read from the namespace where fluent-bit is running, not from the namespace where Filter
is deployed. I wasn't able to find a way to make this work.
Here is the FluentBitConfig
we deploy on the default
namespace.
apiVersion: fluentbit.fluent.io/v1alpha2
kind: FluentBitConfig
metadata:
name: fluent-bit-config
spec:
filterSelector:
matchLabels:
fluentbit.fluent.io/component: logging
fluentbit.fluent.io/enabled: "true"
outputSelector:
matchLabels:
fluentbit.fluent.io/component: logging
fluentbit.fluent.io/enabled: "true"
parserSelector:
matchLabels:
fluentbit.fluent.io/component: logging
fluentbit.fluent.io/enabled: "true"
@alternaivan You are right, https://github.com/fluent/fluent-operator/blob/master/controllers/fluentbitconfig_controller.go#L183-L186 only cluster filers are processed for the lua scripts. there is a bug.
Describe the issue
Hello,
I am trying to apply the Lua rate limit filter via Filter CRD and ConfigMap, however, the fluent-bit is throwing the following errors and it won't reload the config.
These are the Filter and ConfigMap resources I'm deploying.
Fluent Operator is deployed in the separate
logging
namespace. After checking the logs and the configuration, it seems that the operator doesn't see the config map from thedefault
namespace.The workaround for this solution would be to deploy the configmap in the
logging
namespace.The proposed solution would be to extend the
Filter
CRD to include thenamespace
definition and to add the logic behind it, so it is able to read the ConfigMaps from the namespace where Filter is deployed into.To Reproduce
Create above 2 resources (
Filter
andConfigMap
) in thedefault
namespace and check the fluent-bit logs and configuration.Expected behavior
Filter configuration is reloaded correctly, config map from the filter namespace is rendered, and fluent-bit starts operating as expected.
Your Environment
How did you install fluent operator?
Via Helm.
Additional context
No response