Skip to content

feat: add supplemental cloud-init user-data support#72

Draft
brngates98 wants to merge 5 commits into
Stellatarum:mainfrom
brngates98:feat/cloud-init-user-data
Draft

feat: add supplemental cloud-init user-data support#72
brngates98 wants to merge 5 commits into
Stellatarum:mainfrom
brngates98:feat/cloud-init-user-data

Conversation

@brngates98

@brngates98 brngates98 commented Jun 18, 2026

Copy link
Copy Markdown

Summary

Addresses #68.

Adds optional supplemental cloud-init user-data configuration, similar to other Rancher node drivers (e.g. Harvester/VMware). Users can start from stock cloud-image templates and layer custom cloud-config at node pool creation time instead of baking everything into a custom template.

Changes

  • Add --pve-cloud-init / PVE_CLOUD_INIT for an optional user-data source (local file path or URL)
  • Add --pve-cloud-config / PVE_CLOUD_CONFIG for an optional cloud-config YAML file path
  • Merge user-provided cloud-config with driver defaults (hostname, SSH user, Rancher SSH public key injection)
  • Expose both options in the Rancher UI extension
  • Add unit tests for default generation, cloud-config merge, and file/URL loading

If both options are set, --pve-cloud-config takes precedence over --pve-cloud-init.

Example cloud-config

For the use case in #68, users can supply something like:

#cloud-config
packages:
  - qemu-guest-agent
  - nfs-common
runcmd:
  - systemctl enable --now qemu-guest-agent

This does not auto-install qemu-guest-agent in the default generated user-data. Users supply packages and bootstrap steps via the new options above.

Test plan

  • go test ./cmd/docker-machine-driver-pve/driver/ -run 'TestGenerateCloudinit|TestLoadCloudConfig'
  • Create a VM from a stock cloud-image template with --pve-cloud-config pointing at a YAML file that installs qemu-guest-agent
  • Verify cloud-init completes successfully
  • Verify SSH access works with the injected Rancher public key
  • Verify qemu-guest-agent is installed and running
  • Verify --pve-cloud-init works with a local file path
  • Verify --pve-cloud-init works with a URL
  • Verify the new Cloud-init fields appear in the Rancher UI extension and persist to machine config

Related

Add pve cloud-init source and cloud-config options, merge user-data with SSH key injection, and expose the new options in the Rancher UI.

Made-with: Cursor
Signed-off-by: brngates98 <briangates1998@gmail.com>
Refactor cloud-init user merge helpers and test names to satisfy wsl/testifylint/varnamelen, replace timeout magic number with a constant, and annotate SetConfigFromFlags for gocognit.

Made-with: Cursor
Signed-off-by: brngates98 <briangates1998@gmail.com>
@brngates98 brngates98 force-pushed the feat/cloud-init-user-data branch from b7c8756 to 6f7d5ba Compare June 18, 2026 22:45
brngates98 and others added 3 commits June 18, 2026 20:13
Add pve-user-data driver support and a multiline User Data field in the Rancher UI, matching Harvester and vSphere workflows for pasting cloud-config YAML directly.

Signed-off-by: brngates98 <briangates1998@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Show the cloud-init User Data field in the primary machine pool form instead of Advanced, and fix gofumpt formatting in cloud-init tests.

Signed-off-by: brngates98 <briangates1998@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
LabeledInput type=multiline pulls in TextAreaAutoGrow in a way that breaks the machine-config extension chunk at runtime, which hides all PVE driver fields in Rancher.

Signed-off-by: brngates98 <briangates1998@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant