Skip to content

HELM-728: Persist secrets for Helm upgrade#16432

Open
sowmya-sl wants to merge 3 commits into
openshift:mainfrom
sowmya-sl:add-secrets-for-helm-upgrade
Open

HELM-728: Persist secrets for Helm upgrade#16432
sowmya-sl wants to merge 3 commits into
openshift:mainfrom
sowmya-sl:add-secrets-for-helm-upgrade

Conversation

@sowmya-sl
Copy link
Copy Markdown
Contributor

@sowmya-sl sowmya-sl commented May 12, 2026

Analysis / Root cause:
Helm releases are installed via URL charts which use authentication. This authentication is stored as a generic secret. But this is not persisted during upgrade, which leads to upgrade failing.
Solution description:

The secret for authentication is added as a metadata for the Helm release. So while upgrade, it is fetched and used for authentication.

Summary by Coderabbit

  • New Features

    • Chart installations now record a reference to stored basic-auth credentials
  • Bug Fixes

    • Improved basic-auth handling for installing and upgrading charts from URLs
    • Persisted user credentials are automatically reapplied during upgrades, avoiding manual re-entry

Summary by CodeRabbit

  • Bug Fixes

    • Fixed basic-auth handling so credentials are correctly applied for Helm chart installs and re-applied during upgrades.
    • Improved error handling/logging when credential application fails (does not abort upgrades).
  • New Features

    • Added support for OCI registry client configuration for Helm chart installs.
    • Persisted chart metadata now stores authentication secret references across upgrades.

@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 May 12, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 12, 2026

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

@openshift-ci openshift-ci Bot added component/backend Related to backend component/helm Related to helm-plugin approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/i18n Indicates issue or PR relates to internationalization or has content that needs to be translated labels May 12, 2026
@sowmya-sl sowmya-sl force-pushed the add-secrets-for-helm-upgrade branch 3 times, most recently from c2dac6d to 92da9e3 Compare May 15, 2026 14:03
@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 18, 2026
@sowmya-sl sowmya-sl force-pushed the add-secrets-for-helm-upgrade branch 2 times, most recently from e935d09 to 19338e5 Compare May 25, 2026 06:29
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 25, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 25, 2026

Walkthrough

Refactors Helm basic-auth handling: introduce RegistryClientSetter and chart annotation, change helper to set ChartPathOptions and inject an OCI registry client, update install/get to use it, and re-apply persisted auth during upgrades (logged on failure).

Changes

Helm basic-auth credential lifecycle

Layer / File(s) Summary
RegistryClientSetter interface and imports
pkg/helm/actions/install_chart.go
Adds Helm registry import, the helmAuthSecretAnnotation constant, and RegistryClientSetter interface to allow injecting an OCI registry client.
Auth helper refactor and install wiring
pkg/helm/actions/install_chart.go
Refactors applyBasicAuthFromUserCredentials to accept *action.ChartPathOptions and a RegistryClientSetter, sets ChartPathOptions auth fields, builds an OCI registry client via GetOCIRegistry, calls the setter, and adds addAuthSecretAnnotation; InstallChartFromURL is updated to call the new helper and annotate the chart with the basic-auth secret.
GetChartFromURL usage update
pkg/helm/actions/get_chart.go
Updates GetChartFromURL to call applyBasicAuthFromUserCredentials(&cmd.ChartPathOptions, cmd, userCredentials) so ChartPathOptions and the installer are used for registry client injection.
Upgrade: detect and re-apply persisted credentials
pkg/helm/actions/upgrade_release.go
UpgradeReleaseAsync reads helmAuthSecretAnnotation from the release chart, annotates the upgrade chart, fetches stored credentials via GetUserCredentials when present, and attempts to apply them with the refactored helper; failures are logged with klog and do not abort the upgrade.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant InstallChartFromURL
  participant applyBasicAuthFromUserCredentials
  participant GetOCIRegistry
  participant cmd_SetRegistryClient
  Client->>InstallChartFromURL: request install from URL
  InstallChartFromURL->>applyBasicAuthFromUserCredentials: pass &ChartPathOptions, cmd (setter), credentials
  applyBasicAuthFromUserCredentials->>GetOCIRegistry: GetOCIRegistry(auth)
  GetOCIRegistry-->>applyBasicAuthFromUserCredentials: registry.Client
  applyBasicAuthFromUserCredentials->>cmd_SetRegistryClient: SetRegistryClient(registry.Client)

  participant UpgradeReleaseAsync
  participant GetUserCredentials
  Client->>UpgradeReleaseAsync: request upgrade
  UpgradeReleaseAsync->>UpgradeReleaseAsync: read helmAuthSecretAnnotation
  UpgradeReleaseAsync->>GetUserCredentials: fetch credentials
  GetUserCredentials-->>UpgradeReleaseAsync: credentials
  UpgradeReleaseAsync->>applyBasicAuthFromUserCredentials: apply to ChartPathOptions
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • openshift/console#16360: Implements the same Helm chart URL basic-auth feature by plumbing Kubernetes basic_auth_secret_name through the helm/URL install/get/upgrade flow and applying secret-provided username/password to Helm/OCI chart retrieval.

