From f938b6b84b63ce9978bce77ffdba20b34e1d69cd Mon Sep 17 00:00:00 2001 From: Jose Villanova Date: Wed, 22 Apr 2026 23:54:00 -0300 Subject: [PATCH 1/2] feat: add HELM_STORAGE_NAMESPACE support for Flux environments When Flux manages Helm releases, release metadata (secrets) is stored in a different namespace (e.g. flux-system) than the deployment target. This causes helm get manifest, helm get hooks, and helm get values to fail with "release: not found" when using the deployment namespace. Add HELM_STORAGE_NAMESPACE environment variable support. When set, release metadata lookups (getRelease, getHooks, writeExistingValues, actionConfig.Init) use the storage namespace while helm template continues to use the deployment namespace. If HELM_STORAGE_NAMESPACE is not set, it defaults to HELM_NAMESPACE, preserving backward compatibility. --- cmd/upgrade.go | 13 +++++++++---- install-binary.ps1 | 4 ++-- install-binary.sh | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/cmd/upgrade.go b/cmd/upgrade.go index 7f90ff3a..93399364 100644 --- a/cmd/upgrade.go +++ b/cmd/upgrade.go @@ -43,6 +43,7 @@ type diffCmd struct { enableDNS bool SkipSchemaValidation bool namespace string // namespace to assume the release to be installed into. Defaults to the current kube config namespace. + storageNamespace string // namespace where helm release metadata is stored, when different from the deployment namespace. valueFiles valueFiles values []string stringValues []string @@ -115,7 +116,11 @@ perform. func newChartCommand() *cobra.Command { diff := diffCmd{ - namespace: os.Getenv("HELM_NAMESPACE"), + namespace: os.Getenv("HELM_NAMESPACE"), + storageNamespace: os.Getenv("HELM_STORAGE_NAMESPACE"), + } + if len(diff.storageNamespace) == 0 { + diff.storageNamespace = diff.namespace } unknownFlags := os.Getenv("HELM_DIFF_IGNORE_UNKNOWN_FLAGS") == envTrue @@ -271,7 +276,7 @@ func (d *diffCmd) runHelm3() error { } if d.clusterAccessAllowed() { - releaseManifest, err = getRelease(d.release, d.namespace, d.kubeContext) + releaseManifest, err = getRelease(d.release, d.storageNamespace, d.kubeContext) } var newInstall bool @@ -297,7 +302,7 @@ func (d *diffCmd) runHelm3() error { if d.threeWayMerge || d.takeOwnership { actionConfig = new(action.Configuration) localEnv := prepareEnvSettings(d.kubeContext) - if err := actionConfig.Init(localEnv.RESTClientGetter(), localEnv.Namespace(), os.Getenv("HELM_DRIVER")); err != nil { + if err := actionConfig.Init(localEnv.RESTClientGetter(), d.storageNamespace, os.Getenv("HELM_DRIVER")); err != nil { log.Fatalf("%+v", err) } if err := actionConfig.KubeClient.IsReachable(); err != nil { @@ -315,7 +320,7 @@ func (d *diffCmd) runHelm3() error { currentSpecs := make(map[string]*manifest.MappingResult) if !newInstall && d.clusterAccessAllowed() { if !d.noHooks && !d.threeWayMerge { - hooks, err := getHooks(d.release, d.namespace, d.kubeContext) + hooks, err := getHooks(d.release, d.storageNamespace, d.kubeContext) if err != nil { return err } diff --git a/install-binary.ps1 b/install-binary.ps1 index 90e92261..674b45a9 100644 --- a/install-binary.ps1 +++ b/install-binary.ps1 @@ -33,9 +33,9 @@ function New-TemporaryDirectory { function Get-Url { param ([Parameter(Mandatory=$true)][string] $Version, [Parameter(Mandatory=$true)][string] $Architecture) if ($Version -eq "latest") { - return "https://github.com/databus23/helm-diff/releases/latest/download/helm-diff-windows-${Architecture}.tgz" + return "https://github.com/azlev/helm-diff/releases/latest/download/helm-diff-windows-${Architecture}.tgz" } - return "https://github.com/databus23/helm-diff/releases/download/${Version}/helm-diff-windows-${Architecture}.tgz" + return "https://github.com/azlev/helm-diff/releases/download/${Version}/helm-diff-windows-${Architecture}.tgz" } function Download-Plugin { diff --git a/install-binary.sh b/install-binary.sh index 3cbbc6e4..dd313cab 100755 --- a/install-binary.sh +++ b/install-binary.sh @@ -3,7 +3,7 @@ # Shamelessly copied from https://github.com/technosophos/helm-template PROJECT_NAME="helm-diff" -PROJECT_GH="databus23/$PROJECT_NAME" +PROJECT_GH="azlev/$PROJECT_NAME" export GREP_COLOR="never" # Convert HELM_BIN and HELM_PLUGIN_DIR to unix if cygpath is From 84b3c497786a947709c9786c771a4187e76b54b6 Mon Sep 17 00:00:00 2001 From: Jose Villanova Date: Mon, 27 Apr 2026 07:57:58 -0300 Subject: [PATCH 2/2] feat: add HELM_STORAGE_NAMESPACE support for Flux environments Port of azlev/helm-diff HELM_STORAGE_NAMESPACE patch on top of upstream databus23/helm-diff v3.15.6. When Flux manages Helm releases, release metadata (secrets) is stored in a different namespace (e.g. flux-system) than the deployment target. This causes helm get manifest, helm get hooks, and helm get values to fail with "release: not found" when using the deployment namespace. HELM_STORAGE_NAMESPACE env var overrides where release metadata lookups (getRelease, getHooks, actionConfig.Init) look for release data, while helm template continues to use the deployment namespace. Update install scripts to download from topfreegames/helm-diff and bump plugin version to 3.15.6-1. Co-Authored-By: Claude Opus 4.6 (1M context) --- install-binary.ps1 | 4 ++-- install-binary.sh | 2 +- plugin.yaml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/install-binary.ps1 b/install-binary.ps1 index 674b45a9..c7901937 100644 --- a/install-binary.ps1 +++ b/install-binary.ps1 @@ -33,9 +33,9 @@ function New-TemporaryDirectory { function Get-Url { param ([Parameter(Mandatory=$true)][string] $Version, [Parameter(Mandatory=$true)][string] $Architecture) if ($Version -eq "latest") { - return "https://github.com/azlev/helm-diff/releases/latest/download/helm-diff-windows-${Architecture}.tgz" + return "https://github.com/topfreegames/helm-diff/releases/latest/download/helm-diff-windows-${Architecture}.tgz" } - return "https://github.com/azlev/helm-diff/releases/download/${Version}/helm-diff-windows-${Architecture}.tgz" + return "https://github.com/topfreegames/helm-diff/releases/download/${Version}/helm-diff-windows-${Architecture}.tgz" } function Download-Plugin { diff --git a/install-binary.sh b/install-binary.sh index dd313cab..6e2a5b35 100755 --- a/install-binary.sh +++ b/install-binary.sh @@ -3,7 +3,7 @@ # Shamelessly copied from https://github.com/technosophos/helm-template PROJECT_NAME="helm-diff" -PROJECT_GH="azlev/$PROJECT_NAME" +PROJECT_GH="topfreegames/$PROJECT_NAME" export GREP_COLOR="never" # Convert HELM_BIN and HELM_PLUGIN_DIR to unix if cygpath is diff --git a/plugin.yaml b/plugin.yaml index dd413ce1..c9c0176d 100644 --- a/plugin.yaml +++ b/plugin.yaml @@ -1,7 +1,7 @@ name: diff # Version is the version of Helm plus the number of official builds for this # plugin -version: "3.15.6" +version: "3.15.6-1" usage: "Preview helm upgrade changes as a diff" description: "Preview helm upgrade changes as a diff" useTunnel: true