Fix: Avoid Helm Conflict When User Creates Custom .npmrc Secret - #186
Conversation
Signed-off-by: Fortune-Ndlovu <fndlovu@redhat.com>
Reviewer's GuideThis PR resolves Helm ownership conflicts by removing the unconditional .npmrc Secret template (relying on lookup for existing Secrets), updates all plugin package references to full Red Hat registry URLs (dropping scope prefixes), and bumps the chart version with corresponding README badge updates. Class diagram for Helm Secret rendering logic updateclassDiagram
class HelmChart {
+values
+templates
+render()
}
class SecretTemplate {
+name
+namespace
+stringData
+render()
}
class LookupFunction {
+lookup(resourceType, name, namespace)
}
HelmChart --> SecretTemplate : uses
HelmChart --> LookupFunction : uses
SecretTemplate <.. LookupFunction : conditional rendering
Flow diagram for conditional .npmrc Secret creation in Helmflowchart TD
A[Start Helm install/upgrade] --> B{Is orchestrator.enabled?}
B -- No --> Z[Skip .npmrc Secret]
B -- Yes --> C{Does Secret <release>-dynamic-plugins-npmrc exist?}
C -- Yes --> D[Skip rendering Secret]
C -- No --> E[Render .npmrc Secret with RH registry entry]
D --> F[Continue deployment]
E --> F
Z --> F
F[Deployment proceeds without Helm ownership conflict]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey @Fortune-Ndlovu - I've reviewed your changes and they look great!
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Signed-off-by: Fortune-Ndlovu <fndlovu@redhat.com>
|
@sourcery-ai review |
There was a problem hiding this comment.
Hey @Fortune-Ndlovu - I've reviewed your changes - here's some feedback:
- Add a
minHelmVersion: ">=3.1.0"entry to Chart.yaml since the lookup function is only available in Helm v3.1+. - Consider introducing a
values.yamlflag (e.g.dynamicPlugins.createNpmrcSecret) to allow users to explicitly enable or disable secret creation instead of relying solely on lookup. - Include a brief inline comment in the
dynamic-plugins-configmap.yamltemplate explaining why thelookupcall is used to skip secret creation when a custom secret already exists.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Add a `minHelmVersion: ">=3.1.0"` entry to Chart.yaml since the lookup function is only available in Helm v3.1+.
- Consider introducing a `values.yaml` flag (e.g. `dynamicPlugins.createNpmrcSecret`) to allow users to explicitly enable or disable secret creation instead of relying solely on lookup.
- Include a brief inline comment in the `dynamic-plugins-configmap.yaml` template explaining why the `lookup` call is used to skip secret creation when a custom secret already exists.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
…true Signed-off-by: Fortune-Ndlovu <fndlovu@redhat.com>
Signed-off-by: Fortune-Ndlovu <fndlovu@redhat.com>
Signed-off-by: Fortune-Ndlovu <fndlovu@redhat.com>
Signed-off-by: Fortune-Ndlovu <fndlovu@redhat.com>
…e direct http tarball url instead of npm registry. Signed-off-by: Fortune-Ndlovu <fndlovu@redhat.com>
Signed-off-by: Fortune-Ndlovu <fndlovu@redhat.com>
…t injects the orchestrator plugiins dynamicallly wheneerv orchestrator.enabled=true Signed-off-by: Fortune-Ndlovu <fndlovu@redhat.com>
… registry. Signed-off-by: Fortune-Ndlovu <fndlovu@redhat.com>
Signed-off-by: Fortune-Ndlovu <fndlovu@redhat.com>
|
/cherry-pick release-1.7 |
|
@rm3l: once the present PR merges, I will cherry-pick it on top of DetailsIn response to this:
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. |
Signed-off-by: Fortune-Ndlovu <fndlovu@redhat.com>
Signed-off-by: Fortune-Ndlovu <fndlovu@redhat.com>
|
|
@sourcery-ai review |
There was a problem hiding this comment.
Hey @Fortune-Ndlovu - I've reviewed your changes - here's some feedback:
- I don’t see the lookup-based conditional for the npmrc Secret in your templates—ensure you’ve added the Helm
lookuplogic to detect and skip existing Secrets rather than simply removing the block. - Consider making the Red Hat NPM registry base URL a configurable value in values.yaml instead of hardcoding full URLs in each package declaration so you can support alternate registries more easily.
- Your PR summary mentions bumping the chart version to 4.5.0 but Chart.yaml is updated to 4.4.1—please align the version number for consistency.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- I don’t see the lookup-based conditional for the npmrc Secret in your templates—ensure you’ve added the Helm `lookup` logic to detect and skip existing Secrets rather than simply removing the block.
- Consider making the Red Hat NPM registry base URL a configurable value in values.yaml instead of hardcoding full URLs in each package declaration so you can support alternate registries more easily.
- Your PR summary mentions bumping the chart version to 4.5.0 but Chart.yaml is updated to 4.4.1—please align the version number for consistency.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
faf8c34
into
redhat-developer:main
|
@rm3l: new pull request created: #190 DetailsIn response to this:
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. |



Description of the change
This PR updated to always render the .npmrc Secret when orchestrator.enabled=true, allowing users to inject custom config via .Values.global.dynamic.npmrc.userConfig. We append the RH registry entry automatically to ensure orchestrator plugins can be loaded
Previously, if a Secret named
<release_name>-dynamic-plugins-npmrcexisted in the namespace (as documented), Helm would fail due to ownership conflicts. This fix uses thelookupfunction to detect if the Secret already exists and conditionally skips rendering it, allowing the deployment to proceed without errors while still supporting user-provided configuration.Which issue(s) does this PR fix or relate to
https://issues.redhat.com/browse/RHDHBUGS-1464
How to test changes / Special notes to the reviewer
I have tested the bug and my solution in the comments, see https://issues.redhat.com/browse/RHDHBUGS-1464
Checklist
Chart.yamlaccording to Semantic Versioning.values.yamland added to the corresponding README.md. The pre-commit utility can be used to generate the necessary content. Usepre-commit run -ato apply changes. The pre-commit Workflow will do this automatically for you if needed.pre-commithook.ct lintcommand.Summary by Sourcery
Conditionally skip rendering the dynamic-plugins-npmrc Secret if it already exists to prevent Helm install failures due to ownership conflicts.
Bug Fixes:
<release_name>-dynamic-plugins-npmrcSecret when one is already present to avoid installation errors.Enhancements:
lookupHelm function to detect existing Secrets before rendering.Summary by Sourcery
Prevent Helm ownership conflicts by using the lookup function to skip creating the dynamic-plugins-npmrc Secret when one exists, and bump chart version to 4.5.0.
Bug Fixes:
Enhancements:
Documentation:
Chores:
Summary by Sourcery
Use Helm lookup to conditionally render the dynamic-plugins-npmrc Secret and avoid ownership conflicts with user-provided .npmrc secrets; update orchestrator plugin package references to fully qualified npm registry URLs; bump the Backstage chart to version 4.4.1.
Bug Fixes:
Enhancements:
Build:
Documentation: