Use .Release.Namespace instead of a separate values.yaml namespace field - #86
Conversation
Both charts had their own values.yaml `namespace` key, independently threaded through every template's `metadata.namespace`, completely disconnected from the `-n`/`--namespace` flag passed to `helm install`/`upgrade`. install.sh always kept these in sync by construction (same $NS var for `kubectl create ns` and `helm -n`), but anyone who edits $NS without also overriding `--set namespace=...` (or values.yaml) gets exactly what just happened on the live cluster: Helm's own release bookkeeping lives under the new namespace while every actual resource still targets the old (now-nonexistent) one, and the apply fails with "namespaces \"X\" not found" for every single resource. Other MOSIP module charts (e.g. kernel: `helm -n $NS install ... `, no values-file namespace field at all) don't have this problem because they use Helm's built-in `.Release.Namespace`, which is automatically and always exactly whatever `-n`/`--namespace` was passed — there is no second value that can drift out of sync. Match that pattern here: replace every `.Values.namespace` reference with `.Release.Namespace` across both charts' templates and drop the now-unused `namespace` key from both values.yaml files. install.sh needs no changes — it already passes `-n "$NS"` to `helm upgrade --install`, which is now the only thing that determines where resources land. Verified with the real kattu/mosip-helm-gh-pages toolchain (ct + yamale via uv, since pip/venv aren't available in this sandbox): - helm lint: clean - helm template --namespace nexus (a namespace other than the values.yaml default): every resource correctly follows it — this is the actual regression test for the bug this fixes - ct lint --validate-maintainers against the real chart-schema.yaml / lintconf.yaml: both charts pass - yamale against the real health-check-schema.yaml on rendered Deployment/StatefulSet manifests: both charts pass Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A5KE4fZxHqbeiDaUJenSfU Signed-off-by: ckm007 <chandrakeshavmishra@gmail.com>
|
Warning Review limit reached
Next review available in: 50 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
WalkthroughThe Nexus server and UI Helm charts now use Helm’s ChangesNexus Helm namespace alignment
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
install.sh pulls the chart from the published Helm repo (mosip.github.io/mosip-helm), not local chart source — republishing under the same 1.0.0 version number would be bad practice regardless (chart versions should be immutable once published; a 1.0.0 already exists in the repo), so this needs its own version for the .Release.Namespace fix to actually reach anyone. appVersion (the app image tag) is unchanged since no application code changed. install.sh's own CHART_VERSION default is intentionally left at 1.0.0 for now — pass CHART_VERSION=1.0.1 explicitly while still in dev/testing. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A5KE4fZxHqbeiDaUJenSfU Signed-off-by: ckm007 <chandrakeshavmishra@gmail.com>
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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 `@MosipNexus/helm/nexus-server/templates/updater-pvc.yaml`:
- Line 10: Add a deprecated transition value for the legacy namespace and use it
in the updater PVC migration path so releases with a mismatched existing
namespace fail before applying changes; retain the legacy namespace behavior for
one transition instead of immediately switching identity to .Release.Namespace.
Apply the same migration guard and transition handling to the PostgreSQL PVC
templates, preserving existing data and preventing replacement claims in a new
namespace.
In `@MosipNexus/helm/nexus-server/values.yaml`:
- Around line 5-8: Update the namespace descriptions in
MosipNexus/helm/nexus-server/values.yaml lines 5-8 to refer only to every
namespaced resource, not every template or resource. Also update
MosipNexus/helm/nexus-server/README.md lines 100-101 to say every namespaced
resource and explicitly state that cluster-scoped resources are not
namespace-scoped.
- Around line 5-8: Update the explanatory comment in the Helm values
documentation to scope its namespace claim to namespaced resources: replace
references to “every template” and where “resources land” with wording that
explicitly excludes cluster-scoped resources such as the cluster issuer.
🪄 Autofix
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: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 3ef45aee-5c11-435b-af6b-2f8b55a18d05
📒 Files selected for processing (29)
MosipNexus/helm/nexus-server/README.mdMosipNexus/helm/nexus-server/templates/NOTES.txtMosipNexus/helm/nexus-server/templates/backup-cronjob.yamlMosipNexus/helm/nexus-server/templates/backup-pvc.yamlMosipNexus/helm/nexus-server/templates/deployment.yamlMosipNexus/helm/nexus-server/templates/hpa.yamlMosipNexus/helm/nexus-server/templates/ingress.yamlMosipNexus/helm/nexus-server/templates/initial-ingest-job.yamlMosipNexus/helm/nexus-server/templates/postgres-configmap.yamlMosipNexus/helm/nexus-server/templates/postgres-pvc.yamlMosipNexus/helm/nexus-server/templates/postgres-service.yamlMosipNexus/helm/nexus-server/templates/postgres-statefulset.yamlMosipNexus/helm/nexus-server/templates/prometheusrule.yamlMosipNexus/helm/nexus-server/templates/service-account.yamlMosipNexus/helm/nexus-server/templates/service.yamlMosipNexus/helm/nexus-server/templates/servicemonitor.yamlMosipNexus/helm/nexus-server/templates/updater-cronjob.yamlMosipNexus/helm/nexus-server/templates/updater-pvc.yamlMosipNexus/helm/nexus-server/templates/virtualservice.yamlMosipNexus/helm/nexus-server/values.yamlMosipNexus/helm/nexus-ui/README.mdMosipNexus/helm/nexus-ui/templates/NOTES.txtMosipNexus/helm/nexus-ui/templates/deployment.yamlMosipNexus/helm/nexus-ui/templates/gateway.yamlMosipNexus/helm/nexus-ui/templates/ingress.yamlMosipNexus/helm/nexus-ui/templates/service-account.yamlMosipNexus/helm/nexus-ui/templates/service.yamlMosipNexus/helm/nexus-ui/templates/virtualservice.yamlMosipNexus/helm/nexus-ui/values.yaml
Signed-off-by: Chandra Keshav Mishra <chandrakeshavmishra@gmail.com>
Signed-off-by: Chandra Keshav Mishra <chandrakeshavmishra@gmail.com>
Summary
Both charts had their own
values.yamlnamespacekey, independently threaded through every template'smetadata.namespace, completely disconnected from the-n/--namespaceflag passed tohelm install/upgrade.install.shalways kept these in sync by construction (same$NSvar forkubectl create nsandhelm -n), but editing$NSwithout also overriding--set namespace=...reproduces exactly what just happened on the live cluster: Helm's own release bookkeeping lives under the new namespace while every actual resource still targets the old (now-nonexistent) one, and the apply fails withnamespaces "X" not foundfor every single resource.Other MOSIP module charts (e.g.
kernel:helm -n $NS install ..., no values-file namespace field at all) don't have this problem — they use Helm's built-in.Release.Namespace, which is automatically and always exactly whatever-n/--namespacewas passed, so there's no second value that can drift out of sync. This PR matches that pattern: replaces every.Values.namespacereference with.Release.Namespaceacross both charts' templates, and drops the now-unusednamespacekey from bothvalues.yamlfiles.install.shneeds no changes — it already passes-n "$NS"tohelm upgrade --install, which is now the only thing that determines where resources land.Verification
Real
kattu/mosip-helm-gh-pagestoolchain (ct+yamaleviauv, sincepip/venvaren't available in this sandbox):helm lint— cleanhelm template --namespace nexus(a namespace other than the oldvalues.yamldefault) — every resource correctly follows it; this is the actual regression test for the bug this fixesct lint --validate-maintainersagainst the realchart-schema.yaml/lintconf.yaml— both charts passyamaleagainst the realhealth-check-schema.yamlon renderedDeployment/StatefulSetmanifests — both charts passhttps://claude.ai/code/session_01A5KE4fZxHqbeiDaUJenSfU
Summary by CodeRabbit
Documentation
Bug Fixes