From 3b14411db9a77b27a832edff57f98f15dd2b2207 Mon Sep 17 00:00:00 2001 From: Bence Csati Date: Wed, 18 Dec 2024 10:48:24 +0100 Subject: [PATCH 1/2] fix: wire in ipv6 flag Signed-off-by: Bence Csati --- pkg/resources/fluentd/config.go | 2 +- pkg/resources/fluentd/configsecret.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/resources/fluentd/config.go b/pkg/resources/fluentd/config.go index 49496bd26..80249b552 100644 --- a/pkg/resources/fluentd/config.go +++ b/pkg/resources/fluentd/config.go @@ -67,7 +67,7 @@ var fluentdInputTemplate = ` @type prometheus @id in_prometheus6 - bind "::" + bind [::] port {{ .Monitor.Port }} {{- if .Monitor.Path }} metrics_path {{ .Monitor.Path }} diff --git a/pkg/resources/fluentd/configsecret.go b/pkg/resources/fluentd/configsecret.go index 2dee35fcd..0b1c81e3f 100644 --- a/pkg/resources/fluentd/configsecret.go +++ b/pkg/resources/fluentd/configsecret.go @@ -63,6 +63,7 @@ func (r *Reconciler) generateConfigSecret(fluentdSpec v1beta1.FluentdSpec) (map[ Workers: fluentdSpec.Workers, LogFormat: fluentdSpec.LogFormat, LogLevel: fluentdSpec.LogLevel, + EnabledIPv6: fluentdSpec.EnabledIPv6, } input.RootDir = fluentdSpec.RootDir From 726d72b35c09f34d52d78b2b34df22514dcb7f08 Mon Sep 17 00:00:00 2001 From: Bence Csati Date: Wed, 18 Dec 2024 13:05:06 +0100 Subject: [PATCH 2/2] fix: ipv6 metrics Signed-off-by: Bence Csati --- pkg/resources/fluentbit/config.go | 2 +- pkg/resources/fluentbit/configsecret.go | 10 +++++----- pkg/resources/fluentd/config.go | 20 ++++++++------------ pkg/resources/fluentd/configsecret.go | 16 ++++++++-------- 4 files changed, 22 insertions(+), 26 deletions(-) diff --git a/pkg/resources/fluentbit/config.go b/pkg/resources/fluentbit/config.go index 15d02c5e2..59af4d120 100644 --- a/pkg/resources/fluentbit/config.go +++ b/pkg/resources/fluentbit/config.go @@ -38,7 +38,7 @@ var fluentBitConfigTemplate = ` Coro_Stack_Size {{ .CoroStackSize }} {{- if .Monitor.Enabled }} HTTP_Server On - {{- if .EnabledIPv6 }} + {{- if .Monitor.EnabledIPv6 }} HTTP_Listen [::] {{- else }} Listen 0.0.0.0 diff --git a/pkg/resources/fluentbit/configsecret.go b/pkg/resources/fluentbit/configsecret.go index ad5e418d8..ede0e2587 100644 --- a/pkg/resources/fluentbit/configsecret.go +++ b/pkg/resources/fluentbit/configsecret.go @@ -60,14 +60,14 @@ type upstream struct { type fluentBitConfig struct { Namespace string Monitor struct { - Enabled bool - Port int32 - Path string + Enabled bool + Port int32 + EnabledIPv6 bool + Path string } Flush int32 Grace int32 LogLevel string - EnabledIPv6 bool CoroStackSize int32 Output map[string]string ForceHotReloadAfterGrace bool @@ -219,7 +219,6 @@ func (r *Reconciler) configSecret() (runtime.Object, reconciler.DesiredState, er Grace: r.fluentbitSpec.Grace, ForceHotReloadAfterGrace: r.fluentbitSpec.ForceHotReloadAfterGrace, LogLevel: r.fluentbitSpec.LogLevel, - EnabledIPv6: r.fluentbitSpec.EnabledIPv6, CoroStackSize: r.fluentbitSpec.CoroStackSize, Namespace: r.Logging.Spec.ControlNamespace, DisableKubernetesFilter: disableKubernetesFilter, @@ -236,6 +235,7 @@ func (r *Reconciler) configSecret() (runtime.Object, reconciler.DesiredState, er if r.fluentbitSpec.Metrics != nil { input.Monitor.Enabled = true input.Monitor.Port = r.fluentbitSpec.Metrics.Port + input.Monitor.EnabledIPv6 = r.fluentbitSpec.EnabledIPv6 input.Monitor.Path = r.fluentbitSpec.Metrics.Path } diff --git a/pkg/resources/fluentd/config.go b/pkg/resources/fluentd/config.go index 80249b552..433ddef31 100644 --- a/pkg/resources/fluentd/config.go +++ b/pkg/resources/fluentd/config.go @@ -58,22 +58,18 @@ var fluentdInputTemplate = ` {{ if .Monitor.Enabled }} @type prometheus - port {{ .Monitor.Port }} -{{- if .Monitor.Path }} - metrics_path {{ .Monitor.Path }} -{{- end }} - -{{- if .EnabledIPv6 }} - - @type prometheus + {{- if .Monitor.EnabledIPv6 }} @id in_prometheus6 - bind [::] + bind "::" + {{- else }} + bind "0.0.0.0" + {{- end }} port {{ .Monitor.Port }} -{{- if .Monitor.Path }} + {{- if .Monitor.Path }} metrics_path {{ .Monitor.Path }} -{{- end }} + {{- end }} -{{- end }} + @type prometheus_monitor diff --git a/pkg/resources/fluentd/configsecret.go b/pkg/resources/fluentd/configsecret.go index 0b1c81e3f..4d7e3932e 100644 --- a/pkg/resources/fluentd/configsecret.go +++ b/pkg/resources/fluentd/configsecret.go @@ -27,13 +27,13 @@ import ( ) type fluentdConfig struct { - LogFormat string - LogLevel string - EnabledIPv6 bool - Monitor struct { - Enabled bool - Port int32 - Path string + LogFormat string + LogLevel string + Monitor struct { + Enabled bool + Port int32 + EnabledIPv6 bool + Path string } IgnoreSameLogInterval string IgnoreRepeatedLogInterval string @@ -63,7 +63,6 @@ func (r *Reconciler) generateConfigSecret(fluentdSpec v1beta1.FluentdSpec) (map[ Workers: fluentdSpec.Workers, LogFormat: fluentdSpec.LogFormat, LogLevel: fluentdSpec.LogLevel, - EnabledIPv6: fluentdSpec.EnabledIPv6, } input.RootDir = fluentdSpec.RootDir @@ -74,6 +73,7 @@ func (r *Reconciler) generateConfigSecret(fluentdSpec v1beta1.FluentdSpec) (map[ if fluentdSpec.Metrics != nil { input.Monitor.Enabled = true input.Monitor.Port = fluentdSpec.Metrics.Port + input.Monitor.EnabledIPv6 = fluentdSpec.EnabledIPv6 input.Monitor.Path = fluentdSpec.Metrics.Path }