feat(cluster): confirm before bootstrap turns the machine into a cluster node#206
Merged
Conversation
…ter node `burrow cluster bootstrap` installs k3s and burrowd on the current machine, so an accidental run on a laptop would convert it into a cluster node; it now warns and requires confirmation before any destructive action, reading the answer from /dev/tty so the prompt works under `curl | sh`, defaulting to no, with a `--yes` bypass for automation and a clear abort when there is no terminal and no `--yes`. Signed-off-by: Nicholas Phillips <nsphilli@gmail.com>
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.
burrow cluster bootstrap installs k3s and burrowd on the current machine, so an accidental run on a laptop (e.g.
curl -sfL <script> | sudo sh) would convert it into a cluster node. It now warns and requires confirmation before any destructive action.What changed
/dev/tty, not stdin, so the prompt still reaches the user undercurl -sfL <script> | sh, where the process stdin is the piped install script rather than the keyboard. The read sits behind aconfirmFnseam (like the existingnewIPDetector/newK3sInstallerseams) so tests inject the answer without a real terminal.--yesbool flag skips the prompt for intentional automation. The get.burrow.dev script does not pass it, so an interactive user always gets the prompt./dev/ttycannot be opened) and--yeswas not passed, bootstrap refuses with guidance to pass--yesrather than hanging or silently proceeding.Tests
Added to cmd/burrow/bootstrap_test.go, all seams faked (no real network, k3s, or cluster):
--yesskips the prompt and installs; a confirmed "yes" proceeds; a declined "no" aborts cleanly with the installer never called; no-tty without--yeserrors with--yesguidance and does not install; an already-running box skips the prompt. The existing bootstrap tests stay green.https://claude.ai/code/session_012euqxgVqHP5yQWi2HxDPKt