From f8d4c9a01047c8e5effbb5c73c6412b59608fc5b Mon Sep 17 00:00:00 2001 From: Emmanuel Oppong Date: Sat, 28 Feb 2026 14:31:47 -0600 Subject: [PATCH] fix: avoid mutating shared Configuration when ClientOnly is set (#11463) --- pkg/action/install.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkg/action/install.go b/pkg/action/install.go index 2f747a789..f4af99992 100644 --- a/pkg/action/install.go +++ b/pkg/action/install.go @@ -324,6 +324,17 @@ func (i *Install) RunWithContext(ctx context.Context, ch ci.Charter, vals map[st if !interactWithServer(i.DryRunStrategy) { // Add mock objects in here so it doesn't use Kube API server // NOTE(bacongobbler): used for `helm template` + // + // Work on a local copy of the Configuration so that we do not mutate + // the shared *Configuration that was passed to NewInstall. Callers that + // reuse the same cfg across multiple actions must not observe the fake + // KubeClient or in-memory Releases that are only relevant for this + // client-only run. + origCfg := i.cfg + cfgCopy := *i.cfg + i.cfg = &cfgCopy + defer func() { i.cfg = origCfg }() + i.cfg.Capabilities = common.DefaultCapabilities.Copy() if i.KubeVersion != nil { i.cfg.Capabilities.KubeVersion = *i.KubeVersion