Repository navigation
feat: support Cluster API bootcmd and runcmd - #13
Draft
navaneeth-dev wants to merge 2 commits into
Draft
navaneeth-dev wants to merge 2 commits into
navaneeth-dev wants to merge 2 commits into
Conversation
navaneeth-dev
force-pushed
the
feat/runcmd-cluster-api
branch
from
October 22, 2026 14:22
f8130d0 to
cd6a0fe
Compare
This was referenced Oct 22, 2026
Generate verbatim /bin/sh scripts under /opt/butane-init and oneshot units: bootcmd runs every boot before network-online.target, runcmd runs once per machine ID after it. Provide a cloud-init-per replacement and reserve the generated paths against write_files. Signed-off-by: Navaneeth <me@rizexor.com>
Write the generated systemd units and the cloud-init-per replacement as files that read exactly as they land on disk, loaded with go:embed, instead of Go string constants assembled by concatenation. The generated Butane output is unchanged. A test keeps the hard-coded paths reserved against write_files. Signed-off-by: Navaneeth <me@rizexor.com>
navaneeth-dev
force-pushed
the
feat/runcmd-cluster-api
branch
from
October 27, 2026 10:00
cd6a0fe to
262af91
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
bootcmdandruncmdsupport, so a Cluster API worker cloud-config can run its pre-kubeadm commands,kubeadm join, and post-kubeadm commands on Flatcar.#!/bin/shscript at/opt/butane-init/<stanza>.sh(root, mode 0700) withoutset -e, matching cloud-init. A failing command does not stop later ones./opt, not/etc, because Flatcar 4757 mounts/etcas anoexecconfext overlay.bootcmdruns every boot throughbutane-init-bootcmd.service, afternetwork.targetand beforenetwork-online.targetandruncmd. If it fails,runcmdstill runs.runcmdruns once per instance throughbutane-init-runcmd.service, afternetwork-online.target. An instance is the Flatcar machine ID. The marker/var/lib/butane-init/sem/<machine-id>/runcmdis written before the commands run, so failed or interrupted runs are not retried, andflatcar-resetcauses a rerun.PATHwith/opt/butane-init/bin:/opt/binfirst,HOME=/root, andINSTANCE_ID=%m.cloud-init-perreplacement are plain files undercommands/, embedded with//go:embed; a test keeps every path they use reserved againstwrite_files.cloud-init-perreplacement (once|instance|always) is provided because Flatcar has no cloud-init. Commands are never rewritten, and no other cloud-init tools are provided.write_filescontent already exists whenbootcmdruns, unlike cloud-init's first boot./var/log/cloud-init-output.logis not emulated.multi-user.targetindefinitely./opt/butane-init,/var/lib/butane-init, the unit files and drop-in directories, theirmulti-user.target.wantssymlinks, and Ignition's preset file are reserved, andwrite_filesentries that target them are rejected. An oracle review found that the preset file and symlinks could otherwise disable the units.butane --strict, and a Flatcar 4757.2.1 QEMU boot plus reboot. The checks covered: unit ordering, the environment, noset -e, the Cluster API sentinel,runcmdskipped after a failed first run,bootcmdrerunning on every boot, and thecloud-init-permarkers.flatcar-reset --keep-paths /var/lib/butane-initwas also tested: with a new machine ID,runcmdandcloud-init-per instanceran again, whilecloud-init-per oncedid not. A reset without kept paths wipes the markers, so everything runs again.cloud-init-perpassesshellcheck -s sh.