Kube Coordinate builds upon the kube-rs ecosystem, and implements a streamlined version of the client-go leader election system. This implementation uses only Lease
objects for coordination.
// Spawn a leader elector task, and get a handle to the state channel.
let handle = spawn;
let state_chan = handle.state;
// Before taking action as a leader, just check the channel to ensure
// the lease is currently held by this process.
if state_chan.borrow.is_leader
// Or, for a more sophisticated pattern, watch the state channel for changes,
// and use it to drive your application's state machine.
let state_stream = new;
loop
Install
cargo add kube-coordinate
License
kube-coordinate is licensed under the terms of the MIT License or the Apache License 2.0, at your choosing.