diff --git a/src/cmd/tools/helm/load_plugins.go b/src/cmd/tools/helm/load_plugins.go index 39edb9c3d9..28ea155030 100644 --- a/src/cmd/tools/helm/load_plugins.go +++ b/src/cmd/tools/helm/load_plugins.go @@ -299,6 +299,7 @@ func addPluginCommands(plugin *plugin.Plugin, baseCmd *cobra.Command, cmds *plug // Recursively add any sub-commands for _, cmd := range cmds.Commands { + cmdCopy := cmd // Create a fake command so that completion can be done for the sub-commands of the plugin subCmd := &cobra.Command{ // This prevents Cobra from removing the flags. We want to keep the flags to pass them @@ -308,7 +309,7 @@ func addPluginCommands(plugin *plugin.Plugin, baseCmd *cobra.Command, cmds *plug Run: func(_ *cobra.Command, _ []string) {}, } baseCmd.AddCommand(subCmd) - addPluginCommands(plugin, subCmd, &cmd) + addPluginCommands(plugin, subCmd, &cmdCopy) } } diff --git a/src/pkg/cluster/state.go b/src/pkg/cluster/state.go index 5fe6e4d9dd..3b96c60b08 100644 --- a/src/pkg/cluster/state.go +++ b/src/pkg/cluster/state.go @@ -92,7 +92,8 @@ func (c *Cluster) InitZarfState(initOptions types.ZarfInitOptions) error { } // This label will tell the Zarf Agent to ignore this namespace. namespace.Labels[agentLabel] = "ignore" - if _, err = c.UpdateNamespace(&namespace); err != nil { + namespaceCopy := namespace + if _, err = c.UpdateNamespace(&namespaceCopy); err != nil { // This is not a hard failure, but we should log it. message.WarnErrf(err, "Unable to mark the namespace %s as ignored by Zarf Agent", namespace.Name) } diff --git a/src/pkg/cluster/zarf.go b/src/pkg/cluster/zarf.go index e78ef9ed80..afef2362b3 100644 --- a/src/pkg/cluster/zarf.go +++ b/src/pkg/cluster/zarf.go @@ -79,7 +79,8 @@ func (c *Cluster) StripZarfLabelsAndSecretsFromNamespaces() { if _, ok := namespace.Labels[agentLabel]; ok { spinner.Updatef("Removing Zarf Agent label for namespace %s", namespace.Name) delete(namespace.Labels, agentLabel) - if _, err = c.UpdateNamespace(&namespace); err != nil { + namespaceCopy := namespace + if _, err = c.UpdateNamespace(&namespaceCopy); err != nil { // This is not a hard failure, but we should log it spinner.Errorf(err, "Unable to update the namespace labels for %s", namespace.Name) }