Repository navigation
feat(kubectl): support global context and identity flags - #426
jordi-murgo wants to merge 1 commit into
Conversation
Forward kubectl global flags (--context, --kubeconfig, -n, -l, --as) to filtered pods/services/logs commands so context-scoped workflows do not fail under rtk parsing.
|
Hi! Thanks for the contribution! Since March 6, all PRs should target the Could you update the base branch? Click Edit at the top right of this PR and change it from Thanks! |
|
|
Add KubectlGlobalArgs struct with --context, --kubeconfig, -n, -l, --as flags shared across all kubectl subcommands (pods, services, logs). These flags are forwarded to the underlying kubectl command. Essential for multi-cluster workflows where --context and -n are used on every command. Based on PR #426 by @jordi-murgo, rebased on develop. Also fixes pre-existing clippy warning in rake_cmd.rs. 1126 tests passed, 0 failed. Signed-off-by: Patrick szymkowiak <[email protected]>
|
Hey We are cleaning up the codebase and improving the project structure for better onboarding. As part of this effort, PR #826 reorganizes No logic changes — only file moves and import path updates. What you need to doRebase your branch on git fetch origin && git rebase origin/developGit detects renames automatically. If you get import conflicts, update the paths: use crate::git; // now: use crate::cmds::git::git;
use crate::tracking; // now: use crate::core::tracking;
use crate::config; // now: use crate::core::config;
use crate::init; // now: use crate::hooks::init;
use crate::gain; // now: use crate::analytics::gain;Need help rebasing? Tag @aeppling |
Add KubectlGlobalArgs struct with --context, --kubeconfig, -n, -l, --as flags shared across the kubectl pods, services and logs subcommands. These flags are forwarded to the underlying kubectl command. Without them, `rtk kubectl pods --context prod` failed clap parsing with "unknown command", forcing users onto raw kubectl and losing RTK filtering. Essential for multi-cluster workflows where --context and -n are used on every command. Reapplies the core change from #426 by @jordi-murgo onto the current develop layout (the original branch predated the #826 src/ reorg). Closes #857 (partial — global flags done; TOML filters for describe/apply/top still tracked separately). Co-authored-by: Jordi Murgó <[email protected]>
|
Thanks @jordi-murgo! The kubectl global-flags work was carried forward in a later PR and this one has had no activity for ~8 weeks. Closing as superseded — reopen anytime if needed. |
Summary
KubectlGlobalArgsparser tokubectl pods,kubectl services, andkubectl logs--context,--kubeconfig,-n,-l, and--asto underlying kubectl invocationsWhy
Using
rtk kubectlcurrently drops common kubectl global flags, which breaks context-specific workflows (e.g.--context). This keeps filtered commands aligned with normal kubectl ergonomics.Validation
cargo test test_kubectl -- --nocapturecargo build --releasertk kubectl pods --context savage-ovhrtk kubectl services --context savage-ovh