fix: omit sourceRef.namespace when empty in HelmReleaseV2#134
Merged
Conversation
When spec.chart.spec.sourceRef.namespace is not set, passing pulumi.String(`) caused the Kubernetes API to reject the HelmRelease with: spec.chart.spec.sourceRef.namespace in body should be at least 1 chars long. Only set Namespace when non-empty using pulumi.StringPtr, consistent with ChartRef.Namespace handling. Added a regression test. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes HelmReleaseV2 generation to avoid sending an empty spec.chart.spec.sourceRef.namespace to the Kubernetes API (which violates the CRD’s minLength validation), by omitting the field when the namespace is not set. This aligns SourceRef.Namespace handling with the existing ChartRef.Namespace pattern in the Pulumi args builder and adds a regression test.
Changes:
- Build
spec.chart.spec.sourceRefargs and only setnamespacewhen non-empty (usingpulumi.StringPtr). - Add a unit test ensuring
SourceRef.Namespaceis omitted (nil) when the input namespace is empty.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| internal/controllers/provisioning/provisioners/pulumi/helm_release_v2.go | Conditionally omits sourceRef.namespace to prevent invalid empty-string serialization. |
| internal/controllers/provisioning/provisioners/pulumi/helm_release_v2_test.go | Adds regression test asserting SourceRef.Namespace is nil when input namespace is empty. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fraliv13
approved these changes
May 8, 2026
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.
When spec.chart.spec.sourceRef.namespace is not set, passing pulumi.String(`) caused the Kubernetes API to reject the HelmRelease with: spec.chart.spec.sourceRef.namespace in body should be at least 1 chars long. Only set Namespace when non-empty using pulumi.StringPtr, consistent with ChartRef.Namespace handling. Added a regression test.