You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Day-to-day work needs a sticky default target. OpenShift users get that with oc project <name> (updates the current kubeconfig context's namespace). Kubernetes users use kubectx / kubens.
With Deployah you must pass -n / --context every time, or rely on kubeconfig current context when the platform entry has no context. That is easy to get wrong across local kind + remote clusters, and it does not map cleanly to Deployah environments (local, staging, prod), which already encode the intended context in the platform file.
Goals
A first-class command to show and switch the active target for subsequent Deployah (and optionally kubectl) commands.
Support switching namespace and/or kube context, in an oc project / kubens / kubectx familiar shape.
Prefer a Deployah-native mode: switch by environment name (reads platform context, optional default namespace).
Show current target clearly (deployah use / deployah project with no args).
Tab completion for environments / contexts / namespaces where practical.
Document how this interacts with flags (--context still wins) and with the local cluster kubeconfig (Deployah already prefers not to force-merge kind into ~/.kube/config).
Non-goals
Replacing platform-file ownership of environment → cluster mapping.
Implementing full oc login / OAuth flows.
Multi-cluster project federation.
Changing deploy semantics when -n / --context are explicitly set.
Proposed design
Command shape (names open)
Pick one primary name; others as aliases:
deployah use # show current
deployah use staging # Deployah environment → context (+ ns if configured)
deployah use -n payments # namespace only (oc project / kubens style)
deployah use --context kind-deployah
deployah project payments # alias focused on namespace
deployah ctx # optional alias for context-only (kubectx-like)
Two complementary modes
Mode
Input
Effect
Environment (recommended default)
deployah use staging
Resolve environments.staging.context from platform file; set sticky defaults for Deployah; optionally update kubeconfig current-context
Namespace
deployah use -n foo / deployah project foo
Set namespace on current context (like oc project)
Context
deployah use --context X
Switch kubeconfig current-context (like kubectx)
Persistence
Recommendation: Deployah-only sticky state by default (Option B), with optional kubeconfig write for oc project parity.
Option
Mechanism
Notes
A – kubeconfig
ModifyConfig current-context / namespace
Closest to oc project; affects kubectl too
B – Deployah active state (default)
.deployah/active or ~/.config/deployah/active.yaml
Safer with localkube's separate kubeconfig path
C – shell export
eval $(deployah use staging --print-env)
Session-scoped; no file writes
Optional: --kubeconfig-write enables Option A when users want kubectl to follow. DPY_NAMESPACE already exists in session constants and should participate in precedence.
Problem
Day-to-day work needs a sticky default target. OpenShift users get that with
oc project <name>(updates the current kubeconfig context's namespace). Kubernetes users usekubectx/kubens.With Deployah you must pass
-n/--contextevery time, or rely on kubeconfig current context when the platform entry has nocontext. That is easy to get wrong across local kind + remote clusters, and it does not map cleanly to Deployah environments (local,staging,prod), which already encode the intended context in the platform file.Goals
oc project/kubens/kubectxfamiliar shape.context, optional default namespace).deployah use/deployah projectwith no args).--contextstill wins) and with the local cluster kubeconfig (Deployah already prefers not to force-merge kind into~/.kube/config).Non-goals
oc login/ OAuth flows.-n/--contextare explicitly set.Proposed design
Command shape (names open)
Pick one primary name; others as aliases:
Two complementary modes
deployah use stagingenvironments.staging.contextfrom platform file; set sticky defaults for Deployah; optionally update kubeconfig current-contextdeployah use -n foo/deployah project foooc project)deployah use --context Xkubectx)Persistence
Recommendation: Deployah-only sticky state by default (Option B), with optional kubeconfig write for
oc projectparity.ModifyConfigcurrent-context / namespaceoc project; affects kubectl too.deployah/activeor~/.config/deployah/active.yamleval $(deployah use staging --print-env)Optional:
--kubeconfig-writeenables Option A when users want kubectl to follow.DPY_NAMESPACEalready exists in session constants and should participate in precedence.Show current
Precedence (document)
Align with the existing README precedence table and extend it.
Failure modes
--force(kubens-fstyle).usewith no platform file in env mode → fall back to context/namespace-only or error with hint.Alternatives considered
kubectl config set-context --current --namespace=only. Works; ignores Deployah environments and localkube path quirks.deployah use staging --print-flags). Useful for scripts; weak interactive UX alone.deployah.yamlenvironments. Wrong layer for "where am I working right now"; sticky CLI state is enough.Compatibility and migration
--context/-nremain authoritative.deployah resolve --environments,deployah cluster kubeconfig, local cluster contextkind-deployah.deployah usefor local vs remote workflows.Test plan
use localthendeploy/statushit kind without--contextuse -n foowith and without--kubeconfig-writeoc projectChecklist