Skip to content

Commit 9c057a9

Browse files
committed
add null plugin
Signed-off-by: Chengwei Guo <[email protected]>
1 parent a3ca4c9 commit 9c057a9

File tree

11 files changed

+95
-0
lines changed

11 files changed

+95
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package output
2+
3+
// Null defines the parameters for out_null output plugin
4+
type Null struct {
5+
// NeverFlush for testing to simulate the output plugin that never succeeds to flush.
6+
NeverFlush *bool `json:"neverFlush,omitempty"`
7+
}

apis/fluentd/v1alpha1/plugins/output/types.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ type Output struct {
5454
Datadog *Datadog `json:"datadog,omitempty"`
5555
// copy plugin
5656
Copy *Copy `json:"copy,omitempty"`
57+
// null plugin
58+
Null *Null `json:"nullPlugin,omitempty"`
5759
}
5860

5961
// DeepCopyInto implements the DeepCopyInto interface.
@@ -177,6 +179,11 @@ func (o *Output) Params(loader plugins.SecretLoader) (*params.PluginStore, error
177179
return o.copyPlugin(ps, loader), nil
178180
}
179181

182+
if o.Null != nil {
183+
ps.InsertType(string(params.NullOutputType))
184+
return o.nullPlugin(ps, loader), nil
185+
}
186+
180187
return o.customOutput(ps, loader), nil
181188

182189
}
@@ -1074,4 +1081,11 @@ func (o *Output) copyPlugin(parent *params.PluginStore, sl plugins.SecretLoader)
10741081
return parent
10751082
}
10761083

1084+
func (o *Output) nullPlugin(parent *params.PluginStore, sl plugins.SecretLoader) *params.PluginStore {
1085+
if o.Null.NeverFlush != nil {
1086+
parent.InsertPairs("never_flush", fmt.Sprint(*o.Null.NeverFlush))
1087+
}
1088+
return parent
1089+
}
1090+
10771091
var _ plugins.Plugin = &Output{}

apis/fluentd/v1alpha1/plugins/params/const.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ const (
7373
CloudWatchOutputType OutputType = "cloudwatch_logs"
7474
DatadogOutputType OutputType = "datadog"
7575
CopyOutputType OutputType = "copy"
76+
NullOutputType OutputType = "null"
7677
)
7778

7879
var (

charts/fluent-operator/charts/fluentd-crds/crds/fluentd.fluent.io_clusteroutputs.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2226,6 +2226,14 @@ spec:
22262226
required:
22272227
- url
22282228
type: object
2229+
nullPlugin:
2230+
description: null plugin
2231+
properties:
2232+
neverFlush:
2233+
description: NeverFlush for testing to simulate the output
2234+
plugin that never succeeds to flush.
2235+
type: boolean
2236+
type: object
22292237
opensearch:
22302238
description: out_opensearch plugin
22312239
properties:

charts/fluent-operator/charts/fluentd-crds/crds/fluentd.fluent.io_outputs.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2226,6 +2226,14 @@ spec:
22262226
required:
22272227
- url
22282228
type: object
2229+
nullPlugin:
2230+
description: null plugin
2231+
properties:
2232+
neverFlush:
2233+
description: NeverFlush for testing to simulate the output
2234+
plugin that never succeeds to flush.
2235+
type: boolean
2236+
type: object
22292237
opensearch:
22302238
description: out_opensearch plugin
22312239
properties:

config/crd/bases/fluentd.fluent.io_clusteroutputs.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2226,6 +2226,14 @@ spec:
22262226
required:
22272227
- url
22282228
type: object
2229+
nullPlugin:
2230+
description: null plugin
2231+
properties:
2232+
neverFlush:
2233+
description: NeverFlush for testing to simulate the output
2234+
plugin that never succeeds to flush.
2235+
type: boolean
2236+
type: object
22292237
opensearch:
22302238
description: out_opensearch plugin
22312239
properties:

config/crd/bases/fluentd.fluent.io_outputs.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2226,6 +2226,14 @@ spec:
22262226
required:
22272227
- url
22282228
type: object
2229+
nullPlugin:
2230+
description: null plugin
2231+
properties:
2232+
neverFlush:
2233+
description: NeverFlush for testing to simulate the output
2234+
plugin that never succeeds to flush.
2235+
type: boolean
2236+
type: object
22292237
opensearch:
22302238
description: out_opensearch plugin
22312239
properties:

docs/plugins/fluentd/output/null.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Null
2+
3+
Null defines the parameters for out_null output plugin
4+
5+
6+
| Field | Description | Scheme |
7+
| ----- | ----------- | ------ |
8+
| neverFlush | NeverFlush for testing to simulate the output plugin that never succeeds to flush. | *bool |

docs/plugins/fluentd/output/types.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ Output defines all available output plugins and their parameters
2727
| cloudWatch | out_cloudwatch plugin | *[CloudWatch](#cloudwatch) |
2828
| datadog | datadog plugin | *[Datadog](#datadog) |
2929
| copy | copy plugin | *[Copy](#copy) |
30+
| nullPlugin | null plugin | *[Null](#null) |

manifests/setup/fluent-operator-crd.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10723,6 +10723,14 @@ spec:
1072310723
required:
1072410724
- url
1072510725
type: object
10726+
nullPlugin:
10727+
description: null plugin
10728+
properties:
10729+
neverFlush:
10730+
description: NeverFlush for testing to simulate the output
10731+
plugin that never succeeds to flush.
10732+
type: boolean
10733+
type: object
1072610734
opensearch:
1072710735
description: out_opensearch plugin
1072810736
properties:
@@ -39580,6 +39588,14 @@ spec:
3958039588
required:
3958139589
- url
3958239590
type: object
39591+
nullPlugin:
39592+
description: null plugin
39593+
properties:
39594+
neverFlush:
39595+
description: NeverFlush for testing to simulate the output
39596+
plugin that never succeeds to flush.
39597+
type: boolean
39598+
type: object
3958339599
opensearch:
3958439600
description: out_opensearch plugin
3958539601
properties:

0 commit comments

Comments
 (0)