• This repository has been archived on 18/Sep/2020
  • Stars
    star
    273
  • Rank 149,978 (Top 3 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created over 10 years ago
  • Updated about 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Reboot manager for Container Linux

locksmith

locksmith is a reboot manager for the CoreOS update engine which is able to use etcd to ensure that only a subset of a cluster of machines are rebooting at any given time. locksmithd runs as a daemon on CoreOS machines and is responsible for controlling the reboot behaviour after updates.

Configuration

There are three different strategies that locksmithd can use after the update engine has successfully applied an update:

  • etcd-lock - reboot after first taking a lock in etcd.
  • reboot - reboot without taking a lock.
  • off - causes locksmithd to exit and do nothing.

These strategies will either be followed immediately after an update, or during the next available reboot window if one has been configured.

These strategies can be configured via /etc/coreos/update.conf with a line that looks like:

REBOOT_STRATEGY=reboot

The reboot strategy can also be configured through a Container Linux Config.

The default strategy is to follow the etcd-lock strategy if etcd is running, and to otherwise follow the reboot strategy.

Usage

locksmithctl is a simple client that can be use to introspect and control the lock used by locksmith. It is installed by default on CoreOS.

Run locksmithctl -help for a list of command-line options.

All command-line options can also be specified using environment variables with a LOCKSMITHCTL_ prefix. For example, the -endpoint argument can be set using LOCKSMITHCTL_ENDPOINT.

Connecting to multiple endpoints

Multiple endpoints can be specified by passing the -endpoint=<url> option for each endpoint, or by passing a comma-separated list of endpoints, e.g.:

-endpoint=<url>,<url>

Specifying multiple endpoints using an environment variable is supported by passing a comma-delimited list, e.g.:

LOCKSMITHCTL_ENDPOINT=<url>,<url>

Listing the Holders

$ locksmithctl status
Available: 0
Max: 1

MACHINE ID
69d27b356a94476da859461d3a3bc6fd

Unlock Holders

In some cases a machine may go away permanently or semi-permanently while holding a reboot lock. A system administrator can clear the lock of a specific machine using the unlock command:

$ locksmithctl unlock 69d27b356a94476da859461d3a3bc6fd

Maximum Semaphore

By default the reboot lock only allows a single holder. However, a user may want more than a single machine to be upgrading at a time. This can be done by increasing the semaphore count.

$ locksmithctl set-max 4
Old: 1
New: 4

Groups

locksmithd coordinates the reboot lock in groups of machines. The default group is "", or the empty string. locksmithd will only coordinate the reboot lock with other machines in the same group.

The purpose of groups is to allow faster updating of certain sets of machines while maintaining availability of certain services. For example, in a cluster of 5 CoreOS machines with all machines in the default group, if you have 2 load balancers and run locksmithctl set-max 2, then it is possible that both load balancers would be rebooted at the same time, interrupting the service they provide. However, if the load balancers are put into their own group named "lb", and both the default group and the "lb" group have a max holder of 1, two reboots can occur at once, but both load balancers will never reboot at the same time.

Configuring groups

To place machines in a group other than the default, locksmithd must be started with the -group=groupname flag or set the LOCKSMITHD_GROUP=groupname environment variable.

To control the semaphore of a group other than the default, you must invoke locksmithctl with the -group=groupname flag or set the LOCKSMITHCTL_GROUP=groupname environment variable.

Reboot windows

locksmithd can be configured to only reboot during certain timeframes. These reboot windows work with any reboot strategy.

The reboot window is configured through two environment variables, LOCKSMITHD_REBOOT_WINDOW_START and LOCKSMITHD_REBOOT_WINDOW_LENGTH. Note that REBOOT_WINDOW_START and REBOOT_WINDOW_LENGTH are also acceptable. Here is an example configuration:

LOCKSMITHD_REBOOT_WINDOW_START=14:00
LOCKSMITHD_REBOOT_WINDOW_LENGTH=1h

This would configure locksmithd to only reboot between 2pm and 3pm. Optionally, a day of week may be specified for the start of the window:

LOCKSMITHD_REBOOT_WINDOW_START="Thu 23:00"
LOCKSMITHD_REBOOT_WINDOW_LENGTH=1h30m

This would configure locksmithd to only reboot the system on Thursday after 11pm, or on Friday before 12:30am.

Currently, the only supported values for the day of week are short day names, e.g. Sun, Mon, Tue, Wed, Thu, Fri, and Sat, but the day of week can be upper or lower case. The time of day must be specified in 24-hour time format. The window length is expressed as input to go's time.ParseDuration function.

Implementation details

The following section describes how locksmith works under the hood.

Semaphore

locksmith uses a semaphore in etcd, located at the key coreos.com/updateengine/rebootlock/semaphore, to coordinate the reboot lock. If a non-default group name is used, the etcd key will be coreos.com/updateengine/rebootlock/groups/$groupname/semaphore.

The semaphore is a JSON document, describing a simple semaphore, that clients swap to take the lock.

When it is first created it will be initialized like so:

{
	"semaphore": 1,
	"max": 1,
	"holders": []
}

For a client to take the lock, the document is swapped with this:

{
	"semaphore": 0,
	"max": 1,
	"holders": [
		"69d27b356a94476da859461d3a3bc6fd"
	]
}

Bugs

Please use the CoreOS issue tracker to report all bugs, issues, and feature requests.

More Repositories

1

fleet

fleet ties together systemd and etcd into a distributed init system
Go
2,426
star
2

go-systemd

Go bindings to systemd socket activation, journal, D-Bus, and unit files
Go
2,232
star
3

torus

Torus Distributed Storage
Go
1,776
star
4

etcd-operator

etcd operator creates/configures/manages etcd clusters atop Kubernetes
Go
1,747
star
5

coreos-vagrant

Minimal Vagrantfile for Container Linux
1,654
star
6

go-oidc

A Go OpenID Connect client.
Go
1,633
star
7

coreos-kubernetes

CoreOS Container Linux+Kubernetes documentation & Vagrant installers
Shell
1,105
star
8

go-iptables

Go wrapper around iptables utility
Go
1,096
star
9

rpm-ostree

⚛📦 Hybrid image/package system with atomic upgrades and package layering
C
854
star
10

vault-operator

Run and manage Vault on Kubernetes simply and securely
Go
759
star
11

ignition

First boot installer and configuration tool
Go
747
star
12

tectonic-installer

Install a Kubernetes cluster the CoreOS Tectonic Way: HA, self-hosted, RBAC, etcd Operator, and more
HCL
597
star
13

toolbox

bring your tools with you
Shell
395
star
14

go-etcd

DEPRECATED - please use the official client at https://github.com/coreos/etcd/tree/master/client
Go
365
star
15

coreos-cloudinit

[DEPRECATED] - Simple configuration tool for Container Linux
Go
344
star
16

grub

GRand Unified Bootloader http://www.gnu.org/software/grub/grub.html
C
333
star
17

coreos-xhyve

Container Linux running on xhyve hypervisor
Shell
332
star
18

coreos-assembler

Tooling container to assemble CoreOS-like systems
Go
327
star
19

go-semver

semver library in Go
Go
317
star
20

fedora-coreos-tracker

Issue tracker for Fedora CoreOS
261
star
21

coreos-overlay

Custom ebuilds for Container Linux
Shell
249
star
22

coreos-installer

Installer for CoreOS disk images
Rust
215
star
23

container-linux-update-operator

A Kubernetes operator to manage updates of Container Linux by CoreOS
Go
211
star
24

fero

YubiHSM2-backed signing server
Rust
208
star
25

etcd-ca

Go
199
star
26

awesome-kubernetes-extensions

A resource tracking a number of Kubernetes extensions built on TPRs, CRDs, and API Aggregation
199
star
27

butane

Butane translates human-readable Butane Configs into machine-readable Ignition Configs.
Go
199
star
28

container-linux-config-transpiler

Convert a Container Linux Config into Ignition
Go
190
star
29

pkg

a collection of go utility packages
Go
186
star
30

afterburn

A one-shot cloud provider agent
Rust
183
star
31

etcdctl

DEPRECATED - see https://github.com/coreos/etcd/tree/master/etcdctl instead
181
star
32

discovery.etcd.io

etcd discovery service
Go
168
star
33

scripts

Build and maintenance scripts for Container Linux
Shell
155
star
34

zincati

Agent for Fedora CoreOS auto-updates
Rust
149
star
35

bugs

Issue tracker for CoreOS Container Linux
148
star
36

fedora-coreos-config

Base configuration for Fedora CoreOS
Shell
145
star
37

kpm

KPM is a tool to deploy and manage application stacks on Kubernetes.
Python
124
star
38

issue-sync

A tool for synchronizing issue tracking between GitHub and JIRA
Go
123
star
39

terraform-aws-kubernetes

Install a Kubernetes cluster the CoreOS Tectonic Way: HA, self-hosted, RBAC, etcd Operator, and more
HCL
117
star
40

bootupd

Bootloader updater
Rust
105
star
41

manifest

repo tool manifest for Container Linux sdk
99
star
42

go-omaha

omaha protocol for go
Go
96
star
43

init

init system units and configuration for Container Linux
Shell
95
star
44

mantle

Mantle: Gluing Container Linux together
Go
93
star
45

quartermaster

A framework for managing containerized storage systems on top of Kubernetes
Go
93
star
46

aws-auth-proxy

HTTP proxy that signs requests for upstream AWS endpoints
Go
86
star
47

mayday

A diagnostics tool for capturing system state.
Go
80
star
48

go-webrtc-datachannel

Go
77
star
49

go-gitreceive

A gitreceive implementation in Go
Go
75
star
50

torcx

torcx is a boot-time addon manager for immutable systems
Go
73
star
51

elb-presence

Python
72
star
52

layering-examples

Dockerfile
72
star
53

unit-examples

A collection of systemd units designed to run on CoreOS/fleet
65
star
54

go-workflow

Go
60
star
55

corelb

a loadbalancer built on coreinit and nginx
Lua
55
star
56

go-tcmu

Go SCSI emulation via the Linux TCM in Userspace module
Go
54
star
57

go-namespaces

DEPRECATED: Golang implementations of Linux Namespaces
Go
52
star
58

fedora-coreos-docs

Documentation for Fedora CoreOS
Shell
49
star
59

third_party.go

third_party.go - self contained GOPATH helper
Go
49
star
60

fedora-coreos-pipeline

Build pipeline for Fedora CoreOS
Groovy
49
star
61

updateservicectl

CoreUpdate Command Line Interface
Go
48
star
62

coreos-web

CSS
45
star
63

depot_tools

Python
43
star
64

jenkins-os

Groovy pipeline jobs that build and test Container Linux with Jenkins
Groovy
43
star
65

fabric-kubernetes-nodes

A fabric Fabfile for SSHing into Kubernetes nodes by label query
43
star
66

gocat

Socket activated transparent SSL proxy written in Go
Go
42
star
67

ssh-key-dir

sshd AuthorizedKeysCommand to read ~/.ssh/authorized_keys.d
Rust
42
star
68

tectonic-docs

Tectonic documentation - https://coreos.com/tectonic/docs/latest/
42
star
69

flannel-cni

Image for sidecar container that installs cni related assets for flannel
Shell
41
star
70

grafiti

Tag and remove AWS Resources with Automation
Go
39
star
71

go-log

Go logging library with systemd journal support
Go
38
star
72

update-ssh-keys

Deprecated tool for managing authorized ssh keys
Rust
38
star
73

airlock

Minimal update/reboot orchestrator for Fedora CoreOS clusters
Go
38
star
74

nsproxy

Linux namespaces tcp proxy
Go
36
star
75

ksched

Experimental flow-based Kubernetes scheduler
Go
36
star
76

update_engine

update daemon for Container Linux
C++
35
star
77

openssh-keys

A pure-Rust library to read and write OpenSSH public keys
Rust
35
star
78

fedora-coreos-streams

Stream metadata and overrides for Fedora CoreOS
Python
34
star
79

cargo-vendor-filterer

Tool to `cargo vendor` with filtering
Rust
32
star
80

bootengine

Initramfs for Container Linux
Shell
31
star
81

krud

kubernetes rolling update webhook server
Go
30
star
82

tectonic-forum

29
star
83

gzran

gzip indexer for random access into compressed files
Go
28
star
84

bcrypt-tool

Go
27
star
85

portage-stable

unmodified ebuilds mirrored from the portage tree
Shell
27
star
86

minikube-iso

An alternative bootable ISO image for minikube
27
star
87

khealth

basic kubernetes health monitoring
Go
26
star
88

kscale

Scripts for k8s scalability testing and analysis
Go
24
star
89

terraform-azurerm-kubernetes

Install a Kubernetes cluster the CoreOS Tectonic Way: HA, self-hosted, RBAC, etcd Operator, and more
HCL
22
star
90

coreos.fedoraproject.org

Old coreos.fedoraproject.org website (deprecated)
HTML
21
star
91

awscli

AWS CLI container image
21
star
92

baselayout

Basic Container Linux filesystem layout and configs
Shell
20
star
93

subgun

Subscribe to a mailing list on mailgun via a web interface
Go
20
star
94

etcd-manager

An etcd cluster management tool
Go
19
star
95

license-bill-of-materials

Fork of https://github.com/pmezard/licenses
Go
19
star
96

systemd-rest

Go
19
star
97

kapprover

A kubelet CSR auto-approver
Go
18
star
98

enhancements

Enhancement tracking repo for CoreOS-based systems
17
star
99

docker-nginx-https-redirect

Docker container which redirects any http request on 80 to https on 443
17
star
100

envsubst-rs

Simple Rust library for variables substitution
Rust
17
star