Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document validation of cloud config before customizing an RPi image #28

Merged
merged 1 commit into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion content/en/docs/Getting started/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ curl -L https://github.com/kairos-io/provider-kairos/releases/download/{{<provid
# optionally, install the CLI locally
mv kairosctl /usr/local/bin/kairosctl
chmod +x /usr/local/bin/kairosctl

```

The CLI allows to register a node with a QR Code screenshot, an QR Code image, or an EdgeVPN token. During pairing, the configuration is sent over, and the node will continue the installation process.
Expand Down
9 changes: 8 additions & 1 deletion content/en/docs/Installation/raspberry.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,17 @@ The following shell script shows how to locally rebuild and customize the image
If you're using osbuilder between versions 0.6.0 and 0.6.5, you need to pass the flag `--use-lvm` to the `build-arm-image.sh` script, the same way you pass `--local`. Starting form osbuilder 0.6.6 this will be the default behaviour.
{{% /alert %}}

{{% alert title="Notes" %}}
Validating the config is not required in the following process, but it can save you some time. Use [kairosctl](/docs/reference/kairosctl/) to perform the schema validations.
{{% /alert %}}

```
# Download the Kairos image locally
IMAGE={{< registryURL >}}/kairos-opensuse-leap-arm-rpi:{{<providerVersion>}}-{{<k3sVersionOCI>}}
# Pull the image locally
docker pull $IMAGE
# Validate the configuration file
kairosctl validate cloud-config.yaml
# Customize it
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Customize what? If it's about the configuration file, it should be customized before validation (so that the user validates the final one). If it's about the image being created, maybe something like build the custom image might be clearer.

mkdir -p build
docker run -v $PWD:/HERE \
-v /var/run/docker.sock:/var/run/docker.sock \
Expand Down
57 changes: 40 additions & 17 deletions content/en/docs/Reference/kairosctl.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ description: >

The `kairosctl` binary is provided as part of releases associated to each Kairos version. It can be used from an external machine to generate network tokens and pair nodes on first-boot.


```bash
curl -L https://github.com/kairos-io/provider-kairos/releases/download/{{<providerVersion>}}/kairosctl-.{{<providerVersion>}}-.linux-.amd64.tar.gz -o - | tar -xvzf - -C .
```

```bash
# optionally, install the CLI locally
mv kairosctl /usr/local/bin/kairosctl
chmod +x /usr/local/bin/kairosctl
```

```
./kairosctl --help
NAME:
Expand Down Expand Up @@ -37,16 +48,12 @@ COPYRIGHT:
Ettore Di Giacinto
```

## `create-config`
## create-config

{{% alert title="Warning" %}}
This command has not yet been migrated to kairosctl. Use the kairos-agent in the meantime.
{{% /alert %}}

Generates a new Kairos configuration file which can be used as `cloud-init`, with a new unique EdgeVPN network token:
Generates a new Kairos configuration file which can be used as cloud-init, with a new unique EdgeVPN network token:

```
$ ./kairos create-config
$ ./kairosctl create-config
kairos:
network_token: b3RwOgogIGRodDoKICAgIGludGVydmFsOiA5MjIzMzcyMDM2ODU0Nzc1ODA3CiAgICBrZXk6IEVCMzJJMlNXTjJCNFBHNEtCWTNBUVBBS0FWRTY0Q0VLVUlDTktTUFVWVU5BWTM0QklEQ0EKICAgIGxlbmd0aDogMzIKICBjcnlwdG86CiAgICBpbnRlcnZhbDogOTIyMzM3MjAzNjg1NDc3NTgwNwogICAga2V5OiBDMk1RRk5DWEFVRElPWjVHM1pZUUIzVEVHTzVXVEdQR1pZSEVQQkY3SFEyVUROUlZCTkxRCiAgICBsZW5ndGg6IDMyCnJvb206IGp6Q29kQVVOWUZSUklQU3JISmx4d1BVUnVxTGJQQnh4CnJlbmRlenZvdXM6IG5NckRCbllyVVBMdnFPV0Z2dWZvTktXek1adEJIRmpzCm1kbnM6IGpQUUhIbVZza2x6V29xbWNkeVlnbVhMSVFjTE1HUFN6Cm1heF9tZXNzYWdlX3NpemU6IDIwOTcxNTIwCg==
offline: false
Expand All @@ -73,16 +80,12 @@ stages:
- github:yourhandle!
```

## `generate-token`

{{% alert title="Warning" %}}
This command has not yet been migrated to kairosctl. Use the kairos-agent in the meantime.
{{% /alert %}}
## generate-token

Generates a new EdgeVPN network token which can be used in a configuration file:

```
$ ./kairos generate-token
$ ./kairosctl generate-token
b3RwOgogIGRodDoKICAgIGludGVydmFsOiA5MjIzMzcyMDM2ODU0Nzc1ODA3CiAgICBrZXk6IFhMMjRYUk1MTlFOQ1pJQTU0SVFLQ1laMk83SENQWEFBU1ZKN0tZSTQ3MzVaUkpKSktRSEEKICAgIGxlbmd0aDogMzIKICBjcnlwdG86CiAgICBpbnRlcnZhbDogOTIyMzM3MjAzNjg1NDc3NTgwNwogICAga2V5OiBMR1dMWFBTUllaU0ZERDdOT0pBNzdKV0ZWQjRHVkZBMjJIWlZPWU1VT0lNSFVYNFZXUURRCiAgICBsZW5ndGg6IDMyCnJvb206IFRtcUt5VnFHQ1ZZam9TRm9CTEVNRGVEdmJzelBkVEdoCnJlbmRlenZvdXM6IGttb3J4Q21sY2NjVVppWmdkSW5xTERvTGJtS3ZGdm9mCm1kbnM6IEZkWVdQc2R4aHdvWHZlb0VzSXNnVHRXbEJUbE9IVHJmCm1heF9tZXNzYWdlX3NpemU6IDIwOTcxNTIwCg==
```

Expand All @@ -104,9 +107,9 @@ stages:
- github:yourhandle!
```

## `register`
## register

The **register** command can be used to register and drive installation of nodes via QR code with a `cloud-init` config file (with `--config`).
The `register` command can be used to register and drive installation of nodes via QR code with a `cloud-init` config file (with `--config`).

```
NAME:
Expand Down Expand Up @@ -144,8 +147,28 @@ After the pairing is done, the node will start installation with the provided op

A `--device` and a `--config` file are required in order to have a functional installation.

## `bridge`
## bridge

Connect to the nodes in the VPN P2P network by creating a tun device on the host.

It needs a `--network-token`(`$NETWORK_TOKEN`) argument and exposes an API endpoint available at [localhost:8080](http://localhost:8080) to monitor the network status.
It needs a `--network-token`(`$NETWORK_TOKEN`) argument and exposes an API endpoint available at [localhost:8080](http://localhost:8080) to monitor the network status.

## validate

The `validate` command can be used to validate a cloud config file.

```
NAME:
kairosctl validate - Validates a cloud config file

USAGE:
kairosctl validate [command options] [arguments...]

DESCRIPTION:

The validate command expects a configuration file as its only argument. Local files and URLs are accepted.


OPTIONS:
--help, -h show help
```