Skip to content

Use .Release.Namespace instead of a separate values.yaml namespace field - #86

Merged
ckm007 merged 4 commits into
developfrom
use-release-namespace
Aug 10, 2026
Merged

Use .Release.Namespace instead of a separate values.yaml namespace field#86
ckm007 merged 4 commits into
developfrom
use-release-namespace

Conversation

@ckm007

@ckm007 ckm007 commented Aug 10, 2026

Copy link
Copy Markdown
Member

Summary

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 editing $NS without 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 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 — they use Helm's built-in .Release.Namespace, which is automatically and always exactly whatever -n/--namespace was passed, so there's no second value that can drift out of sync. This PR matches that pattern: replaces every .Values.namespace reference with .Release.Namespace across both charts' templates, and drops 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.

Verification

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 old 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

https://claude.ai/code/session_01A5KE4fZxHqbeiDaUJenSfU

Summary by CodeRabbit

  • Documentation

    • Updated Helm guidance to clarify that resources deploy to the Helm release namespace.
    • Removed obsolete namespace configuration references.
  • Bug Fixes

    • Ensured Nexus server and UI resources, operational jobs, monitoring alerts, and generated commands consistently use the selected Helm release namespace.
    • Improved deployment consistency when installing or upgrading charts with a custom namespace.

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

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@ckm007, you've reached your PR review limit, so we couldn't start this review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 6381b5da-7c6e-4f41-9a68-6d47ce83e3cd

📥 Commits

Reviewing files that changed from the base of the PR and between 9f07d54 and 1ce47ad.

📒 Files selected for processing (1)
  • MosipNexus/helm/nexus-server/Chart.yaml

Walkthrough

The Nexus server and UI Helm charts now use Helm’s .Release.Namespace for resources, commands, alerts, and documentation. Both charts remove the configurable namespace value.

Changes

Nexus Helm namespace alignment

Layer / File(s) Summary
Server namespace contract and resources
MosipNexus/helm/nexus-server/values.yaml, MosipNexus/helm/nexus-server/README.md, MosipNexus/helm/nexus-server/templates/*.yaml
Server resources now use .Release.Namespace. The obsolete namespace value was removed and documentation was updated.
Server operational references
MosipNexus/helm/nexus-server/templates/NOTES.txt, MosipNexus/helm/nexus-server/templates/backup-cronjob.yaml, MosipNexus/helm/nexus-server/templates/updater-cronjob.yaml, MosipNexus/helm/nexus-server/templates/prometheusrule.yaml
Installation commands, job examples, backup commands, and Prometheus queries now use .Release.Namespace.
UI namespace contract and resources
MosipNexus/helm/nexus-ui/values.yaml, MosipNexus/helm/nexus-ui/README.md, MosipNexus/helm/nexus-ui/templates/*
UI resources and installation notes now use .Release.Namespace. Documentation describes same-namespace installation and the nexus-api proxy target. The obsolete namespace value was removed.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Poem

Release namespaces align,
Server and UI share the line.
Values fade from view,
Notes and alerts follow through,
Helm keeps every resource in time.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change across both Helm charts.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch use-release-namespace

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.

❤️ Share

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

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>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4faf5bd and 9f07d54.

📒 Files selected for processing (29)
  • MosipNexus/helm/nexus-server/README.md
  • MosipNexus/helm/nexus-server/templates/NOTES.txt
  • MosipNexus/helm/nexus-server/templates/backup-cronjob.yaml
  • MosipNexus/helm/nexus-server/templates/backup-pvc.yaml
  • MosipNexus/helm/nexus-server/templates/deployment.yaml
  • MosipNexus/helm/nexus-server/templates/hpa.yaml
  • MosipNexus/helm/nexus-server/templates/ingress.yaml
  • MosipNexus/helm/nexus-server/templates/initial-ingest-job.yaml
  • MosipNexus/helm/nexus-server/templates/postgres-configmap.yaml
  • MosipNexus/helm/nexus-server/templates/postgres-pvc.yaml
  • MosipNexus/helm/nexus-server/templates/postgres-service.yaml
  • MosipNexus/helm/nexus-server/templates/postgres-statefulset.yaml
  • MosipNexus/helm/nexus-server/templates/prometheusrule.yaml
  • MosipNexus/helm/nexus-server/templates/service-account.yaml
  • MosipNexus/helm/nexus-server/templates/service.yaml
  • MosipNexus/helm/nexus-server/templates/servicemonitor.yaml
  • MosipNexus/helm/nexus-server/templates/updater-cronjob.yaml
  • MosipNexus/helm/nexus-server/templates/updater-pvc.yaml
  • MosipNexus/helm/nexus-server/templates/virtualservice.yaml
  • MosipNexus/helm/nexus-server/values.yaml
  • MosipNexus/helm/nexus-ui/README.md
  • MosipNexus/helm/nexus-ui/templates/NOTES.txt
  • MosipNexus/helm/nexus-ui/templates/deployment.yaml
  • MosipNexus/helm/nexus-ui/templates/gateway.yaml
  • MosipNexus/helm/nexus-ui/templates/ingress.yaml
  • MosipNexus/helm/nexus-ui/templates/service-account.yaml
  • MosipNexus/helm/nexus-ui/templates/service.yaml
  • MosipNexus/helm/nexus-ui/templates/virtualservice.yaml
  • MosipNexus/helm/nexus-ui/values.yaml

Comment thread MosipNexus/helm/nexus-server/templates/updater-pvc.yaml
Comment thread MosipNexus/helm/nexus-server/values.yaml
ckm007 added 2 commits August 10, 2026 09:10
Signed-off-by: Chandra Keshav Mishra <chandrakeshavmishra@gmail.com>
Signed-off-by: Chandra Keshav Mishra <chandrakeshavmishra@gmail.com>
@ckm007
ckm007 merged commit 91b7869 into develop Aug 10, 2026
18 checks passed
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.

1 participant