-
Notifications
You must be signed in to change notification settings - Fork 448
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
Use the controller-runtime logger in the cert-generator #2219
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: tenzen-y The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.
Thank you for the update @tenzen-y!
} | ||
return false, nil | ||
} | ||
keyFile := filepath.Join(consts.CertDir, serverKeyName) | ||
if _, err := os.Stat(keyFile); err != nil { | ||
if outputLog { | ||
klog.Infof("Private key file %q doesn't exist in the container yet", keyFile) | ||
log.Info("Private key file %q doesn't exist in the container yet", "privateKeyFile", keyFile) |
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.
log.Info("Private key file %q doesn't exist in the container yet", "privateKeyFile", keyFile) | |
log.Info("Private key file doesn't exist in the container yet.", "privateKeyFile", keyFile) |
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.
Oh, that's right.
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.
Fixed.
@@ -98,18 +100,18 @@ func ensureCertMounted(start time.Time) func(context.Context) (bool, error) { | |||
certFile := filepath.Join(consts.CertDir, serverCertName) | |||
if _, err := os.Stat(certFile); err != nil { | |||
if outputLog { | |||
klog.Infof("Public key file %q doesn't exist in the container yet", certFile) | |||
log.Info("Public key file %q doesn't exist in the container yet.", "publicKeyFile", certFile) |
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.
log.Info("Public key file %q doesn't exist in the container yet.", "publicKeyFile", certFile) | |
log.Info("Public key file doesn't exist in the container yet.", "publicKeyFile", certFile) |
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.
Fixed.
Signed-off-by: Yuki Iwai <yuki.iwai.tz@gmail.com>
2306c5a
to
c3d9828
Compare
Thank you @tenzen-y! |
What this PR does / why we need it:
Currently, we use the klog in the cert-generator and the controller-runtime logger in other controllers, such as the experiment-controller. So the manager output logs using a different format from the other controllers for the cert-generator, as shown below:
However, we should use the same format to improve the visibility of the logs in the manager.
So I replaced the cert-generator logger with the same as the other controllers one:
katib/pkg/controller.v1beta1/experiment/experiment_controller.go
Lines 56 to 58 in 1f5fb48
After applying this patch, the manager will output logs in the following:
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #
Checklist: