Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
version: "2"
run:
allow-parallel-runners: true

linters:
default: none
enable:
- copyloopvar
- dupl
- errcheck
- ginkgolinter
- goconst
- gocyclo
- govet
- ineffassign
- lll
- misspell
- nakedret
- prealloc
- revive
- staticcheck
- unconvert
- unparam
- unused

settings:
revive:
rules:
- name: comment-spacings
- name: import-shadowing
exclusions:
generated: lax
rules:
- linters:
- lll
path: api/*
- linters:
- dupl
- lll
path: internal/*
- linters:
- misspell
path: apis/fluentbit/v1alpha2/plugins/common_types.go
paths:
- third_party$
- builtin$
- examples$

formatters:
enable:
- gofmt
- goimports
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
2 changes: 1 addition & 1 deletion apis/fluentbit/v1alpha2/plugins/input/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type HTTP struct {
// +kubebuilder:validation:Pattern:="^\\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$"
BufferMaxSize string `json:"bufferMaxSize,omitempty"`
// This sets the chunk size for incoming incoming JSON messages.
//These chunks are then stored/managed in the space available by buffer_max_size,default 512K.
// These chunks are then stored/managed in the space available by buffer_max_size,default 512K.
// +kubebuilder:validation:Pattern:="^\\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$"
BufferChunkSize string `json:"bufferChunkSize,omitempty"`
// It allows to set successful response code. 200, 201 and 204 are supported,default 201.
Expand Down
2 changes: 1 addition & 1 deletion apis/fluentbit/v1alpha2/plugins/input/syslog.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type Syslog struct {
// If your syslog messages have fractional seconds set this Parser value to syslog-rfc5424 instead.
Parser string `json:"parser,omitempty"`
// By default the buffer to store the incoming Syslog messages, do not allocate the maximum memory allowed, instead it allocate memory when is required.
//The rounds of allocations are set by Buffer_Chunk_Size. If not set, Buffer_Chunk_Size is equal to 32000 bytes (32KB).
// The rounds of allocations are set by Buffer_Chunk_Size. If not set, Buffer_Chunk_Size is equal to 32000 bytes (32KB).
// +kubebuilder:validation:Pattern:="^\\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$"
BufferChunkSize string `json:"bufferChunkSize,omitempty"`
// Specify the maximum buffer size to receive a Syslog message. If not set, the default size will be the value of Buffer_Chunk_Size.
Expand Down
2 changes: 1 addition & 1 deletion apis/fluentbit/v1alpha2/plugins/input/tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type TCP struct {
// +kubebuilder:validation:Pattern:="^\\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$"
BufferSize string `json:"bufferSize,omitempty"`
// By default the buffer to store the incoming JSON messages, do not allocate the maximum memory allowed, instead it allocate memory when is required.
//The rounds of allocations are set by Chunk_Size in KB. If not set, Chunk_Size is equal to 32 (32KB).
// The rounds of allocations are set by Chunk_Size in KB. If not set, Chunk_Size is equal to 32 (32KB).
// +kubebuilder:validation:Pattern:="^\\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$"
ChunkSize string `json:"chunkSize,omitempty"`
// Specify the expected payload format. It support the options json and none.
Expand Down
12 changes: 6 additions & 6 deletions apis/fluentbit/v1alpha2/plugins/output/kafka_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ type Kafka struct {
TopicKey string `json:"topicKey,omitempty"`
// {property} can be any librdkafka properties
Rdkafka map[string]string `json:"rdkafka,omitempty"`
//adds unknown topics (found in Topic_Key) to Topics. So in Topics only a default topic needs to be configured
// Adds unknown topics (found in Topic_Key) to Topics. So in Topics only a default topic needs to be configured
DynamicTopic *bool `json:"dynamicTopic,omitempty"`
//Fluent Bit queues data into rdkafka library,
//if for some reason the underlying library cannot flush the records the queue might fills up blocking new addition of records.
//The queue_full_retries option set the number of local retries to enqueue the data.
//The default value is 10 times, the interval between each retry is 1 second.
//Setting the queue_full_retries value to 0 set's an unlimited number of retries.
// Fluent Bit queues data into rdkafka library,
// if for some reason the underlying library cannot flush the records the queue might fills up blocking new addition of records.
// The queue_full_retries option set the number of local retries to enqueue the data.
// The default value is 10 times, the interval between each retry is 1 second.
// Setting the queue_full_retries value to 0 set's an unlimited number of retries.
QueueFullRetries *int64 `json:"queueFullRetries,omitempty"`
// Limit the maximum number of Chunks in the filesystem for the current output logical destination.
TotalLimitSize string `json:"totalLimitSize,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion apis/fluentbit/v1alpha2/plugins/output/splunk_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type Splunk struct {
Port *int32 `json:"port,omitempty"`
// Specify the Authentication Token for the HTTP Event Collector interface.
SplunkToken *plugins.Secret `json:"splunkToken,omitempty"`
//Buffer size used to receive Splunk HTTP responses: Default `2M`
// Buffer size used to receive Splunk HTTP responses: Default `2M`
// +kubebuilder:validation:Pattern:="^\\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$"
HTTPBufferSize string `json:"httpBufferSize,omitempty"`
// Set payload compression mechanism. The only available option is gzip.
Expand Down
44 changes: 22 additions & 22 deletions apis/fluentd/v1alpha1/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,14 @@ func (r *CfgResources) filterForInputs(
sl plugins.SecretLoader,
inputs []input.Input,
) error {
for n, input := range inputs {
for n, in := range inputs {
inputId := fmt.Sprintf("%s::%s::%s::%s-%d", cfgId, namespace, crdtype, name, n)
input.Id = &inputId
// if input.InputCommon.Tag == nil {
// input.InputCommon.Tag = &params.DefaultTag
in.Id = &inputId
// if in.InputCommon.Tag == nil {
// in.InputCommon.Tag = &params.DefaultTag
// }

ps, err := input.Params(sl)
ps, err := in.Params(sl)
if err != nil {
return err
}
Expand All @@ -239,14 +239,14 @@ func (r *CfgResources) filterForFilters(
sl plugins.SecretLoader,
filters []filter.Filter,
) error {
for n, filter := range filters {
for n, f := range filters {
filterId := fmt.Sprintf("%s::%s::%s::%s-%d", cfgId, namespace, crdtype, name, n)
filter.Id = &filterId
if filter.Tag == nil {
filter.Tag = &params.DefaultTag
f.Id = &filterId
if f.Tag == nil {
f.Tag = &params.DefaultTag
}

ps, err := filter.Params(sl)
ps, err := f.Params(sl)
if err != nil {
return err
}
Expand All @@ -268,14 +268,14 @@ func (r *CfgResources) filterForOutputs(
sl plugins.SecretLoader,
outputs []output.Output,
) error {
for n, output := range outputs {
for n, o := range outputs {
outputId := fmt.Sprintf("%s::%s::%s::%s-%d", cfgId, namespace, crdtype, name, n)
output.Id = &outputId
if output.Tag == nil {
output.Tag = &params.DefaultTag
o.Id = &outputId
if o.Tag == nil {
o.Tag = &params.DefaultTag
}

ps, err := output.Params(sl)
ps, err := o.Params(sl)
if err != nil {
return err
}
Expand Down Expand Up @@ -312,19 +312,19 @@ func (pgr *PluginResources) IdentifyCopyAndPatchOutput(cfgResources *CfgResource
}

// Patch the outputs
for k, output := range outputs {
for k, o := range outputs {
// Does it exist a copy output for this tag ?
if c, ok := copyOutputs[k]; ok {
// Yes, so we patch
for _, id := range output {
for _, id := range o {
o := cfgResources.OutputPlugins[id]
o.Name = "store"
cfgResources.OutputPlugins[c].InsertChilds(&o)
}
patchedOutputPlugins = append(patchedOutputPlugins, cfgResources.OutputPlugins[c])
} else {
// No, we don't patch
for _, id := range output {
for _, id := range o {
o := cfgResources.OutputPlugins[id]
patchedOutputPlugins = append(patchedOutputPlugins, o)
}
Expand All @@ -347,14 +347,14 @@ func (pgr *PluginResources) WithCfgResources(cfgRouteLabel string, r *CfgResourc
cfgLabelPlugin.InsertPairs("tag", cfgRouteLabel)

// insert filter plugins of this fluentd config
for _, filter := range r.FilterPlugins {
childFilter := filter
for _, f := range r.FilterPlugins {
childFilter := f
cfgLabelPlugin.InsertChilds(&childFilter)
}

// insert output plugins of this fluentd config
for _, output := range r.OutputPlugins {
childOutput := output
for _, o := range r.OutputPlugins {
childOutput := o
cfgLabelPlugin.InsertChilds(&childOutput)
}

Expand Down
Loading
Loading