Skip to content

Commit 31e8907

Browse files
committed
chore(fluentbit): add fluentbit
1 parent 74ddec8 commit 31e8907

15 files changed

Lines changed: 862 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*~
18+
# Various IDEs
19+
.project
20+
.idea/
21+
*.tmproj
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright Drycc Community.
2+
# SPDX-License-Identifier: APACHE-2.0
3+
4+
annotations:
5+
category: Fluentbit
6+
licenses: Apache-2.0
7+
apiVersion: v2
8+
appVersion: "2"
9+
dependencies:
10+
- name: common
11+
repository: oci://registry.drycc.cc/charts
12+
version: ~1.1.2
13+
description: An End to End Observability Pipeline
14+
home: https://fluentbit.io
15+
icon: https://avatars.githubusercontent.com/u/859518?s=48&v=4
16+
keywords:
17+
- fluentbit
18+
- logging
19+
- metrics
20+
- forwarder
21+
maintainers:
22+
- name: Drycc Community.
23+
url: https://github.com/drycc-addons/addons
24+
name: fluentbit
25+
sources:
26+
- https://github.com/drycc-addons/addons/tree/main/addons/fluentbit
27+
version: 2.1.8
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Copyright Drycc Community.
3+
SPDX-License-Identifier: APACHE-2.0
4+
*/}}
5+
6+
{{/*
7+
Return the proper Fluentbit image name
8+
*/}}
9+
{{- define "fluentbit.image" -}}
10+
{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }}
11+
{{- end -}}
12+
13+
14+
{{/*
15+
Return the proper Docker Image Registry Secret Names
16+
*/}}
17+
{{- define "fluentbit.imagePullSecrets" -}}
18+
{{- include "common.images.renderPullSecrets" (dict "images" (list .Values.image) "context" $) -}}
19+
{{- end -}}
20+
21+
{{/*
22+
Name the fluentbit configmap
23+
*/}}
24+
{{- define "fluentbit.configMap" -}}
25+
{{- printf "%s-config" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" -}}
26+
{{- end -}}
27+
28+
{{/*
29+
Create the name of the service account to use
30+
*/}}
31+
{{- define "fluentbit.serviceAccountName" -}}
32+
{{- if .Values.serviceAccount.create -}}
33+
{{ default (include "common.names.fullname" .) .Values.serviceAccount.name }}
34+
{{- else -}}
35+
{{ default "default" .Values.serviceAccount.name }}
36+
{{- end -}}
37+
{{- end -}}
38+
39+
{{/*
40+
Name the daemonset fullname
41+
*/}}
42+
{{- define "fluentbit.daemonset.fullname" -}}
43+
{{- printf "%s-agent" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" -}}
44+
{{- end -}}
45+
46+
{{/*
47+
Name the deployment fullname
48+
*/}}
49+
{{- define "fluentbit.deployment.fullname" -}}
50+
{{- printf "%s-controller" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" -}}
51+
{{- end -}}
52+
53+
{{/*
54+
Return the Fluentbit Reloader image name
55+
*/}}
56+
{{- define "fluentbit.reloader.image" -}}
57+
{{- if and .Values.reloader.image.repository .Values.reloader.image.tag -}}
58+
{{- include "common.images.image" (dict "imageRoot" .Values.reloader.image "global" .Values.global) -}}
59+
{{- else -}}
60+
{{- include "fluentbit.image" . -}}
61+
{{- end -}}
62+
{{- end -}}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{{- /*
2+
Copyright Drycc Community.
3+
SPDX-License-Identifier: APACHE-2.0
4+
*/}}
5+
6+
apiVersion: v1
7+
kind: ConfigMap
8+
metadata:
9+
name: {{ include "fluentbit.configMap" . }}
10+
namespace: {{ include "common.names.namespace" . | quote }}
11+
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
12+
{{- if .Values.commonAnnotations }}
13+
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
14+
{{- end }}
15+
data:
16+
parsers.conf: |
17+
{{- (tpl .Values.daemonset.config.parsers $) | nindent 4 }}
18+
fluentbit.conf: |
19+
{{- (tpl .Values.daemonset.config.service $) | nindent 4 }}
20+
{{- (tpl .Values.daemonset.config.inputs $) | nindent 4 }}
21+
{{- (tpl .Values.daemonset.config.outputs $) | nindent 4 }}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
apiVersion: apps/v1
2+
kind: DaemonSet
3+
metadata:
4+
name: {{ include "fluentbit.daemonset.fullname" . }}
5+
namespace: {{ include "common.names.namespace" . | quote }}
6+
{{- $podLabels := include "common.tplvalues.merge" (dict "values" (list .Values.daemonset.podLabels .Values.commonLabels) "context" .) }}
7+
labels: {{- include "common.labels.standard" ( dict "customLabels" $podLabels "context" $ ) | nindent 4 }}
8+
{{- if .Values.daemonset.podAnnotations }}
9+
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.daemonset.podAnnotations "context" $) | nindent 4 }}
10+
{{- end }}
11+
spec:
12+
{{- if .Values.daemonset.updateStrategy }}
13+
updateStrategy: {{- toYaml .Values.daemonset.updateStrategy | nindent 4 }}
14+
{{- end }}
15+
selector:
16+
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
17+
template:
18+
metadata:
19+
labels: {{- include "common.labels.standard" ( dict "customLabels" $podLabels "context" $ ) | nindent 8 }}
20+
spec:
21+
affinity:
22+
nodeAffinity:
23+
requiredDuringSchedulingIgnoredDuringExecution:
24+
nodeSelectorTerms:
25+
- matchExpressions:
26+
- key: kubernetes.io/hostname
27+
operator: In
28+
values:
29+
- {{randAlphaNum 32}}
30+
{{- include "fluentbit.imagePullSecrets" . | nindent 6 }}
31+
containers:
32+
- name: reloader
33+
image: {{ include "fluentbit.reloader.image" . }}
34+
imagePullPolicy: {{ .Values.reloader.image.pullPolicy }}
35+
{{- if .Values.reloader.containerSecurityContext.enabled }}
36+
securityContext: {{- omit .Values.reloader.containerSecurityContext "enabled" | toYaml | nindent 10 }}
37+
{{- end }}
38+
args:
39+
- -w
40+
- /opt/drycc/fluent-bit/etc/fluent-bit
41+
- -d
42+
- "{{ .Values.reloader.delayInterval }}"
43+
- --
44+
- curl
45+
- -X
46+
- POST
47+
- -d
48+
- '{}'
49+
- 127.0.0.1:2020/api/v2/reload
50+
volumeMounts:
51+
- name: {{ include "fluentbit.configMap" . }}
52+
mountPath: /opt/drycc/fluent-bit/etc/fluent-bit
53+
{{- if .Values.reloader.resources }}
54+
resources: {{- toYaml .Values.reloader.resources | nindent 10 }}
55+
{{- end }}
56+
- name: fluentbit
57+
image: {{ include "fluentbit.image" . }}
58+
imagePullPolicy: {{ .Values.image.pullPolicy }}
59+
resources: {{ toYaml .Values.daemonset.resources | nindent 10 }}
60+
args:
61+
- fluent-bit
62+
- -c
63+
- /opt/drycc/fluent-bit/etc/fluent-bit/fluentbit.conf
64+
volumeMounts:
65+
- name: data
66+
mountPath: /data
67+
- name: varlog
68+
mountPath: /var/log
69+
- name: {{ include "fluentbit.configMap" . }}
70+
mountPath: /opt/drycc/fluent-bit/etc/fluent-bit
71+
volumes:
72+
- name: data
73+
emptyDir: {}
74+
- name: varlog
75+
hostPath:
76+
path: /var/log
77+
- name: {{ include "fluentbit.configMap" . }}
78+
configMap:
79+
name: {{ include "fluentbit.configMap" . }}
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
{{- /*
2+
Copyright Drycc Community.
3+
SPDX-License-Identifier: APACHE-2.0
4+
*/}}
5+
6+
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
7+
kind: Deployment
8+
metadata:
9+
name: {{ include "fluentbit.deployment.fullname" . }}
10+
namespace: {{ include "common.names.namespace" . | quote }}
11+
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
12+
{{- if or .Values.deployment.deploymentAnnotations .Values.commonAnnotations }}
13+
{{- $annotations := include "common.tplvalues.merge" (dict "values" (list .Values.deployment.deploymentAnnotations .Values.commonAnnotations) "context" .) }}
14+
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }}
15+
{{- end }}
16+
spec:
17+
replicas: 1
18+
{{- if .Values.deployment.updateStrategy }}
19+
strategy: {{- toYaml .Values.deployment.updateStrategy | nindent 4 }}
20+
{{- end }}
21+
{{- $podLabels := include "common.tplvalues.merge" (dict "values" (list .Values.deployment.podLabels .Values.commonLabels) "context" .) }}
22+
selector:
23+
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
24+
template:
25+
metadata:
26+
{{- if .Values.deployment.podAnnotations }}
27+
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.deployment.podAnnotations "context" $) | nindent 8 }}
28+
{{- end }}
29+
labels: {{- include "common.labels.standard" ( dict "customLabels" $podLabels "context" $ ) | nindent 8 }}
30+
spec:
31+
serviceAccountName: {{ template "fluentbit.serviceAccountName" . }}
32+
{{- include "fluentbit.imagePullSecrets" . | nindent 6 }}
33+
{{- if .Values.deployment.hostAliases }}
34+
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.deployment.hostAliases "context" $) | nindent 8 }}
35+
{{- end }}
36+
{{- if .Values.deployment.affinity }}
37+
affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.deployment.affinity "context" $) | nindent 8 }}
38+
{{- else }}
39+
affinity:
40+
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.deployment.podAffinityPreset "component" "deployment" "customLabels" $podLabels "context" $) | nindent 10 }}
41+
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.deployment.podAntiAffinityPreset "component" "deployment" "customLabels" $podLabels "context" $) | nindent 10 }}
42+
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.deployment.nodeAffinityPreset.type "key" .Values.deployment.nodeAffinityPreset.key "values" .Values.deployment.nodeAffinityPreset.values) | nindent 10 }}
43+
{{- end }}
44+
{{- if .Values.deployment.nodeSelector }}
45+
nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.deployment.nodeSelector "context" $) | nindent 8 }}
46+
{{- end }}
47+
{{- if .Values.deployment.tolerations }}
48+
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.deployment.tolerations "context" .) | nindent 8 }}
49+
{{- end }}
50+
{{- if .Values.deployment.priorityClassName }}
51+
priorityClassName: {{ .Values.deployment.priorityClassName | quote }}
52+
{{- end }}
53+
{{- if .Values.deployment.schedulerName }}
54+
schedulerName: {{ .Values.deployment.schedulerName | quote }}
55+
{{- end }}
56+
{{- if .Values.deployment.topologySpreadConstraints }}
57+
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.deployment.topologySpreadConstraints "context" .) | nindent 8 }}
58+
{{- end }}
59+
{{- if .Values.deployment.podSecurityContext.enabled }}
60+
securityContext: {{- omit .Values.deployment.podSecurityContext "enabled" | toYaml | nindent 8 }}
61+
{{- end }}
62+
{{- if .Values.deployment.terminationGracePeriodSeconds }}
63+
terminationGracePeriodSeconds: {{ .Values.deployment.terminationGracePeriodSeconds }}
64+
{{- end }}
65+
containers:
66+
- name: controller
67+
image: {{ include "fluentbit.image" . }}
68+
imagePullPolicy: {{ .Values.image.pullPolicy }}
69+
{{- if .Values.deployment.containerSecurityContext.enabled }}
70+
securityContext: {{- omit .Values.deployment.containerSecurityContext "enabled" | toYaml | nindent 10 }}
71+
{{- end }}
72+
{{- if .Values.diagnosticMode.enabled }}
73+
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 10 }}
74+
{{- else if .Values.deployment.command }}
75+
command: {{- include "common.tplvalues.render" (dict "value" .Values.deployment.command "context" $) | nindent 10 }}
76+
{{- end }}
77+
{{- if .Values.diagnosticMode.enabled }}
78+
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 10 }}
79+
{{- else if .Values.deployment.args }}
80+
args: {{- include "common.tplvalues.render" (dict "value" .Values.deployment.args "context" $) | nindent 10 }}
81+
{{- end }}
82+
env:
83+
- name: FLUENTBIT_EXTRA_ARGS
84+
value: --namespace {{ .Release.Namespace }} --daemonset-name {{ include "fluentbit.daemonset.fullname" . }} --retry-interval {{ .Values.deployment.retryInterval }}
85+
- name: DRYCC_DEBUG
86+
value: {{ ternary "true" "false" (or .Values.image.debug .Values.diagnosticMode.enabled) | quote }}
87+
{{- if .Values.deployment.extraEnvVars }}
88+
{{- include "common.tplvalues.render" (dict "value" .Values.deployment.extraEnvVars "context" $) | nindent 10 }}
89+
{{- end }}
90+
envFrom:
91+
{{- if .Values.deployment.extraEnvVarsCM }}
92+
- configMapRef:
93+
name: {{ include "common.tplvalues.render" (dict "value" .Values.deployment.extraEnvVarsCM "context" $) }}
94+
{{- end }}
95+
{{- if .Values.deployment.extraEnvVarsSecret }}
96+
- secretRef:
97+
name: {{ include "common.tplvalues.render" (dict "value" .Values.deployment.extraEnvVarsSecret "context" $) }}
98+
{{- end }}
99+
{{- if .Values.deployment.resources }}
100+
resources: {{- toYaml .Values.deployment.resources | nindent 12 }}
101+
{{- end }}
102+
{{- if .Values.deployment.sidecars }}
103+
{{- include "common.tplvalues.render" ( dict "value" .Values.deployment.sidecars "context" $) | nindent 8 }}
104+
{{- end }}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{{- /*
2+
Copyright Drycc Community.
3+
SPDX-License-Identifier: APACHE-2.0
4+
*/}}
5+
6+
{{ if .Values.rbac.create }}
7+
kind: Role
8+
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
9+
metadata:
10+
name: {{ include "common.names.fullname" . }}
11+
namespace: {{ include "common.names.namespace" . | quote }}
12+
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
13+
{{- if .Values.commonAnnotations }}
14+
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
15+
{{- end }}
16+
rules:
17+
- apiGroups: [""]
18+
resources: ["pods"]
19+
verbs: ["get", "list", "watch", "create", "update", "delete"]
20+
- apiGroups: ["apps"]
21+
resources: ["daemonsets"]
22+
verbs: ["get", "list", "create", "update", "patch", "delete"]
23+
{{- if .Values.rbac.rules }}
24+
{{- include "common.tplvalues.render" ( dict "value" .Values.rbac.rules "context" $ ) | nindent 2 }}
25+
{{- end }}
26+
{{- end }}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{{- /*
2+
Copyright Drycc Community.
3+
SPDX-License-Identifier: APACHE-2.0
4+
*/}}
5+
6+
{{- if and .Values.serviceAccount.create .Values.rbac.create }}
7+
kind: RoleBinding
8+
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
9+
metadata:
10+
name: {{ include "common.names.fullname" . }}
11+
namespace: {{ include "common.names.namespace" . | quote }}
12+
labels: {{- include "common.labels.standard" . | nindent 4 }}
13+
{{- if .Values.commonLabels }}
14+
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
15+
{{- end }}
16+
{{- if .Values.commonAnnotations }}
17+
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
18+
{{- end }}
19+
subjects:
20+
- kind: ServiceAccount
21+
name: {{ include "fluentbit.serviceAccountName" . }}
22+
roleRef:
23+
apiGroup: rbac.authorization.k8s.io
24+
kind: Role
25+
name: {{ include "common.names.fullname" . -}}
26+
{{- end }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{{- /*
2+
Copyright Drycc Community.
3+
SPDX-License-Identifier: APACHE-2.0
4+
*/}}
5+
6+
{{- if .Values.serviceAccount.create }}
7+
apiVersion: v1
8+
kind: ServiceAccount
9+
metadata:
10+
name: {{ include "fluentbit.serviceAccountName" . }}
11+
namespace: {{ include "common.names.namespace" . | quote }}
12+
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
13+
app.kubernetes.io/component: controller
14+
{{- if or .Values.serviceAccount.annotations .Values.commonAnnotations }}
15+
{{- $annotations := include "common.tplvalues.merge" (dict "values" (list .Values.serviceAccount.annotations .Values.commonAnnotations) "context" .) }}
16+
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }}
17+
{{- end }}
18+
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
19+
{{- end }}

0 commit comments

Comments
 (0)