-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Serve metrics independently of manager.Start
#336
Comments
Opened #337 to demonstrate the above proposed solution. |
For reference, any particular reason why you implemented your own leader election vs CR's leader election? If there's something it doesn't do, that'd be good to know :-). If you want to disable metrics serving, you should just be able to do |
cc @shawn-hurley think he knows more about the reason behind that.
We want to use metrics serving from the controller-runtime, but want to start it decoupled from starting the whole thing. |
We implemented what we are calling a "Leader For Life" approach. This uses the built-in GC of k8s so that when the leader dies it will remove the lock and then the next leader can be selected by grabbing the lock. The use case that we're trying to solve IIRC is:
@mhrivnak is this your understanding as well? |
That's all correct. I wrote up a summary and basic implementation here: https://github.com/mhrivnak/leaderelection I've been meaning to propose it for controller-runtime, but just haven't gotten around to it. So here we are! The implementation changed slightly when I added it to operator-sdk, but it's fundamentally the same. From the README, I'll just point out this excerpt, which I think highlights the key benefits: "There is no possibility for multiple pods to think they are the leader at the same time. The leader does not need to renew a lease, consider stepping down, or do anything related to election activity once it becomes the leader." |
As suggested in the #367 (comment) PR comment we want to instead use the @DirectXMan12 you mentioned you want to have metrics enabled by default, so how do we want to disable them then. Any prefrence on the approach there? |
Set MetricsListenAddress to |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Currently metrics are only started to be served when
manager.Start()
is called. In operator-sdk we have a use case as we implemented our own leader election, so we blockStart()
until that pod becomes a leader. Due to this problem we are not getting metrics for all the pods. We do want to still like to collect metrics for all the running pods even if the manager is not started.Proposed solution:
Add
MetricsServingDisabled
option to ovveride serving of metrics. Expose theserveMetrics
controller-runtime/pkg/manager/internal.go
Line 180 in 45d6520
Start()
method.The text was updated successfully, but these errors were encountered: