From 6d364ffdcda4fb189e9f1daa12971d7e497968d8 Mon Sep 17 00:00:00 2001 From: Kimmo Lehto Date: Fri, 18 Jun 2021 09:56:39 +0300 Subject: [PATCH] Hooks documentation (#155) --- README.md | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 12b6c2fa..695ade64 100644 --- a/README.md +++ b/README.md @@ -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