Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: include read_bytes_limit_per_second as parameter #397

Merged
merged 1 commit into from
Jun 23, 2023
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
5 changes: 5 additions & 0 deletions config-reloader/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ type Config struct {
ParsedMetaValues map[string]string
ParsedLabelSelector labels.Set
ExecTimeoutSeconds int
ReadBytesLimit int
}

var defaultConfig = &Config{
Expand All @@ -78,6 +79,7 @@ var defaultConfig = &Config{
MetricsPort: 9000,
AdminNamespace: "kube-system",
ExecTimeoutSeconds: 30,
ReadBytesLimit: 51200,
}

var reValidID = regexp.MustCompile("([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]")
Expand Down Expand Up @@ -251,6 +253,9 @@ func (cfg *Config) ParseFlags(args []string) error {
app.Flag("admin-namespace", "Configurations defined in this namespace are copied as is, without further processing. Virtual plugins can also be defined in this namespace").Default(defaultConfig.AdminNamespace).StringVar(&cfg.AdminNamespace)

app.Flag("exec-timeout", "Timeout duration (in seconds) for exec command during validation").Default(strconv.Itoa(defaultConfig.ExecTimeoutSeconds)).IntVar(&cfg.ExecTimeoutSeconds)

app.Flag("container-bytes-limit", "read_bytes_limit_per_second parameter for tail plugin per container file. Default 2MB/min").Default(strconv.Itoa(defaultConfig.ReadBytesLimit)).IntVar(&cfg.ReadBytesLimit)

_, err := app.Parse(args)

if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions config-reloader/generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,11 @@ func (g *generatorInstance) renderIncludableFile(templateFile string, dest strin
model := struct {
ID string
PrometheusEnabled bool
ReadBytesLimit int
}{
ID: util.MakeFluentdSafeName(g.cfg.ID),
PrometheusEnabled: g.cfg.PrometheusEnabled,
ReadBytesLimit: g.cfg.ReadBytesLimit,
}

err = util.TemplateAndWriteFile(tmpl, model, dest)
Expand Down
2 changes: 1 addition & 1 deletion config-reloader/templates/kubernetes.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
skip_refresh_on_startup true
tag kubernetes.*
read_from_head true
read_bytes_limit_per_second 8192
read_bytes_limit_per_second {{.ReadBytesLimit}}
multiline_flush_interval 5s
<parse>
@type multiline
Expand Down