Skip to content

feat: add --exec-interactive-mode to auth update-kubeconfig#221

Merged
ecv merged 1 commit into
mainfrom
feat/update-kubeconfig-exec-interactive-mode
Jun 24, 2026
Merged

feat: add --exec-interactive-mode to auth update-kubeconfig#221
ecv merged 1 commit into
mainfrom
feat/update-kubeconfig-exec-interactive-mode

Conversation

@ecv

@ecv ecv commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds --exec-interactive-mode to datumctl auth update-kubeconfig, letting callers set the exec credential plugin's interactiveMode directly instead of the hardcoded IfAvailable.

Closes #220.

Why

Non-interactive contexts (CI, scripts) have no TTY. The IfAvailable default forces callers to patch the generated kubeconfig after the fact:

datumctl auth update-kubeconfig --project p ...
kubectl --kubeconfig ... config set-credentials datum-user --exec-interactive-mode=Never

In datum-cloud/infra that patch is duplicated across ~15 Chainsaw test sites (datum-cloud/infra#2806). This flag removes the need for it.

Changes

  • Add --exec-interactive-mode accepting Never / IfAvailable / Always
  • Default IfAvailable — no behavior change for existing callers
  • Validate the value; error on anything else
  • Table test covering default, each valid mode, and rejection

Validation

$ datumctl auth update-kubeconfig --project p --hostname https://api.example.test \
    --exec-interactive-mode Never --kubeconfig /tmp/kc
$ grep interactiveMode /tmp/kc
      interactiveMode: Never

$ datumctl auth update-kubeconfig --project p --exec-interactive-mode Bogus
error: invalid --exec-interactive-mode "Bogus": must be one of Never, IfAvailable, Always

go build ./..., go vet, and go test ./internal/cmd/auth/ all pass.

Add a flag to 'datumctl auth update-kubeconfig' that sets the exec
credential plugin's interactiveMode directly, instead of hardcoding
IfAvailable.

Non-interactive contexts (CI, scripts) have no TTY, so the IfAvailable
default leaves callers patching the generated kubeconfig afterward with
'kubectl config set-credentials --exec-interactive-mode=Never'. The new
flag lets them set it at the source.

Key changes:
- Add --exec-interactive-mode flag accepting Never, IfAvailable, Always
- Default IfAvailable to preserve existing behavior
- Validate the value and error on anything else
- Cover default, each valid mode, and rejection with a table test

Closes #220
@ecv ecv requested a review from scotwells June 24, 2026 17:00
@ecv ecv marked this pull request as ready for review June 24, 2026 17:00
@ecv ecv enabled auto-merge June 24, 2026 17:01
@ecv ecv merged commit f844c6c into main Jun 24, 2026
4 checks passed
@ecv ecv deleted the feat/update-kubeconfig-exec-interactive-mode branch June 24, 2026 17: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.

auth update-kubeconfig: add flag to set exec interactiveMode

2 participants