Skip to content

fix(platform): make mongodb-application depend on its operator - #3845

Merged
Aleksei Sviridkin (lexfrei) merged 1 commit into
mainfrom
fix/mongodb-application-dependson
Sep 30, 2026
Merged

Aleksei Sviridkin (lexfrei) merged 1 commit into
mainfrom
fix/mongodb-application-dependson

Conversation

@myasnikovdaniil

@myasnikovdaniil myasnikovdaniil commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

The mongodb chart renders kind: PerconaServerMongoDB from psmdb.percona.com/v1, but cozystack.mongodb-application depended only on cozystack.networking and cozystack.cozystack-engine. So mongodb-rd registers the ApplicationDefinition as soon as the engine is up, a tenant can create a MongoDB before the operator exists, and its HelmRelease then fails with no matches for kind "PerconaServerMongoDB".

Every other operator-backed application here already carries the edge. This is the same defect #3817 fixes for etcd.

It also closes a test-selection gap. Without the edge cozystack.mongodb-operator reaches no runnable suite, so every change to the operator escalates to a run of all suites instead of selecting mongodb. See src_to_suites() in hack/select-e2e.sh.

Checks

packages/core/platform/tests/sources_mongodb_application_dependson_test.yaml pins the edge alongside the baseline ones, mirroring the etcd guard. Mutation checked: removing the edge turns it red, restoring it turns it green.

hack/select-install.sh --validate reports the graph still has no cycle, and all platform helm unit tests pass.

The exposure this adds

An administrator who lists cozystack.mongodb-operator in bundles.disabledPackages while keeping the application now leaves it DependenciesNotReady. That is the same exposure postgres, mariadb, kafka, redis and etcd already carry, with Package.spec.ignoreDependencies as the escape hatch.

Release note

fix(platform): the mongodb application now waits for the mongodb operator, so a tenant can no longer create a MongoDB before the CRD that serves it exists

Summary by CodeRabbit

  • Bug Fixes

    • Ensured the MongoDB operator is available before MongoDB application components are registered or deployed.
    • Preserved required dependencies on networking and the platform engine.
  • Tests

    • Added coverage verifying the MongoDB application dependency configuration.

Closes #3850

@github-actions github-actions Bot added size/M This PR changes 30-99 lines, ignoring generated files area/platform Issues or PRs related to platform infrastructure (bundle, flux, talos, installer) kind/bug Categorizes issue or PR as related to a bug labels Aug 16, 2026
@coderabbitai

coderabbitai Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7a841d66-755f-4752-b71b-3d847a913a53

📥 Commits

Reviewing files that changed from the base of the PR and between 66cd0fb and fcec3b0.

📒 Files selected for processing (2)
  • packages/core/platform/sources/mongodb-application.yaml
  • packages/core/platform/tests/sources_mongodb_application_dependson_test.yaml

Included review availability: Your plan includes up to 8 reviews per rolling hour; 4 remain after this review.


📝 Walkthrough

Walkthrough

The default MongoDB application package now depends on cozystack.mongodb-operator. A Chainsaw test verifies this dependency and preserves the networking and engine dependencies.

Changes

MongoDB application dependency

Layer / File(s) Summary
Declare and validate MongoDB dependencies
packages/core/platform/sources/mongodb-application.yaml, packages/core/platform/tests/sources_mongodb_application_dependson_test.yaml
The MongoDB application declares cozystack.mongodb-operator as a prerequisite. The Chainsaw test verifies the operator, networking, and engine dependencies.

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

Suggested reviewers: lexfrei

Merge Risk: ⚪ Minimal · up to fcec3

The MongoDB application now waits for its operator before becoming available, preventing creation before the required CRD exists. The change is localized and covered by a regression test; no actionable merge-blocking risk remains after normal checks.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding the MongoDB operator as a dependency of the MongoDB application.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/mongodb-application-dependson

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.

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.

myasnikovdaniil NOT LGTM. The change itself is right, the only blocker is the attribution trailer on the commit.

