Skip to content

Commit b648d72

Browse files
danielpodwysockicw-Guo
authored andcommitted
expose Enable_Chunk_Trace in the crd, enabling TAP debuging
implements #1586 closes #1586 This enables the users to turn debug traces on/off, as per https://docs.fluentbit.io/manual/administration/troubleshooting I validate that I can spin up the operator and: - enable/disable the option, it respects the SIGHUP&hot reload correcty - see the expected result - I can now switch to a debug image and use the curl API to enable tracing In my testing I used the following spec: ``` apiVersion: fluentbit.fluent.io/v1alpha2 kind: FluentBit metadata: name: fluent-bit namespace: fluent labels: app.kubernetes.io/name: fluent-bit spec: # renovate: datasource=docker depName=ghcr.io/fluent/fluent-operator/fluent-bit image: ghcr.io/fluent/fluent-operator/fluent-bit:4.0-debug fluentBitConfigName: fluent-bit-config --- apiVersion: fluentbit.fluent.io/v1alpha2 kind: ClusterFluentBitConfig metadata: name: fluent-bit-config namespace: fluent labels: app.kubernetes.io/name: fluent-bit spec: service: enableChunkTrace: true httpServer: true httpListen: "127.0.0.1" inputSelector: matchLabels: fluentbit.fluent.io/enabled: "true" outputSelector: matchLabels: fluentbit.fluent.io/enabled: "true" --- apiVersion: fluentbit.fluent.io/v1alpha2 kind: ClusterInput metadata: name: dummy labels: fluentbit.fluent.io/enabled: "true" spec: alias: dummy dummy: tag: my_dummy --- apiVersion: fluentbit.fluent.io/v1alpha2 kind: ClusterOutput metadata: name: stdout labels: fluentbit.fluent.io/enabled: "true" spec: alias: stdout match: "*" stdout: {} ``` I could exec into the container and enable tracing with: ``` curl 127.0.0.1:2020/api/v1/trace/dummy ``` To disable it, I ran: ``` curl -X DELETE 127.0.0.1:2020/api/v1/trace/dummy ``` I saw the correct output reflected on fluentbit container log. Signed-off-by: Daniel Podwysocki <[email protected]>
1 parent f668cca commit b648d72

File tree

8 files changed

+42
-0
lines changed

8 files changed

+42
-0
lines changed

apis/fluentbit/v1alpha2/clusterfluentbitconfig_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ type Storage struct {
7979
type Service struct {
8080
// If true go to background on start
8181
Daemon *bool `json:"daemon,omitempty"`
82+
// Enable input/output tracing on debug images, controlled more granualry via the http API
83+
EnableChunkTrace *bool `json:"enableChunkTrace,omitempty"`
8284
// Interval to flush output
8385
FlushSeconds *float64 `json:"flushSeconds,omitempty"`
8486
// Wait time on exit
@@ -153,6 +155,9 @@ func (s *Service) Params() *params.KVs {
153155
if s.Daemon != nil {
154156
m.Insert("Daemon", fmt.Sprint(*s.Daemon))
155157
}
158+
if s.EnableChunkTrace != nil {
159+
m.Insert("Enable_Chunk_Trace", fmt.Sprint(*s.EnableChunkTrace))
160+
}
156161
if s.FlushSeconds != nil {
157162
m.Insert("Flush", fmt.Sprint(*s.FlushSeconds))
158163
}

apis/fluentbit/v1alpha2/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_clusterfluentbitconfigs.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,10 @@ spec:
299299
type: string
300300
emitterStorageType:
301301
type: string
302+
enableChunkTrace:
303+
description: Enable input/output tracing on debug images, controlled
304+
more granualry via the http API
305+
type: boolean
302306
flushSeconds:
303307
description: Interval to flush output
304308
type: number

charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_fluentbitconfigs.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,10 @@ spec:
331331
type: string
332332
emitterStorageType:
333333
type: string
334+
enableChunkTrace:
335+
description: Enable input/output tracing on debug images, controlled
336+
more granualry via the http API
337+
type: boolean
334338
flushSeconds:
335339
description: Interval to flush output
336340
type: number

config/crd/bases/fluentbit.fluent.io_clusterfluentbitconfigs.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,10 @@ spec:
299299
type: string
300300
emitterStorageType:
301301
type: string
302+
enableChunkTrace:
303+
description: Enable input/output tracing on debug images, controlled
304+
more granualry via the http API
305+
type: boolean
302306
flushSeconds:
303307
description: Interval to flush output
304308
type: number

config/crd/bases/fluentbit.fluent.io_fluentbitconfigs.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,10 @@ spec:
331331
type: string
332332
emitterStorageType:
333333
type: string
334+
enableChunkTrace:
335+
description: Enable input/output tracing on debug images, controlled
336+
more granualry via the http API
337+
type: boolean
334338
flushSeconds:
335339
description: Interval to flush output
336340
type: number

manifests/setup/fluent-operator-crd.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1757,6 +1757,10 @@ spec:
17571757
type: string
17581758
emitterStorageType:
17591759
type: string
1760+
enableChunkTrace:
1761+
description: Enable input/output tracing on debug images, controlled
1762+
more granualry via the http API
1763+
type: boolean
17601764
flushSeconds:
17611765
description: Interval to flush output
17621766
type: number
@@ -16538,6 +16542,10 @@ spec:
1653816542
type: string
1653916543
emitterStorageType:
1654016544
type: string
16545+
enableChunkTrace:
16546+
description: Enable input/output tracing on debug images, controlled
16547+
more granualry via the http API
16548+
type: boolean
1654116549
flushSeconds:
1654216550
description: Interval to flush output
1654316551
type: number

manifests/setup/setup.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1757,6 +1757,10 @@ spec:
17571757
type: string
17581758
emitterStorageType:
17591759
type: string
1760+
enableChunkTrace:
1761+
description: Enable input/output tracing on debug images, controlled
1762+
more granualry via the http API
1763+
type: boolean
17601764
flushSeconds:
17611765
description: Interval to flush output
17621766
type: number
@@ -16538,6 +16542,10 @@ spec:
1653816542
type: string
1653916543
emitterStorageType:
1654016544
type: string
16545+
enableChunkTrace:
16546+
description: Enable input/output tracing on debug images, controlled
16547+
more granualry via the http API
16548+
type: boolean
1654116549
flushSeconds:
1654216550
description: Interval to flush output
1654316551
type: number

0 commit comments

Comments
 (0)