Skip to content

Commit 728079e

Browse files
authored
Merge pull request #1355 from kube-logging/parsers-fix
fix: use a separate path to mount custom config for the operator
2 parents abb654a + 96dc9b4 commit 728079e

File tree

5 files changed

+16
-4
lines changed

5 files changed

+16
-4
lines changed

e2e/syslog-ng-aggregator/syslog_ng_aggregator_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ func init() {
6464
}
6565

6666
func TestSyslogNGIsRunningAndForwardingLogs(t *testing.T) {
67+
t.Parallel()
6768
ns := "test"
6869
common.WithCluster("syslog-ng-1", t, func(t *testing.T, c common.Cluster) {
6970
setup.LoggingOperator(t, c, setup.LoggingOperatorOptionFunc(func(options *setup.LoggingOperatorOptions) {

e2e/volumedrain/volumedrain_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ func init() {
6262
}
6363

6464
func TestVolumeDrain_Downscale(t *testing.T) {
65+
t.Parallel()
6566
ns := "testing-1"
6667
common.WithCluster("drain", t, func(t *testing.T, c common.Cluster) {
6768
setup.LoggingOperator(t, c, setup.LoggingOperatorOptionFunc(func(options *setup.LoggingOperatorOptions) {
@@ -226,8 +227,9 @@ func TestVolumeDrain_Downscale(t *testing.T) {
226227
}
227228

228229
func TestVolumeDrain_Downscale_DeleteVolume(t *testing.T) {
230+
t.Parallel()
229231
ns := "testing-2"
230-
common.WithCluster("drain", t, func(t *testing.T, c common.Cluster) {
232+
common.WithCluster("drain-2", t, func(t *testing.T, c common.Cluster) {
231233
setup.LoggingOperator(t, c, setup.LoggingOperatorOptionFunc(func(options *setup.LoggingOperatorOptions) {
232234
options.Config.DisableWebhook = true
233235
options.Config.Namespace = ns

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)