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

[V3] Multi-group log context #1383

Closed
Adirio opened this issue Feb 21, 2020 · 1 comment · Fixed by #1568
Closed

[V3] Multi-group log context #1383

Adirio opened this issue Feb 21, 2020 · 1 comment · Fixed by #1568
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature.

Comments

@Adirio
Copy link
Contributor

Adirio commented Feb 21, 2020

In v2. when multi-group is enabled, each controller is provided with a logger adding it's kind as context:

if err = (&crewcontroller.CaptainReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("Captain"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "Captain")
os.Exit(1)
}

However, multiple controllers in the same project can have the same Kind if they are in different groups. The group should also be provided qas context to differentiate logs from two controllers from different groups but the same kind.

Code to modify:

// TODO(v3): loggers for the same Kind controllers from different groups use the same logger.
// `.WithName("controllers").WithName(GROUP).WithName(KIND)` should be used instead. However,
// this is a backwards incompatible change, and thus should be done for next project version.
multiGroupReconcilerSetupCodeFragment = `if err = (&%scontroller.%sReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("%s"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "%s")
os.Exit(1)
}
`

/kind feature

@Adirio Adirio added the kind/feature Categorizes issue or PR as related to a new feature. label Feb 21, 2020
@camilamacedo86
Copy link
Member

/assign @camilamacedo86

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
2 participants