Skip to content

Commit

Permalink
Merge pull request #1358 from kube-logging/fluentbit-upstream
Browse files Browse the repository at this point in the history
fix: do not refer to upstream config item to avoid hiding fluentbit configuration, also use absolute path in the config
  • Loading branch information
pepov authored Jun 13, 2023
2 parents 728079e + bc6eb0d commit 469986c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/resources/fluentbit/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ var fluentBitConfigTemplate = `
Name forward
Match *
{{- if .Upstream.Enabled }}
Upstream upstream.conf
Upstream {{ .Upstream.Config.Path }}
{{- else }}
Host {{ .TargetHost }}
Port {{ .TargetPort }}
Expand Down
2 changes: 2 additions & 0 deletions pkg/resources/fluentbit/configsecret.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ type upstreamNode struct {

type upstream struct {
Name string
Path string
Nodes []upstreamNode
}

Expand Down Expand Up @@ -323,6 +324,7 @@ func (r *Reconciler) configSecret() (runtime.Object, reconciler.DesiredState, er

if r.fluentbitSpec.EnableUpstream {
input.FluentForwardOutput.Upstream.Enabled = true
input.FluentForwardOutput.Upstream.Config.Path = fmt.Sprintf("%s/%s", OperatorConfigPath, UpstreamConfigName)
input.FluentForwardOutput.Upstream.Config.Name = "fluentd-upstream"
for i := int32(0); i < utils.PointerToInt32(aggregatorReplicas); i++ {
input.FluentForwardOutput.Upstream.Config.Nodes = append(input.FluentForwardOutput.Upstream.Config.Nodes, r.generateUpstreamNode(i))
Expand Down
6 changes: 0 additions & 6 deletions pkg/resources/fluentbit/daemonset.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,6 @@ func (r *Reconciler) generateVolume() (v []corev1.Volume) {
},
},
}
if r.fluentbitSpec.EnableUpstream {
volume.VolumeSource.Secret.Items = append(volume.VolumeSource.Secret.Items, corev1.KeyToPath{
Key: UpstreamConfigName,
Path: UpstreamConfigName,
})
}
v = append(v, volume)
} else {
v = append(v, corev1.Volume{
Expand Down

0 comments on commit 469986c

Please sign in to comment.