-
Notifications
You must be signed in to change notification settings - Fork 149
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
Set cluster_name
var in logs vars separately and not in init
#2777
Conversation
If we set the `cluster_name` field in log variables (extran fields that are printed in logs), inside the `init` function of `log` package, we would un necessarily be calling k8s api even from the places where we don't have to do anything with the k8s api. To fix this, this commit introduces a new function that can be used to setup that field in the logs vars and that function will only be called from the places where we need the logs to have to the `cluster_name` field, for example `kanctl`, `controller` and `repository-controller`.
In current version
Build new binary and test these
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
If we set the `cluster_name` field in log variables (extran fields that are printed in logs), inside the `init` function of `log` package, we would un necessarily be calling k8s api even from the places where we don't have to do anything with the k8s api. To fix this, this commit introduces a new function that can be used to setup that field in the logs vars and that function will only be called from the places where we need the logs to have to the `cluster_name` field, for example `kanctl`, `controller` and `repository-controller`. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Change Overview
If we set the
cluster_name
field in log variables (extran fields that are printed in logs), inside theinit
function oflog
package, we would un necessarily be calling k8s api even from the places where we don't have to do anything with the k8s api.To fix this, this commit introduces a new function that can be used to setup that field in the logs vars and that function will only be called from the places where we need the logs to have to the
cluster_name
field, for examplekanctl
,controller
andrepository-controller
.Pull request type
Please check the type of change your PR introduces:
Issues
Test Plan
Detailed steps are part of a comment below.