Repository navigation
Conversation
✅ Deploy Preview for zarf-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report❌ Patch coverage is
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
a1994sc
force-pushed
the
feature/kube-context
branch
2 times, most recently
from
October 18, 2026 21:49
fc1d083 to
6ea1e4f
Compare
Member
|
@a1994sc Will have to dig into the details more, but I believe these are changes that we want. Thanks for the PR! Would you mind first separating the fixing the panic on vendored flags into a separate PR. I want to give space to evaluate that separately as there's multiple ways to go about it |
2 tasks done
a1994sc
force-pushed
the
feature/kube-context
branch
from
October 19, 2026 18:08
6ea1e4f to
99f14bc
Compare
Member
Author
|
@AustinAbro321 created a seperate pr, and stacked the pr |
a1994sc
force-pushed
the
feature/kube-context
branch
from
October 20, 2026 21:32
99f14bc to
c0779b1
Compare
Signed-off-by: Allen Conlon <software@conlon.dev>
Signed-off-by: Allen Conlon <software@conlon.dev>
Signed-off-by: Allen Conlon <software@conlon.dev>
Signed-off-by: Allen Conlon <software@conlon.dev>
a1994sc
force-pushed
the
feature/kube-context
branch
from
October 29, 2026 23:27
c0779b1 to
51fd372
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds global
--kubeconfigand--contextflags so a Zarf invocation can be pointed at a specific cluster, the waykubectl --contextdoes.cluster.ClientAndConfigbuilt its client fromclientcmd.NewDefaultClientConfigLoadingRules()withniloverrides, so the two slots that would carry a kubeconfig path and a context name were never filled.KUBECONFIGworked only because the default rules read it; there was no way at all to pick a context.Both flags are also readable from a config file (
kubeconfig,context) and fromZARF_KUBECONFIG/ZARF_CONTEXT.The selection reaches everything, not just Zarf's own client. That was the point of #2509 — one place to configure Kubernetes for all the tools Zarf carries — so it is threaded through four paths:
cluster.ConnectOptionsfillsloadingRules.ExplicitPathandConfigOverrides.CurrentContextzarf tools kubectl|helm|monitorKUBECONFIGin the process environmentKUBECONFIGappended to the action environmentwait:actionsConnectOptionsthroughactions.RunOptionsThe Helm SDK (
cli.New()) andsrc/pkg/waitpick it up from the sameKUBECONFIG, so they agree without special casing.zarf tools kubectl --context <name>is unchanged and still uses kubectl's own flag.Notes for review
KUBECONFIG: clientcmd takescurrent-contextfrom the first file that sets one and everything else from the rest. The overlay therefore holds a context name and no credentials, which matters because a vendored tool can callos.Exititself and skip the cleanup. An earlier draft copied the merged kubeconfig and was dropped for that reason. Selecting only--kubeconfigwrites nothing at all.current-contextwould deploy to the wrong cluster.zarf --context dev tools …is exactly the invocation shape that panics. This PR goes back to amainbase once fix(cmd): don't redefine vendored tool flag shorthands #5496 merges.cluster.New,NewWithWaitandClientAndConfigtake variadicConnectOptions, which is source compatible, so no call site changed and this is not a breaking change.dev deployis wired too, since it builds its ownDeployOptionsrather than going throughDeploy.DeployOptions.Clusterfor library callers holding a connection). The two are complementary rather than competing: a*cluster.Clustercannot express the selection to a shelled-outkubectlor to await:action, which is whatConnectOptionscarries. Only theDeployOptionsstruct is shared; whichever merges second rebases on the other.Testing
Unit tests cover the overlay contents and permissions, context resolution through
ClientAndConfig, the preRun wiring and vendored-hook chaining, the shorthand branch, the dummy-flag guard, andConnectOptionsreachingwaitand the action environment. Each was checked to fail without the change.Verified by hand against a kubeconfig with two contexts, for
package deploy/package list,tools kubectl,tools helm, config-file and env-var sources, an unknown context, and anonDeployaction runningzarf tools kubectl config current-context.Not covered: no e2e test, which would need a second cluster context in CI.
Related Issue
Fixes #4307
Fixes #2509
Relates to #5223
Checklist before merging