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 client-go library instead of controller-runtime for kubernetes sync implementation. #1072

Closed
toddbaert opened this issue Dec 11, 2023 · 0 comments · Fixed by #1077
Closed
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@toddbaert
Copy link
Member

toddbaert commented Dec 11, 2023

Use client-go library instead of controller-runtime for kubernetes sync implementation. See background:

It seems like this is happening because the kubernetes sync of the flagd-proxy is using the k8s.io/controller-runtime client, which is intended to be used in an operator, such as the OF operator. The controller runtime has the requirement of the log.SetLogger() function to be called within 30 seconds after the application has been started (see [1]), otherwise the error message will be shown. I just verified this be starting flagd-proxy, waiting 30 seconds, and then doing a call to SyncFlags, resulting in the message being shown. If SyncFlags is called within 30 seconds, no error message is printed.

To get rid of this error message we would need to make sure the said log.SetLogger() function is called during startup of flagd-proxy. However, I would recommend to switch to the client go [2] library instead, as this is more intended for this kind of application, whereas using the client from the controller-runtime is a bit of a misuse in this setting.
Switching to the client-go library will require making some changes in the usage of the client, but could be done with relatively low effort imho.

Thanks @bacherfl

References:

[1] - https://github.com/kubernetes-sigs/controller-runtime/blob/1ea2be573f7887a9fbd766e9a921c5af344da6eb/pkg/log/log.go#L78
[2] - https://github.com/kubernetes/client-go

Originally posted by @bacherfl in #1063 (comment)

@toddbaert toddbaert added bug Something isn't working good first issue Good for newcomers labels Dec 11, 2023
@toddbaert toddbaert added enhancement New feature or request and removed bug Something isn't working labels Dec 11, 2023
@toddbaert toddbaert changed the title Fix warning: log.SetLogger(...) was never called; logs will not be displayed. Use client-go library instead of controller-runtime for kubernetes sync implementation. Dec 11, 2023
@bacherfl bacherfl self-assigned this Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants