constellation/bootstrapper
Malte Poll bdba9d8ba6
bazel: add build files for go (#1186)
* build: correct toolchain order
* build: gazelle-update-repos
* build: use pregenerated proto for dependencies
* update bazeldnf
* deps: tpm simulator
* Update Google trillian module
* cli: add stamping as alternative build info source
* bazel: add go_test wrappers, mark special tests and select testing deps
* deps: add libvirt deps
* deps: go-libvirt patches
* deps: cloudflare circl patches
* bazel: add go_test wrappers, mark special tests and select testing deps
* bazel: keep gazelle overrides
* bazel: cleanup bazelrc
* bazel: switch CMakeLists.txt to use bazel
* bazel: fix injection of version information via stamping
* bazel: commit all build files
* dev-docs: document bazel usage
* deps: upgrade zig-cc for go 1.20
* bazel: update Perl for macOS arm64 & Linux arm64 support
* bazel: use static perl toolchain for OpenSSL
* bazel: use static protobuf (protoc) toolchain
* deps: add git and go to nix deps

Co-authored-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
2023-03-09 15:23:42 +01:00
..
cmd/bootstrapper bazel: add build files for go (#1186) 2023-03-09 15:23:42 +01:00
initproto bazel: add build files for go (#1186) 2023-03-09 15:23:42 +01:00
internal bazel: add build files for go (#1186) 2023-03-09 15:23:42 +01:00
bootstrapping_arch.svg Bootstrapper 2022-07-14 17:25:18 +02:00
README.md dev-docs: Go package docs (#958) 2023-01-19 15:57:50 +01:00

Bootstrapper

The bootstrapper integrates the instance it is running on as node into the Kubernetes cluster. It is running on every new instance that is created.

bootstrapper architecture

The bootstrapper has two active components:

Init Flow

The InitServer is a gRPC server that is listening for initialization requests. The first instance needs to be initialized by the user, see the initproto for a description of the initialization protocol. The client that talks to this server is part of Constellation's CLI.

On an initialization request, the InitServer initializes a new Kubernetes cluster, essentially calling the InitCluster function of our Kubernetes library, which does a kubeadm init.

Join Flow

The JoinClient is a gRPC client that tries to connect to a JoinService of an already existing cluster. The JoinService validates the instance using aTLS. For details on the used protocol, see the joinservice package.

If the JoinService successfully verifies the instance, it issues a join ticket. The JoinClient then joins the cluster by calling the kubeadm join command, using the token and other needed information from the join ticket.

Synchronization, state machine, lifetime

The bootstrapper is automatically started on every new instance. Both InitServer and JoinClient are started and running in parallel. At some point during either the initialization or the join, a shared lock between the two components is acquired. This lock is used as point of no return. It is a state machine with two states (unlocked, locked) and a single transition from unlocked to locked. There is no way to unlock the node afterward (see nodelock package).

After the bootstrapping, the bootstrapper is stopped.