Skip to content

mtls: add -k flag to export and expiry subcommands - #1696

Open
magic-peach wants to merge 1 commit into
dapr:masterfrom
magic-peach:fix/mtls-export-expiry-kubernetes-flag
Open

magic-peach wants to merge 1 commit into
dapr:masterfrom
magic-peach:fix/mtls-export-expiry-kubernetes-flag

Conversation

@magic-peach

Copy link
Copy Markdown

Description

dapr mtls export and dapr mtls expiry never registered the -k/--kubernetes flag that every other mtls-adjacent command (dapr mtls, renew-certificate, init, upgrade, etc.) exposes, so cobra rejected it with "unknown shorthand flag". This PR registers the same flag on both subcommands, matching the existing pattern used throughout the rest of the CLI.

Issue reference

Please reference the issue this PR will close: #944

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

Notes:

  • Compiles: verified with go build . and confirmed dapr mtls export -k / dapr mtls expiry -k no longer fail with "unknown shorthand flag".
  • Tests: no existing test file covers cmd/mtls.go's flag registration, and neither subcommand's Run function reads kubernetesMode (they're Kubernetes-only already), so there's no behavior to unit test beyond flag parsing, which was verified manually.
  • Documentation: this only adds a flag that mirrors an existing, already-documented pattern, no separate doc update needed.

These two subcommands are Kubernetes only already but never registered
the -k shorthand every other mtls-adjacent command uses, so cobra
rejected it as an unknown flag. Register it the same way the sibling
commands do.

Signed-off-by: Akanksha Trehun <akankshatrehun@gmail.com>
@magic-peach
magic-peach requested review from a team as code owners September 6, 2026 14:10
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.

The mtls expiry and mtls export commands should have the -k option.

1 participant