Skip to content

feat(oms): confirm secret changes in update install-config - #678

Merged
NJona merged 6 commits into
mainfrom
jona/oms-update-install-config-confirm
Aug 13, 2026
Merged

feat(oms): confirm secret changes in update install-config#678
NJona merged 6 commits into
mainfrom
jona/oms-update-install-config-confirm

Conversation

@NJona

@NJona NJona commented Aug 12, 2026

Copy link
Copy Markdown
Member

Two changes to oms update install-config:

It now generates the secrets an existing vault is missing. A vault written by an older oms predates whatever the current one requires, and nothing on the upgrade path fills the gap: oms install never touches secrets and oms init install-config writes a fresh vault rather than extending one. Strictly additive — every entry the vault already holds is kept, including the ones EnsureSecrets would otherwise overwrite.

And it asks before it changes anything in the vault, listing what it would regenerate or generate first. -y/--yes approves up front; a run without a terminal answers no, so an unattended upgrade never rewrites a secret by itself. Declining a regeneration aborts the update — the certificates cover values that would otherwise already be in the config — while declining a missing secret just skips it.

Two changes to `oms update install-config`:

It now generates the secrets an existing vault is missing. A vault written
by an older oms predates whatever the current one requires, and nothing on
the upgrade path fills the gap: `oms install` never touches secrets and
`oms init install-config` writes a fresh vault rather than extending one.
Strictly additive — every entry the vault already holds is kept, including
the ones EnsureSecrets would otherwise overwrite.

And it asks before it changes anything in the vault, listing what it would
regenerate or generate first. `-y`/`--yes` approves up front; a run without
a terminal answers no, so an unattended upgrade never rewrites a secret by
itself. Declining a regeneration aborts the update — the certificates cover
values that would otherwise already be in the config — while declining a
missing secret just skips it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Jona Neef <Jona.Neef.97@gmail.com>
@NJona NJona self-assigned this Aug 12, 2026
Signed-off-by: NJona <25478046+NJona@users.noreply.github.com>
@NJona
NJona requested a review from NautiluX August 12, 2026 08:08
Comment thread cli/cmd/update_install_config.go Outdated
Asking a yes/no question on stdin already existed as Prompter.Bool, so drop
the second implementation in update install-config and use it. Confirm() is
Bool with a false default, which is what a guard on a destructive change
wants: an empty line, a closed stdin or a non-interactive prompter all count
as no.

The prompter has nothing to do with installing, so it moves out of
internal/installer into internal/prompt.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Jona Neef <Jona.Neef.97@gmail.com>
@NJona
NJona requested a review from NautiluX August 12, 2026 11:28
revive wants one on a new package, and the move from internal/installer made
this one new.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Jona Neef <Jona.Neef.97@gmail.com>
Comment thread internal/prompt/prompt.go Outdated
Comment thread cli/cmd/update_install_config.go Outdated
Comment thread cli/cmd/update_install_config.go Outdated
Comment thread cli/cmd/update_install_config.go
Review follow-ups:

  - Confirm was Bool with a false default and nothing else, so it is gone
    again; the caller passes the default it wants.
  - The command holds a Prompter rather than a func, with the interface next
    to the implementation and a generated mock for the tests, like the rest
    of the code. The concrete type is now StdinPrompter, so the interface
    can carry the name, and the interactive collector takes it too.
  - maybeAddMissingSecrets said nothing about what makes it a "maybe":
    confirmAndAddMissingSecrets.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Jona Neef <Jona.Neef.97@gmail.com>
@NJona
NJona requested a review from NautiluX August 13, 2026 09:23

@NautiluX NautiluX left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only two minor things about comments, lgtm otherwise

Comment thread cli/cmd/update_install_config.go Outdated
Comment thread internal/prompt/prompt.go Outdated
EnsureDefaultSecrets replaced whatever the vault held with "dummy" on every
run, so an operator who set a real token lost it the next time anything
called EnsureSecrets. It is the only secret in there that did not keep an
existing value; the reason given was that the chart needs a non-empty value,
which is satisfied by filling in an entry that is missing or empty.

That was also the only thing standing between addMissingSecrets and a plain
"generate what is not there", so it loses the snapshot it took to undo the
overwrite, along with the paragraph explaining why it needed one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Jona Neef <Jona.Neef.97@gmail.com>
@NJona
NJona merged commit 4effac8 into main Aug 13, 2026
6 checks passed
@NJona
NJona deleted the jona/oms-update-install-config-confirm branch August 13, 2026 11:03
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.

2 participants