Skip to content

feat(kubectl): add global context and identity flags (#857)#858

Open
pszymkowiak wants to merge 1 commit intodevelopfrom
feat/kubectl-global-flags
Open

feat(kubectl): add global context and identity flags (#857)#858
pszymkowiak wants to merge 1 commit intodevelopfrom
feat/kubectl-global-flags

Conversation

@pszymkowiak
Copy link
Collaborator

Summary

Adds KubectlGlobalArgs struct with global kubectl flags shared across all subcommands:

Flag Description
--context kubeconfig context (multi-cluster)
--kubeconfig custom kubeconfig path
-n / --namespace namespace scope
-l / --selector label selector
--as user impersonation

These flags now work on rtk kubectl pods, rtk kubectl services, and rtk kubectl logs.

Example: rtk kubectl pods --context prod -n api -l app=web

Based on PR #426 by @jordi-murgo (inactive since March 9), rebased on develop.
Closes #857 (partial — global flags done, TOML filters for describe/apply/top still needed).

Test plan

  • 1126 tests passed, 0 failed
  • cargo fmt clean
  • cargo clippy clean
  • 3 new tests: flag parsing, to_args conversion, all-namespaces + context combo

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 <patrick.szymkowiak@innovtech.eu>
@aeppling
Copy link
Contributor

Hey

We are cleaning up the codebase and improving the project structure for better onboarding. As part of this effort, PR #826 reorganizes src/ from a flat layout into subfolders.

No logic changes — only file moves and import path updates.

What you need to do

Rebase your branch on develop when receiving this comment:

git fetch origin && git rebase origin/develop

Git 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

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