Skip to content

Use client-go library instead of controller-runtime for kubernetes sync implementation. #1072

@toddbaert

Description

@toddbaert

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)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions