Skip to content

Commit

Permalink
📝 Expand config reference with cloud-init syntax (kairos-io#227)
Browse files Browse the repository at this point in the history
* 📝 Expand config reference with cloud-init syntax

* 🤖 Add mix-syntax test
  • Loading branch information
mudler authored Oct 17, 2022
1 parent 8003e45 commit f333f76
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
26 changes: 24 additions & 2 deletions docs/src/pages/reference/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ index: 5
Here you can find a full reference of the fields available to configure a Kairos node.

```yaml
#node-config
#cloud-config

# The kairos block enables the p2p full-mesh functionalities.
# To disable, don't specify one.
Expand Down Expand Up @@ -100,11 +100,33 @@ options:
recovery-system.uri: ""
# Just set it to eject the cd after install
eject-cd: ""

# Standard cloud-init syntax, see: https://github.com/mudler/yip/tree/e688612df3b6f24dba8102f63a76e48db49606b2#compatibility-with-cloud-init-format
growpart:
devices: ['/']

users:
- name: "kairos"
passwd: "kairos"
lock_passwd: true
groups: "admins"
ssh_authorized_keys:
- github:mudler

runcmd:
- foo
hostname: "bar"
write_files:
- encoding: b64
content: CiMgVGhpcyBmaWxlIGNvbnRyb2xzIHRoZSBzdGF0ZSBvZiBTRUxpbnV4
path: /foo/bar
permissions: "0644"
owner: "bar"
```
## Syntax
Kairos supports the standard `cloud-init` syntax, and the extended one from the [Elemental-toolkit](https://rancher.github.io/elemental-toolkit/docs/reference/cloud_init/) which is based on [yip](https://github.com/mudler/yip).
Kairos supports the standard `cloud-init` syntax, and the extended syntax which is based on [yip](https://github.com/mudler/yip).

Examples using the extended notation for running K3s as agent or server are in [examples](https://github.com/kairos-io/kairos/tree/master/examples).

Expand Down
19 changes: 19 additions & 0 deletions tests/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,25 @@ bundles:
return out
}, ContainSubstring("peerguard"))
})
It("cloud-config syntax mixed with extended syntax", func() {
testInstall(`#cloud-config
install:
auto: true
device: /dev/sda
users:
- name: "kairos"
passwd: "kairos"
stages:
initramfs:
- name: "Set user and password"
commands:
- echo "bar" > /etc/foo
`, func() string {
var out string
out, _ = Sudo("cat /etc/foo")
return out
}, ContainSubstring("bar"))
})
It("with config_url", func() {
testInstall(`
install:
Expand Down

0 comments on commit f333f76

Please sign in to comment.