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

Use klog for katib #506

Closed
gyliu513 opened this issue May 13, 2019 · 20 comments
Closed

Use klog for katib #506

gyliu513 opened this issue May 13, 2019 · 20 comments
Assignees

Comments

@gyliu513
Copy link
Member

/kind feature

Describe the solution you'd like
[A clear and concise description of what you want to happen.]

Use the permanent forked version of glog for kubernetes instead of log.

ref:
kubernetes/kubernetes#70264
https://github.com/kubernetes/klog/blob/master/README.md

Anything else you would like to add:
[Miscellaneous information that will assist in solving the issue.]

/cc @hougangliu @richardsliu @gaocegege

@gaocegege
Copy link
Member

I think we are using it now, with the help of kube-builder.

@hougangliu
Copy link
Member

#112 traced log solution

@gyliu513
Copy link
Member Author

@gaocegege The klog was not used by katib but using log. Now all of the kubernetes projects are migrating to klog, I think katib should also move this way?

@hougangliu
Copy link
Member

#388 also traces it, we can keep one about log solution

@gyliu513
Copy link
Member Author

@YujiOshima @richardsliu look forward to more comments from you as well.

@hougangliu
Copy link
Member

I think klog is good solution for me

@YujiOshima
Copy link
Contributor

SGTM. klog is the standard logging in k8s ecosystem and developed actively.

@gyliu513
Copy link
Member Author

/assign

@johnugeorge
Copy link
Member

@gyliu513 Katib v1alpha2 version uses log solution that is provided by controller-runtime and it is not the standard log package.. It is a flexible package where users can configure their own logger. See the current usage: https://github.com/kubeflow/katib/blob/master/cmd/katib-controller/v1alpha2/main.go#L35 configures zap logger

It can support Klog also. kubernetes-sigs/controller-runtime#291

Since we are using controller-runtime library for implementation, I feel that we should use the log package provided by controller-runtime and configure the logger(instead of using klog directly)

@gyliu513
Copy link
Member Author

@johnugeorge I actually want to use klog instead of using klog in controller-runtime, using klog directly can always enable us to upgrade as we want to leverage the latest feature in klog. Comments?

@johnugeorge
Copy link
Member

Sorry. I didn't understand. Why can't klog be upgraded in the latter case? Can you please explain the difference between both?

Another side effect is that logs in controller-runtime will get hidden(including error logs) if the log library is not initialized. https://github.com/kubernetes-sigs/controller-runtime/blob/master/pkg/internal/controller/controller.go#L41

@gyliu513
Copy link
Member Author

Sorry. I didn't understand. Why can't klog be upgraded in the latter case? Can you please explain the difference between both?

@johnugeorge If I want to upgrade klog, do I need to upgrade controller-runtime? Let me check more detail for how does federation v2 works kubernetes-retired/kubefed#857

@johnugeorge
Copy link
Member

No. You don't need to upgrade controller-runtime. Klog will be an external dependency.

@gyliu513
Copy link
Member Author

@johnugeorge I see, so we do not need to add klog to Gopkg.toml but depending on klog in controller-runtime is good enough. Comments?

@gyliu513
Copy link
Member Author

There is an issue for klog at kubernetes/klog#22 , the klog cannot handle the case of some sort with a predefined set of variables which are used as suffix for each log line.

Will hold on for some files in katib like https://github.com/kubeflow/katib/blob/master/pkg/controller/v1alpha2/experiment/experiment_util.go#L24 etc.

@gaocegege
Copy link
Member

I think it may affect us deeply. We rely on this feature in many files.

@gyliu513
Copy link
Member Author

@gaocegege I will check how we can workaround for this, but meantime, can we avoid try to using child logger for future new added files?

@gaocegege
Copy link
Member

I have no objection on it, LGTM

@stale
Copy link

stale bot commented Nov 25, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale
Copy link

stale bot commented Dec 19, 2020

This issue has been automatically closed because it has not had recent activity. Please comment "/reopen" to reopen it.

@stale stale bot closed this as completed Dec 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants