https://github.com/flatcar/fleetlock
Go client implementation of FleetLock procotol
https://github.com/flatcar/fleetlock
flatcar hacktoberfest
Last synced: 5 months ago
JSON representation
Go client implementation of FleetLock procotol
- Host: GitHub
- URL: https://github.com/flatcar/fleetlock
- Owner: flatcar
- License: apache-2.0
- Created: 2021-09-21T14:59:43.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-07-29T13:12:11.000Z (10 months ago)
- Last Synced: 2025-07-29T15:50:25.353Z (10 months ago)
- Topics: flatcar, hacktoberfest
- Language: Go
- Homepage:
- Size: 120 KB
- Stars: 0
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: code-of-conduct.md
Awesome Lists containing this project
README
[](https://www.flatcar.org/)
[](https://app.element.io/#/room/#flatcar:matrix.org)
[](https://kubernetes.slack.com/archives/C03GQ8B5XNJ)
[](https://x.com/flatcar)
[](https://hachyderm.io/@flatcar)
[](https://bsky.app/profile/flatcar.org)
## FleetLock client
[](https://pkg.go.dev/github.com/flatcar/fleetlock)
[](https://github.com/flatcar/fleetlock/actions/workflows/go.yml)
Go implementation of `FleetLock` protocol.
### Example
It's possible to run a local `FleetLock` server backed by `etcd` using [`airlock`](https://github.com/coreos/airlock/):
```shell
$ 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/