Suggested reviewers

  • martinszuc
  • sg00dwin
🚥 Pre-merge checks | ✅ 11 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (11 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: persisting secrets for Helm upgrades, directly matching the changeset's core functionality.
Description check ✅ Passed The PR description includes Analysis/Root cause and Solution description sections as required by the template, explaining the auth secret persistence mechanism adequately.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed The custom check is for Ginkgo test name stability. This codebase uses Go's testing package + testify (not Ginkgo), and no Ginkgo tests exist or were modified in this PR.
Test Structure And Quality ✅ Passed PR contains no Ginkgo test code; all tests in pkg/helm/actions use standard Go testing with testify/require. Custom check for Ginkgo test quality is not applicable.
Microshift Test Compatibility ✅ Passed This PR adds no new Ginkgo e2e tests. It only modifies production backend code for Helm chart authentication and upgrade handling. The MicroShift test compatibility check does not apply.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No Ginkgo e2e tests are added in this PR. The PR only modifies backend Helm action code (get_chart.go, install_chart.go, upgrade_release.go). The custom check is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed PR modifies backend Helm action handlers (Go code), not deployment manifests, controllers, or operator code. No scheduling constraints are introduced.
Ote Binary Stdout Contract ✅ Passed klog calls added are only in request handlers/goroutines, not process-level code. klog writes to stderr by default, preserving JSON stdout contract.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PR contains no new Ginkgo e2e tests. Changes are backend-only to Helm auth handling, using standard Go unit tests only.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 25, 2026

[APPROVALNOTIFIER] This PR is APPROVED

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

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

The pull request process is described 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

Use a RegistryClientSetter interface so applyBasicAuthFromUserCredentials
works with both action.Install and action.Upgrade via their shared
ChartPathOptions. Persist the basic-auth secret name as a chart
annotation (helm.openshift.io/auth-secret) during install and propagate
it on upgrade so authenticated registries remain accessible across the
release lifecycle.
@sowmya-sl sowmya-sl force-pushed the add-secrets-for-helm-upgrade branch from 19338e5 to f08c6e8 Compare May 25, 2026 06:41
Copy link
Copy Markdown
Contributor

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pkg/helm/actions/upgrade_release.go (1)

225-245: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Re-add the auth-secret annotation to the upgraded chart.

When chartUrl is set, loader.Load gives you a fresh chart object. This code restores chart_url but never writes back helm.openshift.io/auth-secret, so the upgraded release drops the secret reference and the next upgrade can no longer rehydrate credentials.

Suggested fix
 	// Ensure chart URL is properly set in the upgrade chart
+	if ch.Metadata == nil {
+		ch.Metadata = &chart.Metadata{}
+	}
+	if ch.Metadata.Annotations == nil {
+		ch.Metadata.Annotations = make(map[string]string)
+	}
 	if chartUrl != "" {
-		if ch.Metadata.Annotations == nil {
-			ch.Metadata.Annotations = make(map[string]string)
-		}
 		ch.Metadata.Annotations["chart_url"] = chartUrl
 	}
+	addAuthSecretAnnotation(ch, auth_secret)
 	if auth_secret != "" {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/helm/actions/upgrade_release.go` around lines 225 - 245, The upgrade
logic restores the chart_url annotation on the freshly loaded chart (chartUrl ->
ch.Metadata.Annotations["chart_url"]) but never re-adds the persisted
auth-secret annotation, so upgraded releases lose the
"helm.openshift.io/auth-secret" reference; fix by, when auth_secret != "" and
after ensuring ch.Metadata.Annotations is non-nil, set
ch.Metadata.Annotations["helm.openshift.io/auth-secret"] = auth_secret (the same
place where you already set "chart_url" and where you call
GetUserCredentials/applyBasicAuthFromUserCredentials) so the secret reference is
preserved across upgrades.
🧹 Nitpick comments (1)
pkg/helm/actions/upgrade_release.go (1)

233-240: ⚡ Quick win

Use repo-standard klog levels here.

The "found persisted auth secret" message is debug-level, while credential lookup failures should be logged as errors instead of Infof.

Suggested fix
-		klog.Infof("Found persisted auth secret %s for release %s/%s, applying credentials for upgrade", auth_secret, releaseNamespace, releaseName)
+		klog.V(4).Infof("Found persisted auth secret for release %s/%s, applying credentials for upgrade", releaseNamespace, releaseName)
 		userCredentials, err := GetUserCredentials(coreClient, releaseNamespace, auth_secret)
 		if err != nil {
-			klog.Infof("Failed to get user credentials for release upgrade %s/%s: %v", releaseNamespace, releaseName, err)
+			klog.Errorf("Failed to get user credentials for release upgrade %s/%s: %v", releaseNamespace, releaseName, err)

As per coding guidelines, "Use klog with appropriate levels (V(4) for debug, Error, Fatal) for Go logging".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/helm/actions/upgrade_release.go` around lines 233 - 240, The log level
usage is inconsistent: change the "Found persisted auth secret ..." Infof to a
debug-level call using klog.V(4).Infof, and change the GetUserCredentials
failure log from klog.Infof to klog.Errorf so credential lookup failures are
logged as errors; keep the existing klog.Errorf for
applyBasicAuthFromUserCredentials as-is. Update the logging calls near
GetUserCredentials, auth_secret, releaseNamespace, releaseName, and
applyBasicAuthFromUserCredentials accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/helm/actions/upgrade_release.go`:
- Around line 232-245: UpgradeReleaseAsync currently calls
client.ChartPathOptions.LocateChart before applying persisted auth, so private
OCI/direct chart fetch can’t use the credentials; move the block that checks
auth_secret and calls GetUserCredentials + applyBasicAuthFromUserCredentials to
run before the call to client.ChartPathOptions.LocateChart. Keep the same error
handling/logging (klog.Infof on GetUserCredentials failure, klog.Errorf on apply
failure) and ensure you reference the same variables (auth_secret,
releaseNamespace, releaseName, client.ChartPathOptions) so LocateChart runs with
the applied credentials.

---

Outside diff comments:
In `@pkg/helm/actions/upgrade_release.go`:
- Around line 225-245: The upgrade logic restores the chart_url annotation on
the freshly loaded chart (chartUrl -> ch.Metadata.Annotations["chart_url"]) but
never re-adds the persisted auth-secret annotation, so upgraded releases lose
the "helm.openshift.io/auth-secret" reference; fix by, when auth_secret != ""
and after ensuring ch.Metadata.Annotations is non-nil, set
ch.Metadata.Annotations["helm.openshift.io/auth-secret"] = auth_secret (the same
place where you already set "chart_url" and where you call
GetUserCredentials/applyBasicAuthFromUserCredentials) so the secret reference is
preserved across upgrades.

---

Nitpick comments:
In `@pkg/helm/actions/upgrade_release.go`:
- Around line 233-240: The log level usage is inconsistent: change the "Found
persisted auth secret ..." Infof to a debug-level call using klog.V(4).Infof,
and change the GetUserCredentials failure log from klog.Infof to klog.Errorf so
credential lookup failures are logged as errors; keep the existing klog.Errorf
for applyBasicAuthFromUserCredentials as-is. Update the logging calls near
GetUserCredentials, auth_secret, releaseNamespace, releaseName, and
applyBasicAuthFromUserCredentials accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 0e4c0f55-cdf2-4023-8777-ae5444398f6a

📥 Commits

Reviewing files that changed from the base of the PR and between e466d37 and 19338e5.

📒 Files selected for processing (3)
  • pkg/helm/actions/get_chart.go
  • pkg/helm/actions/install_chart.go
  • pkg/helm/actions/upgrade_release.go

Comment thread pkg/helm/actions/upgrade_release.go Outdated
Copy link
Copy Markdown
Contributor

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pkg/helm/actions/upgrade_release.go (1)

225-245: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Re-add the auth-secret annotation to the upgraded chart.

auth_secret is read from the previous release, but the new chart metadata only writes chart_url. After this upgrade, the next revision loses helm.openshift.io/auth-secret, so a subsequent private upgrade can no longer recover the persisted credentials.

💡 Minimal fix
 	// Ensure chart URL is properly set in the upgrade chart
-	if chartUrl != "" {
-		if ch.Metadata.Annotations == nil {
-			ch.Metadata.Annotations = make(map[string]string)
-		}
+	if ch.Metadata == nil {
+		ch.Metadata = &chart.Metadata{}
+	}
+	if ch.Metadata.Annotations == nil {
+		ch.Metadata.Annotations = make(map[string]string)
+	}
+	if chartUrl != "" {
 		ch.Metadata.Annotations["chart_url"] = chartUrl
 	}
+	addAuthSecretAnnotation(ch, auth_secret)
 	if auth_secret != "" {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/helm/actions/upgrade_release.go` around lines 225 - 245, The upgraded
chart currently only writes chart_url and omits persisting auth_secret, causing
future revisions to lose helm.openshift.io/auth-secret; modify the upgrade logic
(around chartUrl, ch.Metadata.Annotations, auth_secret handling) to ensure
ch.Metadata.Annotations is initialized whenever either chartUrl or auth_secret
is non-empty and set both ch.Metadata.Annotations["chart_url"] = chartUrl (if
present) and ch.Metadata.Annotations["helm.openshift.io/auth-secret"] =
auth_secret (if present); keep the existing
GetUserCredentials/applyBasicAuthFromUserCredentials flow unchanged.
🧹 Nitpick comments (1)
pkg/helm/actions/upgrade_release.go (1)

232-240: ⚡ Quick win

Use V(4)/Errorf for these klog calls.

The “found persisted auth secret” message is debug-level noise, while the credential lookup failure is an error path. Infof for both does not match the repo’s logging rule.

💡 Suggested change
-		klog.Infof("Found persisted auth secret %s for release %s/%s, applying credentials for upgrade", auth_secret, releaseNamespace, releaseName)
+		klog.V(4).Infof("Found persisted auth secret %s for release %s/%s, applying credentials for upgrade", auth_secret, releaseNamespace, releaseName)
 		userCredentials, err := GetUserCredentials(coreClient, releaseNamespace, auth_secret)
 		if err != nil {
-			klog.Infof("Failed to get user credentials for release upgrade %s/%s: %v", releaseNamespace, releaseName, err)
+			klog.Errorf("Failed to get user credentials for release upgrade %s/%s: %v", releaseNamespace, releaseName, err)
As per coding guidelines, `Use klog with appropriate levels (V(4) for debug, Error, Fatal) for Go logging`.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/helm/actions/upgrade_release.go` around lines 232 - 240, Replace the
inappropriate Info-level logs around auth secret handling: change the "Found
persisted auth secret ..." klog.Infof to debug-level klog.V(4).Infof, and change
the credential lookup failure log inside the GetUserCredentials error branch
from klog.Infof to klog.Errorf; the functions/vars to edit are auth_secret,
GetUserCredentials, applyBasicAuthFromUserCredentials, and the klog calls shown
in the snippet so the debug message is V(4) and lookup failures are logged as
errors.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@pkg/helm/actions/upgrade_release.go`:
- Around line 225-245: The upgraded chart currently only writes chart_url and
omits persisting auth_secret, causing future revisions to lose
helm.openshift.io/auth-secret; modify the upgrade logic (around chartUrl,
ch.Metadata.Annotations, auth_secret handling) to ensure ch.Metadata.Annotations
is initialized whenever either chartUrl or auth_secret is non-empty and set both
ch.Metadata.Annotations["chart_url"] = chartUrl (if present) and
ch.Metadata.Annotations["helm.openshift.io/auth-secret"] = auth_secret (if
present); keep the existing GetUserCredentials/applyBasicAuthFromUserCredentials
flow unchanged.

---

Nitpick comments:
In `@pkg/helm/actions/upgrade_release.go`:
- Around line 232-240: Replace the inappropriate Info-level logs around auth
secret handling: change the "Found persisted auth secret ..." klog.Infof to
debug-level klog.V(4).Infof, and change the credential lookup failure log inside
the GetUserCredentials error branch from klog.Infof to klog.Errorf; the
functions/vars to edit are auth_secret, GetUserCredentials,
applyBasicAuthFromUserCredentials, and the klog calls shown in the snippet so
the debug message is V(4) and lookup failures are logged as errors.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 3467ec1d-cfbb-47ad-a798-2dc23b6c5a34

📥 Commits

Reviewing files that changed from the base of the PR and between 19338e5 and f08c6e8.

📒 Files selected for processing (3)
  • pkg/helm/actions/get_chart.go
  • pkg/helm/actions/install_chart.go
  • pkg/helm/actions/upgrade_release.go

@sowmya-sl sowmya-sl changed the title Add secrets for helm upgrade HELM-728: Persist secrets for Helm upgrade May 25, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label May 25, 2026
@sowmya-sl sowmya-sl marked this pull request as ready for review May 25, 2026 07:05
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

openshift-ci-robot commented May 25, 2026

@sowmya-sl: This pull request references HELM-728 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Analysis / Root cause:
Helm releases are installed via URL charts which use authentication. This authentication is stored as a generic secret. But this is not persisted during upgrade, which leads to upgrade failing.
Solution description:

The secret for authentication is added as a metadata for the Helm release. So while upgrade, it is fetched and used for authentication.

Summary by Coderabbit

  • New Features

  • Chart installations now record a reference to stored basic-auth credentials

  • Bug Fixes

  • Improved basic-auth handling for installing and upgrading charts from URLs

  • Persisted user credentials are automatically reapplied during upgrades, avoiding manual re-entry

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 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 May 25, 2026
@openshift-ci openshift-ci Bot requested review from baijum and martinszuc May 25, 2026 07:06
if rel.Chart.Metadata.Annotations != nil {
if chart_url, ok := rel.Chart.Metadata.Annotations["chart_url"]; chartUrl == "" && ok {
chartUrl = chart_url
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should the sync UpgradeRelease path also read helmAuthSecretAnnotation here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's being read in the UpgradeReleaseAsync function which is the one being called from the frontend. UpgradeRelease is not being called anywhere.

@@ -224,6 +229,20 @@
}
ch.Metadata.Annotations["chart_url"] = chartUrl
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should helmAuthSecretAnnotation also be written here alongside chart_url? My thinking is that on a second upgrade, the annotation would already be gone from the stored release, so the secret lookup would fail. Could be wrong though, curious what you think. I have not tested out the changes myself.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch, I have added it now.

sowmya-sl added 2 commits May 26, 2026 11:08
Ensure addAuthSecretAnnotation is called when rewriting chart metadata
so subsequent upgrades continue to resolve registry credentials.
Credentials were being set after LocateChart, which is the call that
actually contacts the registry. Move applyBasicAuthFromUserCredentials
before LocateChart so the registry client has auth headers when pulling.
@sowmya-sl
Copy link
Copy Markdown
Contributor Author

/verified by @sowmya-sl

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label May 26, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@sowmya-sl: This PR has been marked as verified by @sowmya-sl.

Details

In response to this:

/verified by @sowmya-sl

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-robot
Copy link
Copy Markdown
Contributor

openshift-ci-robot commented May 26, 2026

@sowmya-sl: This pull request references HELM-728 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Analysis / Root cause:
Helm releases are installed via URL charts which use authentication. This authentication is stored as a generic secret. But this is not persisted during upgrade, which leads to upgrade failing.
Solution description:

The secret for authentication is added as a metadata for the Helm release. So while upgrade, it is fetched and used for authentication.

Summary by Coderabbit

  • New Features

  • Chart installations now record a reference to stored basic-auth credentials

  • Bug Fixes

  • Improved basic-auth handling for installing and upgrading charts from URLs

  • Persisted user credentials are automatically reapplied during upgrades, avoiding manual re-entry

Summary by CodeRabbit

  • Bug Fixes

  • Fixed basic-auth handling so credentials are correctly applied for Helm chart installs and re-applied during upgrades.

  • Improved error handling/logging when credential application fails (does not abort upgrades).

  • New Features

  • Added support for OCI registry client configuration for Helm chart installs.

  • Persisted chart metadata now stores authentication secret references across upgrades.

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.

Copy link
Copy Markdown
Contributor

@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.

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

207-208: ⚡ Quick win

Demote this to debug and avoid logging the secret reference.

This runs on every authenticated upgrade, so emitting auth_secret at info level is noisier than needed and exposes secret metadata in normal logs.

Suggested change
-		klog.Infof("Found persisted auth secret %s for release %s/%s, applying credentials for upgrade", auth_secret, releaseNamespace, releaseName)
+		klog.V(4).Infof("Applying persisted auth credentials for release %s/%s", releaseNamespace, releaseName)

As per coding guidelines, "Use klog with appropriate levels (V(4) for debug, Error, Fatal) for logging in Go".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/helm/actions/upgrade_release.go` around lines 207 - 208, Change the
info-level log that currently prints the auth_secret variable to a debug-level
log and stop emitting the secret reference: replace the klog.Infof call that
mentions auth_secret with klog.V(4).Infof and remove the auth_secret
interpolation so it only logs context like "found persisted auth secret for
release %s/%s, applying credentials for upgrade" (refer to the klog.Infof line
and the auth_secret variable in upgrade_release.go).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@pkg/helm/actions/upgrade_release.go`:
- Around line 207-208: Change the info-level log that currently prints the
auth_secret variable to a debug-level log and stop emitting the secret
reference: replace the klog.Infof call that mentions auth_secret with
klog.V(4).Infof and remove the auth_secret interpolation so it only logs context
like "found persisted auth secret for release %s/%s, applying credentials for
upgrade" (refer to the klog.Infof line and the auth_secret variable in
upgrade_release.go).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: b0c8b733-c16f-4d36-b565-d0da5ffed64f

📥 Commits

Reviewing files that changed from the base of the PR and between e841cad and dd8f981.

📒 Files selected for processing (1)
  • pkg/helm/actions/upgrade_release.go

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 26, 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/e2e-playwright dd8f981 link false /test e2e-playwright

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.

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. component/backend Related to backend component/helm Related to helm-plugin jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. kind/i18n Indicates issue or PR relates to internationalization or has content that needs to be translated verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants