Skip to content

Commit 3f35c39

Browse files
committed
fix: use a separate path to mount custom config for the operator
Signed-off-by: Peter Wilcsinszky <[email protected]>
1 parent abb654a commit 3f35c39

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

pkg/resources/fluentbit/config.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,17 @@ package fluentbit
1717
const BaseConfigName = "fluent-bit.conf"
1818
const UpstreamConfigName = "upstream.conf"
1919
const CustomParsersConfigName = "custom-parsers.conf"
20+
const StockConfigPath = "/fluent-bit/etc"
21+
const StockBinPath = "/fluent-bit/bin/fluent-bit"
22+
const OperatorConfigPath = "/fluent-bit/etc-operator"
2023

2124
var fluentBitConfigTemplate = `
2225
[SERVICE]
2326
Flush {{ .Flush }}
2427
Grace {{ .Grace }}
2528
Daemon Off
2629
Log_Level {{ .LogLevel }}
27-
Parsers_File parsers.conf
30+
Parsers_File {{ .DefaultParsers }}
2831
{{- if .CustomParsers }}
2932
Parsers_File {{ .CustomParsers }}
3033
{{- end }}

pkg/resources/fluentbit/configsecret.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ type fluentBitConfig struct {
6969
FilterModify []v1beta1.FilterModify
7070
FluentForwardOutput *fluentForwardOutputConfig
7171
SyslogNGOutput *syslogNGOutputConfig
72+
DefaultParsers string
7273
CustomParsers string
7374
}
7475

@@ -191,8 +192,10 @@ func (r *Reconciler) configSecret() (runtime.Object, reconciler.DesiredState, er
191192
FilterModify: r.fluentbitSpec.FilterModify,
192193
}
193194

195+
input.DefaultParsers = fmt.Sprintf("%s/%s", StockConfigPath, "parsers.conf")
196+
194197
if r.fluentbitSpec.CustomParsers != "" {
195-
input.CustomParsers = fmt.Sprintf("/fluent-bit/etc/%s", CustomParsersConfigName)
198+
input.CustomParsers = fmt.Sprintf("%s/%s", OperatorConfigPath, CustomParsersConfigName)
196199
}
197200

198201
if r.fluentbitSpec.Metrics != nil {

pkg/resources/fluentbit/daemonset.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ func (r *Reconciler) fluentbitContainer() *corev1.Container {
124124
Privileged: r.fluentbitSpec.Security.SecurityContext.Privileged,
125125
SELinuxOptions: r.fluentbitSpec.Security.SecurityContext.SELinuxOptions,
126126
},
127+
Command: []string{
128+
StockBinPath, "-c", fmt.Sprintf("%s/%s", OperatorConfigPath, BaseConfigName),
129+
},
127130
Env: r.fluentbitSpec.EnvVars,
128131
LivenessProbe: r.fluentbitSpec.LivenessProbe,
129132
ReadinessProbe: r.fluentbitSpec.ReadinessProbe,
@@ -155,7 +158,7 @@ func (r *Reconciler) generateVolumeMounts() (v []corev1.VolumeMount) {
155158
},
156159
{
157160
Name: "config",
158-
MountPath: "/fluent-bit/etc/",
161+
MountPath: OperatorConfigPath,
159162
},
160163
}
161164

0 commit comments

Comments
 (0)