Skip to main content

Module cloud_init

Module cloud_init 

Source
Expand description

The cloud-init carrier for a machine’s recipe (design plan/phase4/design.md §2.1, §2.3, §5b): the shell library and a recipe’s calls, as one sh script, delivered in a write_files entry (gzip then base64, encoding: gz+b64) and run from runcmd at the step’s place in the machine’s set-up.

Parity by construction. The script is exactly shell::script’s output, the same text a Linux VM’s shell set-up runs. cloud-init only delivers it compressed and runs it, so it leaves exactly the state the shell renderer leaves. The resource conformance harness proves it by running real cloud-init (cargo xtask conformance --renderer cloud-init): cloud-init writes and runs the script, then the shell library applied on top changes nothing.

Why the whole script, not cloud-init’s own modules (design decision 5): cloud-init’s packages:, users: and the rest run in cloud-init’s fixed module order, not the recipe’s, and before runcmd (so before the routes, project, files, secrets and waits the set-up runs there). A recipe step reordered that way would change what the next step sees, and a native module that quietly makes a change can’t set the restart mark a later service step reads, so a service would not restart when the shell renderer would restart it. The library keeps one implementation, guarded and ordered, that every carrier runs the same way.

Size. A provider that caps user data (Limit) measures the whole document; gzip keeps a recipe’s script small, and Limit::fits refuses, naming the machine, what still overflows.

Structs§

Configure
A machine’s Step::Configure as cloud-init carries it: the script delivered in a WriteFile, and the runcmd that runs it under LABEL.
TooBig
A machine’s user data doesn’t fit its provider’s cap.
WriteFile
A file cloud-init writes before it runs anything (write_files): a recipe’s script, gzip then base64, which cloud-init decodes with encoding: gz+b64.

Enums§

Limit
How large a provider lets a machine’s user data be, in bytes of the document it receives (design §4.9 cloud design; a docker-vm, Proxmox or ESXi snippet has no such cap).

Constants§

DIR
Where a machine’s configure scripts are delivered on it.
LABEL
What the ready file calls a configure run (the same label every carrier gives it).

Functions§

configure
The index-th configure run of machine c, its resources and fresh flag as the shell renderer takes them (see shell::script): the script compressed into a write_files entry and the runcmd that runs it. A machine’s runs are numbered from 0, in set-up order.
gz_b64
script gzip-compressed then base64-encoded, for a write_files entry’s content with encoding: gz+b64. Deterministic: the gzip header carries no modification time or name, so the same script gives the same bytes on every host.