Skip to content

Commit

Permalink
Hooks documentation (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
kke authored Jun 18, 2021
1 parent 074ca38 commit 6d364ff
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,36 @@ Example:
* `dstDir`: Destination directory for the file(s). `k0sctl` will create full directory structure if it does not already exist on the host.
* `perm`: File permission mode for uploaded file(s) and created directories

###### `spec.hosts[*].hooks` <mapping> (optional)

Run a set of commands on the remote host during k0sctl operations.

Example:

```yaml
hooks:
apply:
before:
- date > k0sctl-apply.log
after:
- echo "apply success" > k0sctl-apply.log
```

The currently available "hook points" are:

* `apply`: Runs during `k0sctl apply`
- `before`: Runs after configuration and host validation, right before configuring k0s on the host
- `after`: Runs before disconnecting from the hosts after a successful apply operation
* `backup`: Runs during `k0s backup`
- `before`: Runs before k0sctl runs the `k0s backup` command
- `after`: Runs before disconnecting from the hosts after successfully taking a backup
* `reset`: Runs during `k0sctl reset`
- `before`: Runs after gathering information about the cluster, right before starting to remove the k0s installation.
- `after`: Runs before disconnecting from the hosts after a successful reset operation

##### `spec.hosts[*].os` <string> (optional) (default: ``)

Override auto-detected OS distro. By default `k0sctl` detects the OS by reading `/etc/os-release` or `/usr/lib/os-release` files. In case your system is based on e.g. Debian but the OS release info has something else configured you can override `k0sctl` to use Debian based functionality for the node with:
Override OS distribution auto-detection. By default `k0sctl` detects the OS by reading `/etc/os-release` or `/usr/lib/os-release` files. In case your system is based on e.g. Debian but the OS release info has something else configured you can override `k0sctl` to use Debian based functionality for the node with:
```yaml
- role: worker
os: debian
Expand Down

0 comments on commit 6d364ff

Please sign in to comment.