Skip to content

fix(helm): make mongo init-container -ubi8 append idempotent - #41936

Merged
wyattwalter merged 3 commits into
releasefrom
claude/quirky-hawking-72b0d2
Jul 6, 2026
Merged

fix(helm): make mongo init-container -ubi8 append idempotent#41936
wyattwalter merged 3 commits into
releasefrom
claude/quirky-hawking-72b0d2

Conversation

@sebastianiv21

@sebastianiv21 sebastianiv21 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Description

Tip

TL;DR — On a private registry that only mirrors MongoDB's -ubi8 tags, there was no single value of mongodbCommunity.version that worked, because the chart feeds it to two consumers with contradictory suffix expectations. This makes the init-container image helper's -ubi8 append idempotent so one value drives both. Helm-chart-only change; default behavior is byte-identical.

The chart derives two image references from the single mongodbCommunity.version value, and on a private registry (a mirror that only carries -ubi8 tags) the two consumers demand contradictory formats:

  1. MongoDBCommunity CR spec.version (deploy/helm/templates/mongodb-community.yaml) — consumed verbatim by the MongoDB Community Operator. The operator only auto-appends -ubi8 for MongoDB's official registry URLs; for a private mirror it uses the value as-is, so the CR must carry 8.0.20-ubi8 or mongod can't pull.
  2. Init-container wait image via the appsmith.mongoInitContainerImage helper (deploy/helm/templates/_helpers.tpl) — always appended -ubi8, so a 8.0.20-ubi8 value produced ...:8.0.20-ubi8-ubi8, which fails.

Net: with a single bare value there was no correct setting on a private registry. The only workaround was to set version: "8.0.20-ubi8" and separately override initContainer.mongodb.image to the full path — two knobs kept in sync on every version bump.

What changed

Make the helper strip a trailing -ubi8 before re-appending it, so the append is idempotent — both 8.0.20 and 8.0.20-ubi8 render ...:8.0.20-ubi8. The suffix is now defined once ($suffix) and used for both the trim and the append, so they can't drift if it ever changes. Private-registry users can now drive both consumers from version alone; the initContainer.mongodb.image override is no longer needed.

version value Registry CR spec.version Init image Result
8.0.20 official (default) 8.0.20 (operator appends -ubi8) …:8.0.20-ubi8 ✅ unchanged
8.0.20-ubi8 private mirror 8.0.20-ubi8 (verbatim) …:8.0.20-ubi8 (trimmed, not -ubi8-ubi8) ✅ fixed, single knob

The operator-side behavior (auto-append only for official URLs) is a MongoDB limitation outside Appsmith's control; this fixes only the chart-helper side. The default path is byte-identical (8.0.20 still renders …:8.0.20-ubi8), so existing snapshots are unaffected.

Files: deploy/helm/templates/_helpers.tpl (idempotent trim + doc), deploy/helm/values.yaml (private-registry guidance), deploy/helm/tests/mongodb_operator_test.yaml (2 new unittest cases).

Testing: helm unittest deploy/helm → 69 passed, 7 snapshots, 0 failed. Verified renders: 8.0.20…:8.0.20-ubi8; 8.0.20-ubi8 → init …:8.0.20-ubi8 (no double suffix) and CR spec.version: "8.0.20-ubi8".

Fixes #41937

Automation

/ok-to-test tags=""

🔍 Cypress test results

Warning

Tests have not run on the HEAD 8fa87fc yet


Mon, 06 Jul 2026 18:38:07 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Fixed MongoDB image tag handling so version strings that already include the -ubi8 suffix are no longer duplicated.
    • Improved compatibility with private registries and mirrored image tags.
  • Documentation

    • Added guidance on how to set MongoDB version values for registry setups that use -ubi8 tags.
  • Tests

    • Added coverage for MongoDB version rendering and container image tag behavior when -ubi8 is already present.

The chart derives two image references from the single
`mongodbCommunity.version` value, and on a private registry (a mirror
that only carries `-ubi8` tags) they need contradictory formats:

- The MongoDBCommunity CR `spec.version` is consumed verbatim by the
  operator, which only auto-appends `-ubi8` for MongoDB's official
  registry URLs. On a private mirror the CR must carry `8.0.20-ubi8`.
- The init-container wait image helper always appended `-ubi8`, so a
  `8.0.20-ubi8` value produced `...:8.0.20-ubi8-ubi8`, which fails.

Net: no single value worked on a private registry, forcing users to set
`version: "8.0.20-ubi8"` AND separately override
`initContainer.mongodb.image` and keep both in sync on every bump.

Make `appsmith.mongoInitContainerImage` trim a trailing `-ubi8` before
re-appending it, so the append is idempotent: both `8.0.20` and
`8.0.20-ubi8` render `...:8.0.20-ubi8`. Private-registry users can now
drive both consumers from `version` alone. The suffix is defined once
($suffix) so trim and append can't drift.

The default path is unchanged (`8.0.20` still renders `...:8.0.20-ubi8`).
Docs and a helm-unittest case cover the private-registry scenario.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The Helm helper for the MongoDB Community init-container image now trims an existing -ubi8 suffix before re-appending it. Helm tests cover the rendered version and image tag behavior, and values.yaml now explains the expected version format.

Changes

Mongo init container image suffix fix

Layer / File(s) Summary
Idempotent suffix trimming in helper template
deploy/helm/templates/_helpers.tpl
appsmith.mongoInitContainerImage now trims a pre-existing -ubi8 suffix from mongodbCommunity.version before appending -ubi8, avoiding double suffixes.
Tests and version documentation
deploy/helm/tests/mongodb_operator_test.yaml, deploy/helm/values.yaml
New tests confirm spec.version preserves a -ubi8-suffixed value and the init container tag isn't double-suffixed; values.yaml documents recommended version formatting.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Poem

A suffix once did double up,
But now it’s trimmed to fit the cup.
One -ubi8, neat and true,
For charts that render cleanly through.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The helper, tests, and values guidance address the private -ubi8 mirror issue and remove the need for a second override.
Out of Scope Changes check ✅ Passed The changes stay focused on the Mongo init-container suffix fix, related tests, and documentation guidance.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly and concisely describes the main Helm chart change: making the mongo init-container -ubi8 append idempotent.
Description check ✅ Passed The description covers the required template sections, includes context, linked issue, automation, test results, and communication choice.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/quirky-hawking-72b0d2

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.

@coderabbitai coderabbitai Bot left a comment

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.

🧹 Nitpick comments (1)
deploy/helm/values.yaml (1)

507-511: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Regenerate README after doc comment update.

New extended description added above mongodbCommunity.version. Confirm helm-docs --sort-values-order file was run so the README reflects this text.

As per coding guidelines, "When editing values.yaml, regenerate both the JSON schema and README before committing using helm schema and helm-docs --sort-values-order file commands."

🤖 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 `@deploy/helm/values.yaml` around lines 507 - 511, The doc comment for
mongodbCommunity.version in values.yaml was updated, so regenerate the README
and JSON schema to keep generated docs in sync. Run the helm-docs
--sort-values-order file workflow and the helm schema generation step after the
change, then verify the README reflects the new extended description and the
values schema matches the updated comment.

Source: Coding guidelines

🤖 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 `@deploy/helm/values.yaml`:
- Around line 507-511: The doc comment for mongodbCommunity.version in
values.yaml was updated, so regenerate the README and JSON schema to keep
generated docs in sync. Run the helm-docs --sort-values-order file workflow and
the helm schema generation step after the change, then verify the README
reflects the new extended description and the values schema matches the updated
comment.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 667aab5e-c6a0-4041-b188-6576c07379ef

📥 Commits

Reviewing files that changed from the base of the PR and between 4163960 and 9b74799.

📒 Files selected for processing (3)
  • deploy/helm/templates/_helpers.tpl
  • deploy/helm/tests/mongodb_operator_test.yaml
  • deploy/helm/values.yaml

@github-actions github-actions Bot added Bug Something isn't working Needs Triaging Needs attention from maintainers to triage and removed Bug Something isn't working labels Jul 1, 2026
@github-actions github-actions Bot added the Bug Something isn't working label Jul 6, 2026
@github-actions github-actions Bot removed the Bug Something isn't working label Jul 6, 2026
@wyattwalter
wyattwalter merged commit 20b5027 into release Jul 6, 2026
23 checks passed
@wyattwalter
wyattwalter deleted the claude/quirky-hawking-72b0d2 branch July 6, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Triaging Needs attention from maintainers to triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Helm chart can't drive MongoDB Community image tag from a single mongodbCommunity.version on a private -ubi8-only registry

2 participants