-
Notifications
You must be signed in to change notification settings - Fork 24
CLOUDP-349087: Block simultaneous TLS disabling and scaling for ReplicaSets #549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
16850b1
Block disabling TLS and scaling simultaneously
Julien-Ben 3c5fc71
Add new scale down step
Julien-Ben 2cec5d9
Remove code to handle tls disable + scale
Julien-Ben efd27a1
Cleanup TLSConfigurationWillBeDisabled
Julien-Ben 38415f9
Lint
Julien-Ben f0342a1
Changelog entry
Julien-Ben 0f5d103
Rename file
Julien-Ben d38bab2
Rename fixture
Julien-Ben ff96d32
Fix create replica set test
Julien-Ben File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
6 changes: 6 additions & 0 deletions
6
changelog/20251024_fix_block_simultaneous_tls_disabling_and_scaling.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| kind: fix | ||
| date: 2025-10-24 | ||
| --- | ||
|
|
||
| * **ReplicaSet**: Blocked disabling TLS and changing member count simultaneously. These operations must now be applied separately to prevent configuration inconsistencies. | ||
|
Comment on lines
+1
to
+6
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LGMT! |
||
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,7 +68,7 @@ func TestCreateReplicaSet(t *testing.T) { | |
|
|
||
| connection := omConnectionFactory.GetConnection() | ||
| connection.(*om.MockedOmConnection).CheckDeployment(t, deployment.CreateFromReplicaSet("fake-mongoDBImage", false, rs), "auth", "ssl") | ||
| connection.(*om.MockedOmConnection).CheckNumberOfUpdateRequests(t, 2) | ||
| connection.(*om.MockedOmConnection).CheckNumberOfUpdateRequests(t, 1) | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reduced to one since we removed one update step in |
||
| } | ||
|
|
||
| func TestReplicaSetRace(t *testing.T) { | ||
|
|
@@ -385,39 +385,6 @@ func TestCreateReplicaSet_TLS(t *testing.T) { | |
| assert.Equal(t, "OPTIONAL", sslConfig["clientCertificateMode"]) | ||
| } | ||
|
|
||
| // TestUpdateDeploymentTLSConfiguration a combination of tests checking that: | ||
| // | ||
| // TLS Disabled -> TLS Disabled: should not lock members | ||
| // TLS Disabled -> TLS Enabled: should not lock members | ||
| // TLS Enabled -> TLS Enabled: should not lock members | ||
| // TLS Enabled -> TLS Disabled: *should lock members* | ||
| func TestUpdateDeploymentTLSConfiguration(t *testing.T) { | ||
| rsWithTLS := mdbv1.NewReplicaSetBuilder().SetSecurityTLSEnabled().Build() | ||
| rsNoTLS := mdbv1.NewReplicaSetBuilder().Build() | ||
| deploymentWithTLS := deployment.CreateFromReplicaSet("fake-mongoDBImage", false, rsWithTLS) | ||
| deploymentNoTLS := deployment.CreateFromReplicaSet("fake-mongoDBImage", false, rsNoTLS) | ||
|
|
||
| // TLS Disabled -> TLS Disabled | ||
| shouldLockMembers, err := updateOmDeploymentDisableTLSConfiguration(om.NewMockedOmConnection(deploymentNoTLS), "fake-mongoDBImage", false, 3, rsNoTLS, zap.S(), util.CAFilePathInContainer, "") | ||
| assert.NoError(t, err) | ||
| assert.False(t, shouldLockMembers) | ||
|
|
||
| // TLS Disabled -> TLS Enabled | ||
| shouldLockMembers, err = updateOmDeploymentDisableTLSConfiguration(om.NewMockedOmConnection(deploymentNoTLS), "fake-mongoDBImage", false, 3, rsWithTLS, zap.S(), util.CAFilePathInContainer, "") | ||
| assert.NoError(t, err) | ||
| assert.False(t, shouldLockMembers) | ||
|
|
||
| // TLS Enabled -> TLS Enabled | ||
| shouldLockMembers, err = updateOmDeploymentDisableTLSConfiguration(om.NewMockedOmConnection(deploymentWithTLS), "fake-mongoDBImage", false, 3, rsWithTLS, zap.S(), util.CAFilePathInContainer, "") | ||
| assert.NoError(t, err) | ||
| assert.False(t, shouldLockMembers) | ||
|
|
||
| // TLS Enabled -> TLS Disabled | ||
| shouldLockMembers, err = updateOmDeploymentDisableTLSConfiguration(om.NewMockedOmConnection(deploymentWithTLS), "fake-mongoDBImage", false, 3, rsNoTLS, zap.S(), util.CAFilePathInContainer, "") | ||
| assert.NoError(t, err) | ||
| assert.True(t, shouldLockMembers) | ||
| } | ||
|
|
||
| // TestCreateDeleteReplicaSet checks that no state is left in OpsManager on removal of the replicaset | ||
| func TestCreateDeleteReplicaSet(t *testing.T) { | ||
| ctx := context.Background() | ||
|
|
||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a good candidate for CEL validation on the API server so changes like this don't get even admitted to the storage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's definitely something we can add to a Discuss agenda, or at least discuss in the team channel !