Skip to content

fix: omit sourceRef.namespace when empty in HelmReleaseV2#134

Merged
oncicaradupopovici merged 1 commit into
mainfrom
fix/helm-release-v2-sourceref-namespace
May 8, 2026
Merged

fix: omit sourceRef.namespace when empty in HelmReleaseV2#134
oncicaradupopovici merged 1 commit into
mainfrom
fix/helm-release-v2-sourceref-namespace

Conversation

@oncicaradupopovici
Copy link
Copy Markdown
Contributor

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.

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>
Copilot AI review requested due to automatic review settings May 8, 2026 11:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.sourceRef args and only set namespace when non-empty (using pulumi.StringPtr).
  • Add a unit test ensuring SourceRef.Namespace is 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 fraliv13 requested review from fraliv13 May 8, 2026 12:01
@oncicaradupopovici oncicaradupopovici merged commit 6776607 into main May 8, 2026
5 checks passed
@oncicaradupopovici oncicaradupopovici deleted the fix/helm-release-v2-sourceref-namespace branch May 8, 2026 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants