Skip to content

fix(mongodb): route PBM dataprotection through syncer - #3241

Draft
gnolong wants to merge 2 commits into
mainfrom
fix/mongodb-pbm-syncer-dataprotection-main
Draft

fix(mongodb): route PBM dataprotection through syncer#3241
gnolong wants to merge 2 commits into
mainfrom
fix/mongodb-pbm-syncer-dataprotection-main

Conversation

@gnolong

@gnolong gnolong commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

This is the main-target port of the MongoDB PBM dataprotection work in #3110. It applies that PR's MongoDB addon diff without merging release-1.1 history into main.

  • run ReplicaSet, config-server, and shard PBM agents as /tools/syncer -- /tools/pbm-agent
  • run mongos under syncer so it can participate in sharded restore coordination
  • route PBM physical backup, physical restore, and PITR ActionSets through syncerctl
  • keep PBM credentials in mode-0600 target PVC files and pass only non-sensitive tokens to syncer
  • share the ReplicaSet and sharded PBM wrappers and remove obsolete restore-signal/PBM polling scripts
  • call the PBM-agent member-leave endpoint before the MongoDB endpoint and propagate failures

Main adaptation

The source and target branches have diverged substantially, so this is a net-diff port rather than a merge or commit-by-commit cherry-pick. It preserves current main behavior, including:

  • MongoDB chart 1.2.0-alpha.0 and syncer image tag 0.7.7
  • explicit force_path_style parsing and normalization from datasafed configuration
  • runtime volume guards for disabled log collection
  • current ParametersDefinition and toggle-balancer resources

The storage-path tests were adapted to the new PVC-backed PBM config writer because the old direct sync_pbm_storage_config path is removed by this change.

Validation

  • bash -n on all added or modified MongoDB shell scripts and replicaset-setup.tpl
  • focused ShellSpec: 10 examples, 0 failures
    • dataprotection common/storage config: 6
    • member leave: 2
    • ReplicaSet setup: 2
  • helm dependency build addons/mongodb
  • helm lint addons/mongodb
  • default and logCollector.enabled=true Helm renders
  • server-side dry-run against KubeBlocks 1.1.0-beta.8 for all 15 modified Helm templates
  • git diff --check
  • GitHub CI: shell-check, full shellspec-test, generated-file checks, and all four Helm release checks passed

The complete local ShellSpec directory also contains two existing Ruby-backed spec files. Their 9 examples could not execute locally because ruby is not installed; the 10 tests covering this port passed, and GitHub's Ruby-capable full ShellSpec job passed. Runtime volume rendering was also checked independently in both enabled and disabled modes.

A full-chart server-side dry-run against 1.1.0-beta.8 reaches the unchanged main ParametersDefinition resources and fails because that beta.8 CRD does not recognize the newer main fields. Every template changed by this PR passes an isolated server-side dry-run.

E2E status

The backup/restore/PITR compatibility evidence for the source change is recorded in #3110.

Follow-up hscale validation after upgrading KubeBlocks to 1.1.0-beta.8 found an unresolved controller/lifecycle boundary: the MongoDB 4.4.29 active-backup hscale case failed because HorizontalScaling reached Succeed 2/2 while the target PBM backup was active, after which the Backup remained Running until timeout because its target pod had been deleted. The independent MongoDB 8.0.17 run was interrupted before a terminal test result and is not reported as pass or fail.

This remains a draft until the main-target backup/restore/PITR checks and the beta.8 hscale lifecycle behavior are resolved or explicitly scoped.

Port the MongoDB PBM dataprotection changes from release-1.1 PR #3110 onto the current main chart while preserving main-only storage path-style handling, runtime volume guards, ParametersDefinition resources, and the syncer image version.
@codecov-commenter

codecov-commenter commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 80 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (67a48b8) to head (bee8830).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ddons/mongodb/scripts-ut-spec/member_leave_spec.sh 0.00% 41 Missing ⚠️
...godb/scripts-ut-spec/dataprotection_common_spec.sh 0.00% 38 Missing ⚠️
...s/mongodb/scripts-ut-spec/replicaset_setup_spec.sh 0.00% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main   #3241   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files        152     153    +1     
  Lines      23792   23837   +45     
=====================================
- Misses     23792   23837   +45     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gnolong gnolong added the nopick Not auto cherry-pick when PR merged label Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nopick Not auto cherry-pick when PR merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants