Skip to content

Commit b6aa5be

Browse files
authored
Feature/multi fluentbit support (#665)
NodeAgent Support
1 parent 620eb41 commit b6aa5be

File tree

31 files changed

+8884
-30
lines changed

31 files changed

+8884
-30
lines changed

charts/logging-demo/requirements.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ dependencies:
66
repository: https://kubernetes-charts.banzaicloud.com/
77
version: 0.1.5
88
digest: sha256:8c6a3777c9e971fc03bad54b76fa62ef58b07f73436121522c7a6e97fce6ece5
9-
generated: "2021-01-20T11:35:41.461008+01:00"
9+
generated: "2021-01-08T16:16:09.458546+01:00"

charts/logging-operator-logging/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ The following tables lists the configurable parameters of the logging-operator-l
4242
| `fluentd.tolerations` | Tolerations for fluentd statefulset | none |
4343
| `fluentd.nodeSelector` | Node selector for fluentd pods | none |
4444
| `fluentd.podPriorityClassName` | Priority class name for fluentd pods | none |
45+
| `nodeAgents` | Node agents definitions | {}} |
4546
| `defaultFlow` | Default Flow | {} |
4647
| `clusterFlows` | Array of ClusterFlows to be created | [] |
4748
| `clusterOutputs` | Array of ClusterOutputs to be created | [] |

charts/logging-operator-logging/templates/logging.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,9 @@ spec:
5454
{{- else }}
5555
fluentbit: {}
5656
{{- end }}
57-
57+
{{- if .Values.nodeAgents }}
58+
nodeAgents:
59+
{{ toYaml .Values.nodeAgents | indent 4 }}
60+
{{- else }}
61+
nodeAgents: []
62+
{{- end }}

charts/logging-operator-logging/values.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,31 @@ enableRecreateWorkloadOnImmutableFieldChange: false
1818

1919
# Fluent-bit configurations https://banzaicloud.com/docs/one-eye/logging-operator/configuration/crds/#fluent-bit-spec
2020
fluentbit: {}
21+
22+
#Node agent Definition
23+
nodeAgents: {}
24+
# - name: win-agent
25+
# profile: windows
26+
# nodeAgentFluentbit:
27+
# daemonSet:
28+
# spec:
29+
# template:
30+
# spec:
31+
# containers:
32+
# - image: banzaicloud/fluentbit:1.6.10
33+
# name: fluent-bit
34+
# tls:
35+
# enabled: false
36+
# - name: linux-agent
37+
# profile: linux
38+
# nodeAgentFluentbit:
39+
# metrics:
40+
# prometheusAnnotations: true
41+
# serviceMonitor: false
42+
# tls:
43+
# enabled: false
44+
45+
2146
# Fluentd configurations https://banzaicloud.com/docs/one-eye/logging-operator/configuration/crds/#fluentd-spec
2247
fluentd: {}
2348
# 20Gi persistent storage is configured for fluentd by default.

charts/logging-operator/crds/logging.banzaicloud.io_loggings.yaml

Lines changed: 3559 additions & 0 deletions
Large diffs are not rendered by default.

