feat(mongodb): support TLS for replica set and sharding clusters - #3456
Open
gnolong wants to merge 1 commit into
Open
feat(mongodb): support TLS for replica set and sharding clusters#3456gnolong wants to merge 1 commit into
gnolong wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3456 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 192 193 +1
Lines 27227 27305 +78
=====================================
- Misses 27227 27305 +78 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
Author
|
how otld connects to mongodb when tls is enabled? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/etc/mongodb/tls/mongodb.pemwith restrictive permissions in the container writable layer, without adding an emptyDir.--ssl*options for the supported MongoDB 4.0 release and modern--tls*options for 4.2 and later, selected from the component service version.The local
addons/mongodb/tests/directory andaddons/mongodb/TLS.mdare intentionally excluded. ShellSpec does not reference the excluded tests.Dependency and usage
Depends on https://github.com/apecloud/syncer/pull/388 and a Syncer image containing that change. The default Syncer tag is unchanged in this PR; the test environment overrides
image.syncer.tag=mongodb-tls-734c281.Enable TLS by patching the Cluster component
tlsandissuerfields. For sharding, enable it on config server, mongos and the sharding template, with a UserProvided shared CA covering all member DNS names. Per-component KubeBlocks-generated CAs do not provide cross-component trust.TLS is not added to configuration files or Reconfiguring OpsRequest parameters. Enabling it replaces Pods and directly requires TLS, so this is not a zero-downtime plaintext-to-TLS migration. Managed clients intentionally use insecure TLS; server-to-server certificate verification remains enabled. Rebuilding the combined PEM after certificate-only rotation is not implemented here.
Validation
kb-addon-main-testk3d environment, using KubeBlocks main imagemain-13138f46and the unchanged Syncer test imagemongodb-tls-734c281:Each case started without TLS, wrote baseline data, and enabled TLS by patching the Cluster CR. Checks covered Pod replacement, actual startup argv, no TLS settings in config files, strict-CA read/write, retained baseline data, plaintext rejection and Syncer role detection. Both sharding cases also passed the management script's read-only shard existence check over TLS. Actual Percona versions were 4.0.28-23 and 8.0.17-6.
Tests used a single-member replica set or one config server, one mongos and one single-member shard, with 1 GiB data PVCs. Existing setup workarounds were kept separate from this PR: manifests explicitly supplied root passwordConfig, and sharding provision order was temporarily removed to avoid the existing config-server/mongos reference cycle. Original provision, update and termination orders were restored before each TLS patch.
Intermediate versions only received local option-selection coverage. Backup/restore, PITR, custom OpsDefinition clients, certificate rotation, multi-member HA and zero-downtime migration were not tested.