Skip to content

Commit

Permalink
feat(fluent-bit): yaml configuration support
Browse files Browse the repository at this point in the history
Signed-off-by: ABWassim <[email protected]>
  • Loading branch information
ABWassim committed Oct 4, 2024
1 parent 5b3161a commit 46518d1
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 5 deletions.
5 changes: 5 additions & 0 deletions charts/fluent-bit/templates/_pod.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ containers:
{{- if .Values.hotReload.enabled }}
- --enable-hot-reload
{{- end }}
{{- if .Values.useYamlConfig }}
- --config=/fluent-bit/etc/conf/fluent-bit.yaml
{{- else }}
- --config=/fluent-bit/etc/conf/fluent-bit.conf
{{- end }}
{{- end}}
ports:
- name: http
Expand Down
21 changes: 17 additions & 4 deletions charts/fluent-bit/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,24 @@ metadata:
data:
custom_parsers.conf: |
{{- (tpl .Values.config.customParsers $) | nindent 4 }}
{{ if .Values.useYamlConfig -}}
fluent-bit.yaml: |
service:
{{- tpl (toYaml .Values.yamlConfig.service) . | nindent 6 }}
pipeline:
inputs:
{{- tpl (toYaml .Values.yamlConfig.pipeline.inputs) . | nindent 8 }}
filters:
{{- tpl (toYaml .Values.yamlConfig.pipeline.filters) . | nindent 8 }}
outputs:
{{- tpl (toYaml .Values.yamlConfig.pipeline.outputs) . | nindent 8 }}
{{ else -}}
fluent-bit.conf: |
{{- (tpl .Values.config.service $) | nindent 4 }}
{{- (tpl .Values.config.inputs $) | nindent 4 }}
{{- (tpl .Values.config.filters $) | nindent 4 }}
{{- (tpl .Values.config.outputs $) | nindent 4 }}
{{- (tpl .Values.config.service .) | nindent 4 }}
{{- (tpl .Values.config.inputs .) | nindent 4 }}
{{- (tpl .Values.config.filters .) | nindent 4 }}
{{- (tpl .Values.config.outputs .) | nindent 4 }}
{{ end -}}
{{- range $key, $val := .Values.config.upstream }}
{{ $key }}: |
{{- (tpl $val $) | nindent 4 }}
Expand Down
45 changes: 44 additions & 1 deletion charts/fluent-bit/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,50 @@ networkPolicy:

luaScripts: {}

useYamlConfig: false

yamlConfig:
service:
daemon: "Off"
flush: '{{ .Values.flush }}'
log_level: '{{ .Values.logLevel }}'
parsers_file: "/fluent-bit/etc/parsers.conf"
http_server: "On"
http_listen: "0.0.0.0"
http_port: '{{ .Values.metricsPort }}'
Health_Check: "On"
pipeline:
inputs:
- name: tail
path: "/var/log/containers/*.log"
multiline.parser: "docker, cri"
Tag: "kube.*"
Mem_Buf_Limit: "5MB"
Skip_Long_Lines: "On"
- name: systemd
Tag: host.*
Systemd_Filter: "_SYSTEMD_UNIT=kubelet.service"
Read_From_Tail: "On"
filters:
- name: kubernetes
match: kube.*
Merge_Log: "On"
Keep_Log: "Off"
K8S-Logging.Parser: "On"
K8S-Logging.Exclude: "On"
outputs:
- name: es
match: kube.*
Host: elasticsearch-master
Logstash_Format: "On"
Retry_Limit: "False"
- name: es
match: host.*
Host: elasticsearch-master
Logstash_Format: "On"
Logstash_Prefix: "node"
Retry_Limit: "False"

## https://docs.fluentbit.io/manual/administration/configuring-fluent-bit/classic-mode/configuration-file
config:
service: |
Expand Down Expand Up @@ -483,7 +527,6 @@ command:

args:
- --workdir=/fluent-bit/etc
- --config=/fluent-bit/etc/conf/fluent-bit.conf

# This supports either a structured array or a templatable string
initContainers: []
Expand Down

0 comments on commit 46518d1

Please sign in to comment.