Business context: a tenant can create a MongoDB before the Percona operator and its CRD exist, because the mongodb application never waited for the mongodb operator.

The edge is still missing on current main, and the branch merges into main without conflicts. It matches postgres, mariadb, kafka, redis and etcd, which all list their operator. Both packages come from the paas bundle under the same condition, and nothing depends on cozystack.mongodb-application. The operator itself depends only on networking, prometheus-operator-crds and cert-manager, so there is no cycle, and hack/select-install.sh --validate agrees. The new test runs under make unit-tests. It goes red when I remove the edge and green when I put it back.

The blocker: commit fcec3b0 carries Assisted-By: Claude <[email protected]>. docs/agents/contributing.md lists this exact line under Review Blockers, and the trailer value must be LLM. CI stayed green only because this base predates the Commit trailers job. Main's hack/check-commit-trailers.sh rejects the commit with "attribution trailer value must be exactly LLM", so it will fail after a rebase. Please reword it to Assisted-by: LLM.

While rewording, I'd also drop "found while reviewing it" from the commit body and "it was found while reviewing that one" from the PR body. The PR body becomes the merge commit message, and how the bug was found is not a reason for the change. Keeping #3817 as the precedent is fine.

E2E on this head failed only in kubernetes-previous and kubernetes-latest, and the mongodb suite passed. A dependsOn edge on the mongodb application doesn't reach the Kamaji control-plane suites, so I don't count that against the PR. The branch is 1289 commits behind main, so the rebase for the reword also gets you a fresh run on current code.

@lexfrei

Copy link
Copy Markdown
Contributor

#4595 adds slim platform variants where every operator is opt-in through bundles.enabledPackages. There the missing edge is no longer an ordering race: enabling cozystack.mongodb-application without cozystack.mongodb-operator gives a Ready Package and MongoDB resources that no operator ever reconciles. With this edge the Package stays DependenciesNotReady and says why.

The mongodb chart renders kind: PerconaServerMongoDB from
psmdb.percona.com/v1, but cozystack.mongodb-application depended only on
networking and cozystack-engine. So mongodb-rd registers the
ApplicationDefinition as soon as the engine is up, and a tenant can
create a MongoDB before the operator exists; its HelmRelease then fails
with no matches for kind "PerconaServerMongoDB".

This is the same defect #3817 fixed for etcd.
Every other operator-backed app here already carries the edge.

It also closes a test-selection gap: without it cozystack.mongodb-operator
reaches no runnable suite, so every change to the operator escalates to
a run of all suites instead of selecting mongodb.

select-install.sh --validate reports the graph still has no cycle.

Assisted-by: LLM
Signed-off-by: Myasnikov Daniil <[email protected]>
Signed-off-by: Aleksei Sviridkin <[email protected]>
@lexfrei
Aleksei Sviridkin (lexfrei) force-pushed the fix/mongodb-application-dependson branch from 48371f4 to b8bc0df Compare September 29, 2026 23:18
@lexfrei Aleksei Sviridkin (lexfrei) added this to the v1.7.0 milestone Sep 29, 2026

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.

LGTM. The trailer is fixed. I rebased onto main and reworded the commit myself, and also dropped the suite count from the commit and the PR body: it was already stale, and any count there goes stale again.

Nit, not worth another round: the comment in mongodb-application.yaml lists postgres, mariadb, kafka, redis and etcd, but clickhouse, foundationdb, rabbitmq, opensearch and valkey carry the edge too. "Every other operator-backed app here" is true without the list. The etcd precedent has the same shape, so I'm leaving it.

@lexfrei
Aleksei Sviridkin (lexfrei) merged commit b86fd7a into main Sep 30, 2026
20 checks passed
@lexfrei
Aleksei Sviridkin (lexfrei) deleted the fix/mongodb-application-dependson branch September 30, 2026 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/platform Issues or PRs related to platform infrastructure (bundle, flux, talos, installer) kind/bug Categorizes issue or PR as related to a bug size/M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

audit every operator-backed application for a missing dependsOn edge

2 participants