Skip to content

Commit

Permalink
Add Worker support to fluentd spec
Browse files Browse the repository at this point in the history
  • Loading branch information
velothump authored and tarokkk committed Jun 24, 2020
1 parent 628074c commit d959ac1
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4597,6 +4597,9 @@ spec:
type: object
volumeMountChmod:
type: boolean
workers:
format: int32
type: integer
type: object
loggingRef:
type: string
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/logging.banzaicloud.io_loggings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4597,6 +4597,9 @@ spec:
type: object
volumeMountChmod:
type: boolean
workers:
format: int32
type: integer
type: object
loggingRef:
type: string
Expand Down
1 change: 1 addition & 0 deletions pkg/resources/fluentd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ var fluentdInputTemplate = `
<system>
rpc_endpoint 127.0.0.1:24444
log_level {{ .LogLevel }}
workers {{ .Workers }}
</system>
# Prometheus monitoring
Expand Down
7 changes: 7 additions & 0 deletions pkg/resources/fluentd/configsecret.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type fluentdConfig struct {
Port int32
Path string
}
Workers int32
}

func generateConfig(input fluentdConfig) (string, error) {
Expand Down Expand Up @@ -67,6 +68,12 @@ func (r *Reconciler) secretConfig() (runtime.Object, reconciler.DesiredState, er
input.LogLevel = "info"
}

if r.Logging.Spec.FluentdSpec.Workers > 0 {
input.Workers = r.Logging.Spec.FluentdSpec.Workers
} else {
input.Workers = 1
}

inputConfig, err := generateConfig(input)
if err != nil {
return nil, reconciler.StatePresent, err
Expand Down
1 change: 1 addition & 0 deletions pkg/sdk/api/v1beta1/fluentd_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ type FluentdSpec struct {
Metrics *Metrics `json:"metrics,omitempty"`
Security *Security `json:"security,omitempty"`
Scaling *FluentdScaling `json:"scaling,omitempty"`
Workers int32 `json:"workers,omitempty"`
// +kubebuilder:validation:enum=fatal,error,warn,info,debug,trace
LogLevel string `json:"logLevel,omitempty"`
PodPriorityClassName string `json:"podPriorityClassName,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions pkg/sdk/static/gen/crds/generated.go

Large diffs are not rendered by default.

0 comments on commit d959ac1

Please sign in to comment.