Skip to content

Commit 6d364ff

Browse files
authored
Hooks documentation (#155)
1 parent 074ca38 commit 6d364ff

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,36 @@ Example:
273273
* `dstDir`: Destination directory for the file(s). `k0sctl` will create full directory structure if it does not already exist on the host.
274274
* `perm`: File permission mode for uploaded file(s) and created directories
275275

276+
###### `spec.hosts[*].hooks` <mapping> (optional)
277+
278+
Run a set of commands on the remote host during k0sctl operations.
279+
280+
Example:
281+
282+
```yaml
283+
hooks:
284+
apply:
285+
before:
286+
- date > k0sctl-apply.log
287+
after:
288+
- echo "apply success" > k0sctl-apply.log
289+
```
290+
291+
The currently available "hook points" are:
292+
293+
* `apply`: Runs during `k0sctl apply`
294+
- `before`: Runs after configuration and host validation, right before configuring k0s on the host
295+
- `after`: Runs before disconnecting from the hosts after a successful apply operation
296+
* `backup`: Runs during `k0s backup`
297+
- `before`: Runs before k0sctl runs the `k0s backup` command
298+
- `after`: Runs before disconnecting from the hosts after successfully taking a backup
299+
* `reset`: Runs during `k0sctl reset`
300+
- `before`: Runs after gathering information about the cluster, right before starting to remove the k0s installation.
301+
- `after`: Runs before disconnecting from the hosts after a successful reset operation
302+
276303
##### `spec.hosts[*].os` <string> (optional) (default: ``)
277304

278-
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:
305+
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:
279306
```yaml
280307
- role: worker
281308
os: debian

0 commit comments

Comments
 (0)