Skip to content

Conversation

@sowmya-sl
Copy link
Contributor

@sowmya-sl sowmya-sl commented Dec 10, 2025

OCI-based Helm charts were failing to install because the action configuration lacked a registry client. This change:

  • Add GetDefaultOCIRegistry() to create and attach a registry client to the Helm action configuration
  • Integrate registry client initialization into all Helm handlers: install, upgrade, uninstall, rollback, and chart get operations
  • Add unit tests for the new registry client function

Without a registry client, operations on OCI charts (oci://) would fail with errors about missing registry support.

Fixes: HELM-611

Steps to test:

  1. Create a helmrepository object in the cluster. The helmrepository object can be either cluster or namespaced, it does not matter.
  2. Add repo link as https://charts.bitnami.com/bitnami . Bitnami has many OCI helm charts.
  3. Once added, go to Releases and create a Helm release.
  4. Sort by the newly added bitnami repository. Select nginx as the chart.
  5. Click on create. Wait for the release to create and verify when created.

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 10, 2025
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 10, 2025

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@coderabbitai
Copy link

coderabbitai bot commented Dec 10, 2025

Important

Review skipped

Auto reviews are limited based on label configuration.

🚫 Review skipped — only excluded labels are configured. (1)
  • do-not-merge/work-in-progress

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Adds GetDefaultOCIRegistry to initialize and attach an OCI registry client to a Helm action.Configuration, plus unit tests. Wires this function into the helmHandlers as a pluggable proxy and invokes it at the start of multiple HTTP handlers to ensure the registry client is available before REST client setup, returning 502 on failure.

Changes

Cohort / File(s) Summary
OCI registry action
pkg/helm/actions/get_registry.go
New function GetDefaultOCIRegistry(conf *action.Configuration) error — validates non-nil config, creates a Helm registry client with debug disabled, assigns it to conf.RegistryClient, and returns wrapped errors on failure.
OCI registry tests
pkg/helm/actions/get_registry_test.go
New unit tests: successful initialization with mocked configuration, nil-config error case, and minimal-config success case.
Handler integration
pkg/helm/handlers/handlers.go
Adds getDefaultOCIRegistry func(*action.Configuration) error to helmHandlers, sets it to actions.GetDefaultOCIRegistry in New, and invokes it early in multiple handlers (HandleHelmInstall, HandleHelmInstallAsync, HandleChartGet, HandleUpgradeRelease, HandleUpgradeReleaseAsync, HandleRollbackRelease, HandleGetReleaseHistory, HandleIndexFile) with standardized 502 error handling on failure.
Test wiring
pkg/helm/handlers/handler_test.go
Adds fakeGetDefaultOCIRegistry(conf *action.Configuration) error and wires it into fakeHelmHandler for test isolation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes


Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci bot added component/backend Related to backend approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Dec 10, 2025
@sowmya-sl
Copy link
Contributor Author

/test-all

@baijum
Copy link
Contributor

baijum commented Dec 10, 2025

/ok-to-test

@openshift-ci openshift-ci bot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Dec 10, 2025
@sowmya-sl
Copy link
Contributor Author

/retest

6 similar comments
@sowmya-sl
Copy link
Contributor Author

/retest

@martinszuc
Copy link
Contributor

/retest

@martinszuc
Copy link
Contributor

/retest

@sowmya-sl
Copy link
Contributor Author

/retest

@sowmya-sl
Copy link
Contributor Author

/retest

@sowmya-sl
Copy link
Contributor Author

/retest

@sowmya-sl sowmya-sl marked this pull request as ready for review December 17, 2025 06:01
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 17, 2025
@openshift-ci openshift-ci bot requested review from baijum and webbnh December 17, 2025 06:01
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
pkg/helm/actions/get_registry.go (1)

10-20: Consider checking for existing RegistryClient before overwriting.

The function unconditionally assigns a new registry client to conf.RegistryClient without checking if one already exists. While this is likely the intended behavior, a defensive check could prevent accidentally overwriting a previously configured client.

If desired, apply this diff to add a defensive check:

 func GetDefaultOCIRegistry(conf *action.Configuration) error {
 	if conf == nil {
 		return fmt.Errorf("action configuration cannot be nil")
 	}
+	if conf.RegistryClient != nil {
+		return nil
+	}
 	registryclient, err := registry.NewClient(registry.ClientOptDebug(false))
 	if err != nil {
 		return fmt.Errorf("failed to create registry client: %w", err)
 	}
 	conf.RegistryClient = registryclient
 	return nil
 }
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between d93076f and 4100050.

📒 Files selected for processing (4)
  • pkg/helm/actions/get_registry.go (1 hunks)
  • pkg/helm/actions/get_registry_test.go (1 hunks)
  • pkg/helm/handlers/handler_test.go (2 hunks)
  • pkg/helm/handlers/handlers.go (8 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • pkg/helm/actions/get_registry.go
  • pkg/helm/handlers/handlers.go
  • pkg/helm/handlers/handler_test.go
  • pkg/helm/actions/get_registry_test.go
🧬 Code graph analysis (2)
pkg/helm/handlers/handlers.go (2)
pkg/helm/actions/get_registry.go (1)
  • GetDefaultOCIRegistry (10-20)
pkg/serverutils/utils.go (2)
  • SendResponse (13-28)
  • ApiError (87-89)
pkg/helm/actions/get_registry_test.go (2)
pkg/helm/handlers/handler_test.go (1)
  • FakeConfig (191-193)
pkg/helm/actions/get_registry.go (1)
  • GetDefaultOCIRegistry (10-20)
🔇 Additional comments (12)
pkg/helm/handlers/handler_test.go (2)

63-68: LGTM!

The wiring of getDefaultOCIRegistry in the test helper follows the established pattern for other handler functions and correctly uses the fake implementation.


205-207: LGTM!

The fake implementation correctly returns nil, allowing tests to proceed without actual registry initialization.

pkg/helm/actions/get_registry_test.go (2)

41-45: LGTM!

The test correctly verifies that passing a nil configuration returns an appropriate error message.


47-52: LGTM!

The test appropriately validates that GetDefaultOCIRegistry works with a minimal configuration containing only the required fields.

pkg/helm/handlers/handlers.go (8)

25-52: LGTM!

The initialization of getDefaultOCIRegistry to actions.GetDefaultOCIRegistry in the New function follows the established pattern for wiring action functions and correctly integrates the new OCI registry support.


54-77: LGTM!

The addition of the getDefaultOCIRegistry field to the helmHandlers struct with the correct signature enables dependency injection for testing and follows the established pattern.


122-161: LGTM!

The integration of getDefaultOCIRegistry in HandleHelmInstall is correctly placed after configuration creation and before REST config initialization. The error handling with 502 status code is appropriate for registry client initialization failures.


163-199: LGTM!

The integration of getDefaultOCIRegistry in HandleHelmInstallAsync follows the same correct pattern as HandleHelmInstall, ensuring consistent registry client initialization across async operations.


248-285: LGTM!

The integration of getDefaultOCIRegistry in HandleChartGet correctly ensures OCI registry support for chart retrieval operations, with appropriate error handling.


287-326: LGTM!

The integration of getDefaultOCIRegistry in HandleUpgradeRelease ensures OCI chart support for upgrade operations, with consistent error handling.


328-364: LGTM!

The integration of getDefaultOCIRegistry in HandleUpgradeReleaseAsync maintains consistency with the synchronous upgrade handler and ensures OCI support for async operations.


386-414: LGTM!

The integration of getDefaultOCIRegistry in HandleRollbackRelease ensures OCI support for rollback operations, maintaining consistency with other mutating handlers.

@sowmya-sl
Copy link
Contributor Author

/retest

@webbnh
Copy link

webbnh commented Jan 5, 2026

(Don't mind me...I'm just learning Prow....)

/kind bug
/label jira/valid-bug
/label jira/valid-reference

@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label Jan 5, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 5, 2026

@webbnh: Can not set label jira/valid-bug: Must be member in one of these teams: [openshift-patch-managers openshift-staff-engineers openshift-release-oversight openshift-sustaining-engineers]

Details

In response to this:

(Don't mind me...I'm just learning Prow....)

/kind bug
/label jira/valid-bug
/label jira/valid-reference

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 5, 2026

@webbnh: The label(s) /label jira/valid-reference cannot be applied. These labels are supported: acknowledge-critical-fixes-only, platform/aws, platform/azure, platform/baremetal, platform/google, platform/libvirt, platform/openstack, ga, tide/merge-method-merge, tide/merge-method-rebase, tide/merge-method-squash, px-approved, docs-approved, qe-approved, ux-approved, no-qe, downstream-change-needed, rebase/manual, cluster-config-api-changed, run-integration-tests, approved, backport-risk-assessed, bugzilla/valid-bug, cherry-pick-approved, jira/valid-bug, ok-to-test, plugin-api-approved, plugin-api-changed, stability-fix-approved, staff-eng-approved. Is this label configured under labels -> additional_labels or labels -> restricted_labels in plugin.yaml?

Details

In response to this:

(Don't mind me...I'm just learning Prow....)

/kind bug
/label jira/valid-bug
/label jira/valid-reference

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link

@webbnh webbnh left a comment

Choose a reason for hiding this comment

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

Looks good to me, although I didn't dive all the way into the effects of this change on the upstream code. I have a couple of small comments for your consideration.

I'm looking forward to seeing what this change looks like after the refactoring! 🙂

Comment on lines 47 to 52
func TestGetDefaultOCIRegistry_MinimumConfig(t *testing.T) {
conf := &action.Configuration{}
err := GetDefaultOCIRegistry(conf)
require.NoError(t, err)
require.NotNil(t, conf.RegistryClient, "Registry Client should not be nil")
}
Copy link

Choose a reason for hiding this comment

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

This test looks redundant -- it duplicates lines 30-32 -- the only difference is that it exercises the call with a zero-value action.Configuration instead of the more fully-initialized one instantiated at line 17. Is there any reason not to omit this test?

On the other hand, we don't seem to have a test which exercises the path resulting from an error returned by registry.NewClient(). (I assume that that would require a mock, and I'm not up on how to do that in Go, so I'm not sure what to suggest, here.)

if conf == nil {
return fmt.Errorf("action configuration cannot be nil")
}
registryclient, err := registry.NewClient(registry.ClientOptDebug(false))
Copy link

Choose a reason for hiding this comment

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

I think that, under Go's naming conventions, this should be registryClient (with a capital C, as in "camelCase").

@webbnh
Copy link

webbnh commented Jan 7, 2026

/jira refresh

@openshift-ci-robot
Copy link
Contributor

@webbnh: No Jira issue is referenced in the title of this pull request.
To reference a jira issue, add 'XYZ-NNN:' to the title of this pull request and request another refresh with /jira refresh.

Details

In response to this:

/jira refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 9, 2026

@sowmya-sl: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/backend e80e3fb link true /test backend

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@webbnh
Copy link

webbnh commented Jan 9, 2026

@sowmya-sl, this PR should probably be changed to a draft, since the intention is to base it on #15897 (and, apparently, #15863), right?

Also, the test run here shows a problem in #15863:

./testdata/chartmuseum-stop.sh: line 3: /usr/bin/pkill: No such file or directory

It seems that you need to install pkill into the test environment if you want to use it. 🙃

/remove-approve

@sowmya-sl sowmya-sl marked this pull request as draft January 10, 2026 04:47
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 10, 2026
@openshift-merge-robot
Copy link
Contributor

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 16, 2026
@openshift-ci openshift-ci bot added component/core Related to console core functionality component/dashboard Related to dashboard component/dev-console Related to dev-console component/git-service Related to git-service component/helm Related to helm-plugin component/insights Related to insights plugin component/knative Related to knative-plugin component/metal3 Related to metal3-plugin component/monitoring Related to monitoring component/olm Related to OLM component/sdk Related to console-plugin-sdk component/shared Related to console-shared component/topology Related to topology kind/cypress Related to Cypress e2e integration testing kind/i18n Indicates issue or PR relates to internationalization or has content that needs to be translated plugin-api-changed Categorizes a PR as containing plugin API changes and removed approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jan 16, 2026
@sowmya-sl sowmya-sl closed this Jan 16, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 16, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sowmya-sl

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/backend Related to backend component/core Related to console core functionality component/dashboard Related to dashboard component/dev-console Related to dev-console component/git-service Related to git-service component/helm Related to helm-plugin component/insights Related to insights plugin component/knative Related to knative-plugin component/metal3 Related to metal3-plugin component/monitoring Related to monitoring component/olm Related to OLM component/sdk Related to console-plugin-sdk component/shared Related to console-shared component/topology Related to topology do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. docs-approved Signifies that Docs has signed off on this PR jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. kind/bug Categorizes issue or PR as related to a bug. kind/cypress Related to Cypress e2e integration testing kind/i18n Indicates issue or PR relates to internationalization or has content that needs to be translated needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. plugin-api-changed Categorizes a PR as containing plugin API changes px-approved Signifies that Product Support has signed off on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants