Skip to content

Go client implementation of FleetLock procotol

License

Notifications You must be signed in to change notification settings

flatcar/fleetlock

Repository files navigation

FleetLock client

Go Reference Go

Go implementation of FleetLock protocol.

Example

It's possible to run a local FleetLock server backed by etcd using airlock:

$ cd examples
$ docker-compose up -d

There is only one slot for the controllers group:

$ fleetlockctl --url http://127.0.0.1:3333 --group controllers --id $(cat /etc/machine-id) recursive-lock

On the airlock side:

DEBU[0117] processing client pre-reboot request          group=controllers id=41987...
DEBU[0117] givin green-flag to pre-reboot request        group=controllers id=41987...

It's not possible to get another lock, since there is only one slot:

$ fleetlockctl --url http://127.0.0.1:3333 --group controllers --id another-machine recursive-lock
Error: locking: fleetlock error: all 1 semaphore slots currently locked (failed_lock)

It's possible to release the lock:

./fleetlockctl --url http://127.0.0.1:3333 --group controllers --id $(cat /etc/machine-id) unlock-if-held

another-machine can now request a lock:

$ fleetlockctl --url http://127.0.0.1:3333 --group controllers --id another-machine recursive-lock

On the airlock side:

DEBU[0366] got pre-reboot request
DEBU[0366] processing client pre-reboot request          group=controllers id=another-machine
DEBU[0367] givin green-flag to pre-reboot request        group=controllers id=another-machine

Build

requirements:

  • go in the path
$ make

ref: https://coreos.github.io/zincati/development/fleetlock/protocol/

About

Go client implementation of FleetLock procotol

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •