Skip to content
This repository was archived by the owner on Jan 20, 2026. It is now read-only.

Commit f9a7035

Browse files
committed
feat: setup support for multi process workers
Initial support for multiproccess workers Signed-off-by: jcriadomarco <jcriadomarco@vmware.com>
1 parent 2761a43 commit f9a7035

10 files changed

Lines changed: 289 additions & 251 deletions

File tree

base-image/Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ run: build-image
2020
-v `pwd`/failsafe.conf:/fluentd/etc/fluent.conf \
2121
-v /var/log:/var/log \
2222
-v /var/run:/var/run \
23-
-e FLUENTD_OPT="--no-supervisor" \
2423
$(IMAGE):$(TAG)
2524

2625
test: build-image
@@ -29,9 +28,9 @@ test: build-image
2928
-v `pwd`:/workspace \
3029
-v `pwd/plugins`:/fluentd/plugins \
3130
-v `pwd`/test/local.conf:/fluentd/etc/fluent.conf \
32-
-e FLUENTD_OPT="--no-supervisor" \
33-
-e PAPERTRAIL_PORT=$$PAPERTRAIL_PORT \
34-
-e PAPERTRAIL_HOST=$$PAPERTRAIL_HOST \
31+
-p 0.0.0.0:24231:24231 \
32+
-e PAPERTRAIL_PORT=$$PAPERTRAIL_PORT \
33+
-e PAPERTRAIL_HOST=$$PAPERTRAIL_HOST \
3534
$(IMAGE):$(TAG)
3635

3736
list-gems:

config-reloader/config/config.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ type Config struct {
5656
ParsedMetaValues map[string]string
5757
ParsedLabelSelector labels.Set
5858
ExecTimeoutSeconds int
59+
SplitPattern string
5960
}
6061

6162
var defaultConfig = &Config{
@@ -78,6 +79,7 @@ var defaultConfig = &Config{
7879
MetricsPort: 9000,
7980
AdminNamespace: "kube-system",
8081
ExecTimeoutSeconds: 30,
82+
SplitPattern: "infra-system",
8183
}
8284

8385
var reValidID = regexp.MustCompile("([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]")
@@ -250,6 +252,8 @@ func (cfg *Config) ParseFlags(args []string) error {
250252

251253
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)
252254

255+
app.Flag("split-pattern", "Configurations defined special pattern for different workers").Default(defaultConfig.SplitPattern).StringVar(&cfg.SplitPattern)
256+
253257
app.Flag("exec-timeout", "Timeout duration (in seconds) for exec command during validation").Default(strconv.Itoa(defaultConfig.ExecTimeoutSeconds)).IntVar(&cfg.ExecTimeoutSeconds)
254258
_, err := app.Parse(args)
255259

config-reloader/fluentd/reloader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func (r *Reloader) ReloadConfiguration() {
3333

3434
logrus.Infof("Reloading fluentd configuration gracefully via POST to /api/config.gracefulReload")
3535

36-
resp, err := http.Get(fmt.Sprintf("http://127.0.0.1:%d/api/config.gracefulReload", r.port))
36+
resp, err := http.Get(fmt.Sprintf("http://127.0.0.1:%d/api/config.reload", r.port))
3737
if err != nil {
3838
logrus.Errorf("fluentd config.gracefulReload request failed: %+v", err)
3939
} else if resp.StatusCode != 200 {

config-reloader/fluentd/reloader_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func TestReloaderCalls(t *testing.T) {
2525

2626
handler := func(w http.ResponseWriter, r *http.Request) {
2727
fmt.Printf("req %+v", r)
28-
if r.Method == "GET" && r.RequestURI == "/api/config.gracefulReload" {
28+
if r.Method == "GET" && r.RequestURI == "/api/config.reload" {
2929
counter++
3030
}
3131
}

config-reloader/generator/generator.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,11 @@ func (g *generatorInstance) renderIncludableFile(templateFile string, dest strin
337337
model := struct {
338338
ID string
339339
PrometheusEnabled bool
340+
SplitPattern string
340341
}{
341342
ID: util.MakeFluentdSafeName(g.cfg.ID),
342343
PrometheusEnabled: g.cfg.PrometheusEnabled,
344+
SplitPattern: g.cfg.SplitPattern,
343345
}
344346

345347
err = util.TemplateAndWriteFile(tmpl, model, dest)

config-reloader/templates/fluent.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
# needed to enable /api/config.reload
77
rpc_endpoint 127.0.0.1:24444
8+
workers 3
89
</system>
910

1011
# you can turn this on for debug

config-reloader/templates/kubernetes-postprocess.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,14 @@
3636
# Remove the unnecessary field as the information is already available on other fields.
3737
<filter kube.*.*.*>
3838
@type record_modifier
39+
@id k8s_remove_unused_field
3940
remove_keys $.kubernetes.pod_id, $.kubernetes.master_url, $.kubernetes.container_image_id, $.kubernetes.namespace_id, kubernetes_namespace_container_name, $.kubernetes.labels.pod-template-generation, $.kubernetes.labels.controller-revision-hash, $.kubernetes.labels.pod-template-hash
4041
</filter>
4142

4243
# Parse logs in the kube-system namespace using the kubernetes formatter.
4344
<filter kube.kube-system.**>
4445
@type parser
46+
@id k8s_parser_kube_system
4547
reserve_data true
4648
key_name log
4749
emit_invalid_record_to_error false

0 commit comments

Comments
 (0)