Repository: helm/helm
Pull request #30580 (2025-02-24 20:02:05)

Move pkg/releaseutil to pkg/release/util
The releaseutil package was originally designed to work against a generated codebase from a protobuf in Helm v2. This is when Helm used gRPC to communicate to a server side component named Tiller. When Helm moved everything client side, this package remained and it supported the release package.

This change moves releaseutil to be a sub-packge of release. This is part of the change to support apiVersion v3 charts which is documented in HIP 20

<!--  Thanks for sending a pull request!  Here are some tips for you:
1. Make sure to read the Contributing Guide before submitting your PR: https://github.com/helm/helm/blob/main/CONTRIBUTING.md
2. If this PR closes another issue, add 'closes #<issue number>' somewhere in the PR summary. GitHub will automatically close that issue when this PR gets merged. Alternatively, adding 'refs #<issue number>' will not close the issue, but help provide the reviewer more context.-->

**What this PR does / why we need it**:

**Special notes for your reviewer**:

**If applicable**:
- [ ] this PR contains user facing changes (the `docs needed` label should be applied if so)
- [ ] this PR contains unit tests
- [ ] this PR has been tested for backwards compatibility



Patch:
diff --git a/cmd/helm/history.go b/cmd/helm/history.go
index 91d005e7a..2c929c161 100644
--- a/cmd/helm/history.go
+++ b/cmd/helm/history.go
@@ -30,7 +30,7 @@ import (
 	"helm.sh/helm/v4/pkg/chart"
 	"helm.sh/helm/v4/pkg/cli/output"
 	"helm.sh/helm/v4/pkg/release"
-	"helm.sh/helm/v4/pkg/releaseutil"
+	releaseutil "helm.sh/helm/v4/pkg/release/util"
 	helmtime "helm.sh/helm/v4/pkg/time"
 )
 