cmd/docs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func plugins() {
6666
For more information please click on the plugin name
6767
<center>
6868
69-
| Name | Type | Description | Status |Version |
69+
| Name | Profile | Description | Status |Version |
7070
|:---|---|:---|:---:|---:|`,
7171
)
7272

config/crd/bases/logging.banzaicloud.io_loggings.yaml

Lines changed: 3559 additions & 0 deletions
Large diffs are not rendered by default.

controllers/logging_controller.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"github.com/banzaicloud/logging-operator/pkg/resources/fluentbit"
2525
"github.com/banzaicloud/logging-operator/pkg/resources/fluentd"
2626
"github.com/banzaicloud/logging-operator/pkg/resources/model"
27+
"github.com/banzaicloud/logging-operator/pkg/resources/nodeagent"
2728
"github.com/banzaicloud/logging-operator/pkg/sdk/model/render"
2829
"github.com/banzaicloud/operator-tools/pkg/reconciler"
2930
"github.com/banzaicloud/operator-tools/pkg/secret"
@@ -120,6 +121,10 @@ func (r *LoggingReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
120121
reconcilers = append(reconcilers, fluentbit.New(r.Client, r.Log, &logging, reconcilerOpts).Reconcile)
121122
}
122123

124+
if len(logging.Spec.NodeAgents) > 0 {
125+
reconcilers = append(reconcilers, nodeagent.New(r.Client, r.Log, &logging, reconcilerOpts).Reconcile)
126+
}
127+
123128
for _, rec := range reconcilers {
124129
result, err := rec()
125130
if err != nil {
@@ -224,6 +229,7 @@ func SetupLoggingWithManager(mgr ctrl.Manager, logger logr.Logger) *ctrl.Builder
224229

225230
fluentd.RegisterWatches(builder)
226231
fluentbit.RegisterWatches(builder)
232+
nodeagent.RegisterWatches(builder)
227233

228234
return builder
229235
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# escape=`
2+
3+
ARG WINDOWS_VERSION=ltsc2019
4+
5+
#
6+
# Builder Image - Windows Server Core
7+
#
8+
FROM mcr.microsoft.com/windows/servercore:$WINDOWS_VERSION as builder
9+
10+
# The FLUENTBIT_VERSION ARG must be after the FROM instruction
11+
ARG FLUENTBIT_VERSION=1.6.10
12+
ARG IMAGE_CREATE_DATE
13+
ARG IMAGE_SOURCE_REVISION
14+
15+
# Metadata as defined in OCI image spec annotations
16+
# https://github.com/opencontainers/image-spec/blob/master/annotations.md
17+
LABEL org.opencontainers.image.title="Fluent Bit" `
18+
org.opencontainers.image.description="Fluent Bit is an open source and multi-platform Log Processor and Forwarder which allows you to collect data/logs from different sources, unify and send them to multiple destinations. It's fully compatible with Docker and Kubernetes environments." `
19+
org.opencontainers.image.created=$IMAGE_CREATE_DATE `
20+
org.opencontainers.image.version=$FLUENTBIT_VERSION `
21+
org.opencontainers.image.authors="Eduardo Silva <[email protected]>" `
22+
org.opencontainers.image.url="https://hub.docker.com/r/fluent/fluent-bit" `
23+
org.opencontainers.image.documentation="https://docs.fluentbit.io/manual/" `
24+
org.opencontainers.image.vendor="Fluent Organization" `
25+
org.opencontainers.image.licenses="Apache-2.0" `
26+
org.opencontainers.image.source="https://github.com/fluent/fluent-bit" `
27+
org.opencontainers.image.revision=$IMAGE_SOURCE_REVISION
28+
29+
#
30+
# Basic setup
31+
#
32+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
33+
34+
RUN Write-Host ('Creating folders'); `
35+
New-Item -Type Directory -Path /local; `
36+
New-Item -Type Directory -Path /fluent-bit;
37+
38+
WORKDIR /local
39+
40+
#
41+
# Install Fluent Bit
42+
#
43+
RUN Write-Host ('Installing Fluent Bit'); `
44+
$majorminor = ([Version]::Parse("$env:FLUENTBIT_VERSION")).toString(2); `
45+
Invoke-WebRequest -Uri "https://fluentbit.io/releases/$($majorminor)/td-agent-bit-$($env:FLUENTBIT_VERSION)-win64.zip" -OutFile td-agent-bit.zip; `
46+
Expand-Archive -Path td-agent-bit.zip -Destination /local/fluent-bit; `
47+
Move-Item -Path /local/fluent-bit/*/* -Destination /fluent-bit/;
48+
49+
#
50+
# Technique from https://github.com/StefanScherer/dockerfiles-windows/blob/master/mongo/3.6/Dockerfile
51+
#
52+
ADD https://aka.ms/vs/15/release/vc_redist.x64.exe /local/vc_redist.x64.exe
53+
54+
RUN Write-Host ('Installing Visual C++ Redistributable Package'); `
55+
Start-Process /local/vc_redist.x64.exe -ArgumentList '/install', '/quiet', '/norestart' -NoNewWindow -Wait; `
56+
Copy-Item -Path /Windows/System32/msvcp140.dll -Destination /fluent-bit/bin/; `
57+
Copy-Item -Path /Windows/System32/vccorlib140.dll -Destination /fluent-bit/bin/; `
58+
Copy-Item -Path /Windows/System32/vcruntime140.dll -Destination /fluent-bit/bin/;
59+
60+
#
61+
# Runtime Image - Windows Server Nano
62+
#
63+
FROM mcr.microsoft.com/windows/servercore:$WINDOWS_VERSION as runtime
64+
65+
COPY --from=builder /fluent-bit /fluent-bit
66+
67+
RUN setx /M PATH "%PATH%;C:\fluent-bit\bin"
68+
69+
ENTRYPOINT ["fluent-bit.exe", "-i", "dummy", "-o", "stdout"]

go.mod

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ require (
77
github.com/MakeNowJust/heredoc v1.0.0
88
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883
99
github.com/banzaicloud/logging-operator/pkg/sdk v0.0.0
10-
github.com/banzaicloud/operator-tools v0.15.0
10+
github.com/banzaicloud/operator-tools v0.20.1
1111
github.com/go-logr/logr v0.2.1
1212
github.com/onsi/gomega v1.10.1
1313
github.com/pborman/uuid v1.2.0
@@ -24,5 +24,3 @@ require (
2424
replace k8s.io/client-go => k8s.io/client-go v0.19.2
2525

2626
replace github.com/banzaicloud/logging-operator/pkg/sdk => ./pkg/sdk
27-
28-
//replace github.com/banzaicloud/operator-tools => ../operator-tools

0 commit comments

Comments
 (0)