Skip to content

Commit

Permalink
feat: support enableipv6 for fluentbit and fluentd
Browse files Browse the repository at this point in the history
Signed-off-by: withlin <[email protected]>
  • Loading branch information
withlin committed Dec 1, 2024
1 parent f4c6bbf commit 42b1029
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1167,6 +1167,8 @@ spec:
type: string
enableUpstream:
type: boolean
enabledIPv6:
type: boolean
envVars:
items:
properties:
Expand Down Expand Up @@ -1588,8 +1590,6 @@ spec:
storage.type:
type: string
type: object
ipFamilies:
type: string
labels:
additionalProperties:
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2214,6 +2214,8 @@ spec:
type: string
enableUpstream:
type: boolean
enabledIPv6:
type: boolean
envVars:
items:
properties:
Expand Down Expand Up @@ -2635,8 +2637,6 @@ spec:
storage.type:
type: string
type: object
ipFamilies:
type: string
labels:
additionalProperties:
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1164,6 +1164,8 @@ spec:
type: string
enableUpstream:
type: boolean
enabledIPv6:
type: boolean
envVars:
items:
properties:
Expand Down Expand Up @@ -1585,8 +1587,6 @@ spec:
storage.type:
type: string
type: object
ipFamilies:
type: string
labels:
additionalProperties:
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2211,6 +2211,8 @@ spec:
type: string
enableUpstream:
type: boolean
enabledIPv6:
type: boolean
envVars:
items:
properties:
Expand Down Expand Up @@ -2632,8 +2634,6 @@ spec:
storage.type:
type: string
type: object
ipFamilies:
type: string
labels:
additionalProperties:
type: string
Expand Down
4 changes: 2 additions & 2 deletions config/crd/bases/logging.banzaicloud.io_fluentbitagents.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1164,6 +1164,8 @@ spec:
type: string
enableUpstream:
type: boolean
enabledIPv6:
type: boolean
envVars:
items:
properties:
Expand Down Expand Up @@ -1585,8 +1587,6 @@ spec:
storage.type:
type: string
type: object
ipFamilies:
type: string
labels:
additionalProperties:
type: string
Expand Down
4 changes: 2 additions & 2 deletions config/crd/bases/logging.banzaicloud.io_loggings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2211,6 +2211,8 @@ spec:
type: string
enableUpstream:
type: boolean
enabledIPv6:
type: boolean
envVars:
items:
properties:
Expand Down Expand Up @@ -2632,8 +2634,6 @@ spec:
storage.type:
type: string
type: object
ipFamilies:
type: string
labels:
additionalProperties:
type: string
Expand Down
6 changes: 3 additions & 3 deletions pkg/resources/fluentbit/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ var fluentBitConfigTemplate = `
Coro_Stack_Size {{ .CoroStackSize }}
{{- if .Monitor.Enabled }}
HTTP_Server On
{{- if eq .IPFamily "IPv4" }}
{{- if .Monitor.EnabledIPv6 }}
HTTP_Listen [::]
{{- else }}
Listen 0.0.0.0
{{- else if eq .IPFamily "IPv6" }}
Listen ::
{{- end }}
HTTP_Port {{ .Monitor.Port }}
{{- end }}
Expand Down
4 changes: 2 additions & 2 deletions pkg/resources/fluentbit/configsecret.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ type fluentBitConfig struct {
Flush int32
Grace int32
LogLevel string
IPFamily string
EnabledIPv6 bool
CoroStackSize int32
Output map[string]string
Input fluentbitInputConfig
Expand Down Expand Up @@ -217,7 +217,7 @@ func (r *Reconciler) configSecret() (runtime.Object, reconciler.DesiredState, er
Flush: r.fluentbitSpec.Flush,
Grace: r.fluentbitSpec.Grace,
LogLevel: r.fluentbitSpec.LogLevel,
IPFamily: r.fluentbitSpec.IPFamily,
EnabledIPv6: r.fluentbitSpec.EnabledIPv6,
CoroStackSize: r.fluentbitSpec.CoroStackSize,
Namespace: r.Logging.Spec.ControlNamespace,
DisableKubernetesFilter: disableKubernetesFilter,
Expand Down
2 changes: 1 addition & 1 deletion pkg/resources/fluentd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ var fluentdInputTemplate = `
metrics_path {{ .Monitor.Path }}
{{- end }}
</source>
{{{{ if .Monitor.EnabledIPv6 }}}}
{{- if .Monitor.EnabledIPv6 }}
<source>
@type prometheus
@id in_prometheus6
Expand Down
2 changes: 1 addition & 1 deletion pkg/sdk/logging/api/v1beta1/fluentbit_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ type FluentbitSpec struct {
TLS *FluentbitTLS `json:"tls,omitempty"`
TargetHost string `json:"targetHost,omitempty"`
TargetPort int32 `json:"targetPort,omitempty"`
IPFamily string `json:"ipFamilies,omitempty" plugin:"default:ipv4"`
EnabledIPv6 bool `json:"enabledIPv6,omitempty"`
// Set the flush time in seconds.nanoseconds. The engine loop uses a Flush timeout to define when is required to flush the records ingested by input plugins through the defined output plugins. (default: 1)
Flush int32 `json:"flush,omitempty" plugin:"default:1"`
// Set the grace time in seconds as Integer value. The engine loop uses a Grace timeout to define wait time on exit.
Expand Down

0 comments on commit 42b1029

Please sign in to comment.