diff --git a/cmd/helm/template.go b/cmd/helm/template.go
index 1a6265eba..212664dc8 100644
--- a/cmd/helm/template.go
+++ b/cmd/helm/template.go
@@ -36,7 +36,7 @@ import (
 	"helm.sh/helm/v4/pkg/action"
 	chartutil "helm.sh/helm/v4/pkg/chart/util"
 	"helm.sh/helm/v4/pkg/cli/values"
-	"helm.sh/helm/v4/pkg/releaseutil"
+	releaseutil "helm.sh/helm/v4/pkg/release/util"
 )
 
 const templateDesc = `
diff --git a/pkg/action/action.go b/pkg/action/action.go
index 6efc6c2ee..eeaebc15f 100644
--- a/pkg/action/action.go
+++ b/pkg/action/action.go
@@ -40,7 +40,7 @@ import (
 	"helm.sh/helm/v4/pkg/postrender"
 	"helm.sh/helm/v4/pkg/registry"
 	"helm.sh/helm/v4/pkg/release"
-	"helm.sh/helm/v4/pkg/releaseutil"
+	releaseutil "helm.sh/helm/v4/pkg/release/util"
 	"helm.sh/helm/v4/pkg/storage"
 	"helm.sh/helm/v4/pkg/storage/driver"
 	"helm.sh/helm/v4/pkg/time"
diff --git a/pkg/action/install.go b/pkg/action/install.go
index 6ad77a509..68c1848f6 100644
--- a/pkg/action/install.go
+++ b/pkg/action/install.go
@@ -49,7 +49,7 @@ import (
 	"helm.sh/helm/v4/pkg/postrender"
 	"helm.sh/helm/v4/pkg/registry"
 	"helm.sh/helm/v4/pkg/release"
-	"helm.sh/helm/v4/pkg/releaseutil"
+	releaseutil "helm.sh/helm/v4/pkg/release/util"
 	"helm.sh/helm/v4/pkg/repo"
 	"helm.sh/helm/v4/pkg/storage"
 	"helm.sh/helm/v4/pkg/storage/driver"
diff --git a/pkg/action/list.go b/pkg/action/list.go
index f90c31acd..5c2b1e8a1 100644
--- a/pkg/action/list.go
+++ b/pkg/action/list.go
@@ -23,7 +23,7 @@ import (
 	"k8s.io/apimachinery/pkg/labels"
 
 	"helm.sh/helm/v4/pkg/release"
-	"helm.sh/helm/v4/pkg/releaseutil"
+	releaseutil "helm.sh/helm/v4/pkg/release/util"
 )
 
 // ListStates represents zero or more status codes that a list item may have set
diff --git a/pkg/action/resource_policy.go b/pkg/action/resource_policy.go
index f18acb880..b72e94124 100644
--- a/pkg/action/resource_policy.go
+++ b/pkg/action/resource_policy.go
@@ -20,7 +20,7 @@ import (
 	"strings"
 
 	"helm.sh/helm/v4/pkg/kube"
-	"helm.sh/helm/v4/pkg/releaseutil"
+	releaseutil "helm.sh/helm/v4/pkg/release/util"
 )
 
 func filterManifestsToKeep(manifests []releaseutil.Manifest) (keep, remaining []releaseutil.Manifest) {
diff --git a/pkg/action/uninstall.go b/pkg/action/uninstall.go
index b786c37f7..6e71197f6 100644
--- a/pkg/action/uninstall.go
+++ b/pkg/action/uninstall.go
@@ -27,7 +27,7 @@ import (
 	chartutil "helm.sh/helm/v4/pkg/chart/util"
 	"helm.sh/helm/v4/pkg/kube"
 	"helm.sh/helm/v4/pkg/release"
-	"helm.sh/helm/v4/pkg/releaseutil"
+	releaseutil "helm.sh/helm/v4/pkg/release/util"
 	helmtime "helm.sh/helm/v4/pkg/time"
 )
 
diff --git a/pkg/action/upgrade.go b/pkg/action/upgrade.go
index c5397c984..fa799ad2b 100644
--- a/pkg/action/upgrade.go
+++ b/pkg/action/upgrade.go
@@ -34,7 +34,7 @@ import (
 	"helm.sh/helm/v4/pkg/postrender"
 	"helm.sh/helm/v4/pkg/registry"
 	"helm.sh/helm/v4/pkg/release"
-	"helm.sh/helm/v4/pkg/releaseutil"
+	releaseutil "helm.sh/helm/v4/pkg/release/util"
 	"helm.sh/helm/v4/pkg/storage/driver"
 )
 
diff --git a/pkg/releaseutil/filter.go b/pkg/release/util/filter.go
similarity index 96%
rename from pkg/releaseutil/filter.go
rename to pkg/release/util/filter.go
index d600d43e8..e56752f86 100644
--- a/pkg/releaseutil/filter.go
+++ b/pkg/release/util/filter.go
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
 limitations under the License.
 */
 
-package releaseutil // import "helm.sh/helm/v4/pkg/releaseutil"
+package util // import "helm.sh/helm/v4/pkg/release/util"
 
 import rspb "helm.sh/helm/v4/pkg/release"
 
diff --git a/pkg/releaseutil/kind_sorter.go b/pkg/release/util/kind_sorter.go
similarity index 99%
rename from pkg/releaseutil/kind_sorter.go
rename to pkg/release/util/kind_sorter.go
index ec51d50d8..130b2c831 100644
--- a/pkg/releaseutil/kind_sorter.go
+++ b/pkg/release/util/kind_sorter.go
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
 limitations under the License.
 */
 
-package releaseutil
+package util
 
 import (
 	"sort"
diff --git a/pkg/releaseutil/manifest.go b/pkg/release/util/manifest.go
similarity index 99%
rename from pkg/releaseutil/manifest.go
rename to pkg/release/util/manifest.go
index 0b04a4599..9a87949f8 100644
--- a/pkg/releaseutil/manifest.go
+++ b/pkg/release/util/manifest.go
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
 limitations under the License.
 */
 
-package releaseutil
+package util
 
 import (
 	"fmt"
diff --git a/pkg/releaseutil/manifest_sorter.go b/pkg/release/util/manifest_sorter.go
similarity index 99%
rename from pkg/releaseutil/manifest_sorter.go
rename to pkg/release/util/manifest_sorter.go
index 2d9a14bf1..a598743a6 100644
--- a/pkg/releaseutil/manifest_sorter.go
+++ b/pkg/release/util/manifest_sorter.go
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
 limitations under the License.
 */
 
-package releaseutil
+package util
 
 import (
 	"log"
diff --git a/pkg/releaseutil/sorter.go b/pkg/release/util/sorter.go
similarity index 97%
rename from pkg/releaseutil/sorter.go
rename to pkg/release/util/sorter.go
index a2135d68f..8b1c89aa3 100644
--- a/pkg/releaseutil/sorter.go
+++ b/pkg/release/util/sorter.go
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
 limitations under the License.
 */
 
-package releaseutil // import "helm.sh/helm/v4/pkg/releaseutil"
+package util // import "helm.sh/helm/v4/pkg/release/util"
 
 import (
 	"sort"
diff --git a/pkg/storage/storage.go b/pkg/storage/storage.go
index af339b85e..6a77cbae6 100644
--- a/pkg/storage/storage.go
+++ b/pkg/storage/storage.go
@@ -23,7 +23,7 @@ import (
 	"github.com/pkg/errors"
 
 	rspb "helm.sh/helm/v4/pkg/release"
-	relutil "helm.sh/helm/v4/pkg/releaseutil"
+	relutil "helm.sh/helm/v4/pkg/release/util"
 	"helm.sh/helm/v4/pkg/storage/driver"
 )
 


Test patch:
diff --git a/pkg/releaseutil/filter_test.go b/pkg/release/util/filter_test.go
similarity index 96%
rename from pkg/releaseutil/filter_test.go
rename to pkg/release/util/filter_test.go
index 9fc5ce9b1..2037ef157 100644
--- a/pkg/releaseutil/filter_test.go
+++ b/pkg/release/util/filter_test.go
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
 limitations under the License.
 */
 
-package releaseutil // import "helm.sh/helm/v4/pkg/releaseutil"
+package util // import "helm.sh/helm/v4/pkg/release/util"
 
 import (
 	"testing"
diff --git a/pkg/releaseutil/kind_sorter_test.go b/pkg/release/util/kind_sorter_test.go
similarity index 99%
rename from pkg/releaseutil/kind_sorter_test.go
rename to pkg/release/util/kind_sorter_test.go
index f7745d64d..cd40fe459 100644
--- a/pkg/releaseutil/kind_sorter_test.go
+++ b/pkg/release/util/kind_sorter_test.go
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
 limitations under the License.
 */
 
-package releaseutil
+package util
 
 import (
 	"bytes"
diff --git a/pkg/releaseutil/manifest_sorter_test.go b/pkg/release/util/manifest_sorter_test.go
similarity index 99%
rename from pkg/releaseutil/manifest_sorter_test.go
rename to pkg/release/util/manifest_sorter_test.go
index 3bd196c12..281f24924 100644
--- a/pkg/releaseutil/manifest_sorter_test.go
+++ b/pkg/release/util/manifest_sorter_test.go
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
 limitations under the License.
 */
 
-package releaseutil
+package util
 
 import (
 	"reflect"
diff --git a/pkg/releaseutil/manifest_test.go b/pkg/release/util/manifest_test.go
similarity index 95%
rename from pkg/releaseutil/manifest_test.go
rename to pkg/release/util/manifest_test.go
index 8e05b76dc..cfc19563d 100644
--- a/pkg/releaseutil/manifest_test.go
+++ b/pkg/release/util/manifest_test.go
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
 limitations under the License.
 */
 
-package releaseutil // import "helm.sh/helm/v4/pkg/releaseutil"
+package util // import "helm.sh/helm/v4/pkg/release/util"
 
 import (
 	"reflect"
diff --git a/pkg/releaseutil/sorter_test.go b/pkg/release/util/sorter_test.go
similarity index 97%
rename from pkg/releaseutil/sorter_test.go
rename to pkg/release/util/sorter_test.go
index bef261ee8..6e92eef5c 100644
--- a/pkg/releaseutil/sorter_test.go
+++ b/pkg/release/util/sorter_test.go
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
 limitations under the License.
 */
 
-package releaseutil // import "helm.sh/helm/v4/pkg/releaseutil"
+package util // import "helm.sh/helm/v4/pkg/release/util"
 
 import (
 	"testing"