Skip to content

Conversation

@Julien-Ben
Copy link
Collaborator

@Julien-Ben Julien-Ben commented Oct 24, 2025

Summary

We have code in the replica set controller dedicated to handling a scenario where the user disable TLS, and ascale their cluster at the same time. The test for this behaviour was broken. Because there were two functions with the name test_tls_is_disabled_and_scaled_up, so pytest would run only one of them.

When I fixed the test, it failed: https://spruce.mongodb.com/task/mongodb_kubernetes_e2e_mdb_kind_ubi_cloudqa_e2e_disable_tls_scale_up_patch_dfb9424e9b34ddd048a725a9988114ca4032f9bf_68de79b2fccf070007a2c51e_25_10_02_13_10_12/tests?execution=4&sorts=STATUS%3AASC

Which means the code to handle it was incorrect. My opinion is that it is better to block this change, rather than introducing complexity to handle it. It is not a common use case.

A changelog entry was added. Question: should it be explicitly mentioned in our public documentation ?

Old related PR (2021): https://github.com/10gen/ops-manager-kubernetes/pull/1444
And ticket: https://jira.mongodb.org/browse/CLOUDP-80768

Proof of Work

Unit and e2e test for blocking the operation should pass.
No regression due to the change in updateOmDeploymentRs should be observed.

Checklist

  • Have you linked a jira ticket and/or is the ticket in the title?
  • Have you checked whether your jira ticket required DOCSP changes?
  • Have you added changelog file?

@github-actions
Copy link

github-actions bot commented Oct 24, 2025

⚠️ (this preview might not be accurate if the PR is not rebased on current master branch)

MCK 1.6.0 Release Notes

New Features

  • MongoDBCommunity: Added support to configure custom cluster domain via newly introduced spec.clusterDomain resource field. If spec.clusterDomain is not set, environment variable CLUSTER_DOMAIN is used as cluster domain. If the environment variable CLUSTER_DOMAIN is also not set, operator falls back to cluster.local as default cluster domain.
  • Helm Chart: Introduced two new helm fields operator.podSecurityContext and operator.securityContext that can be used to configure securityContext for Operator deployment through Helm Chart.

Bug Fixes

  • Fixed parsing of the customEnvVars Helm value when values contain = characters.
  • ReplicaSet: Blocked disabling TLS and changing member count simultaneously. These operations must now be applied separately to prevent configuration inconsistencies.

@Julien-Ben Julien-Ben changed the title Jben/block disable tls and scale CLOUDP-349087: Block simultaneous TLS disabling and scaling for ReplicaSets Oct 24, 2025
@Julien-Ben Julien-Ben self-assigned this Oct 24, 2025
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)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reduced to one since we removed one update step in updateOmDeploymentRs

@Julien-Ben Julien-Ben marked this pull request as ready for review October 24, 2025 09:52
@Julien-Ben Julien-Ben requested review from a team and vinilage as code owners October 24, 2025 09:52
@codeowners-service-app
Copy link

Assigned MaciejKaras for team kubernetes-hosted because fealebenpae is out of office.

@Julien-Ben Julien-Ben requested review from lsierant and removed request for nammn October 24, 2025 09:52
Copy link
Collaborator

@vinilage vinilage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGMT!

Comment on lines +1 to +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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGMT!

@Julien-Ben Julien-Ben requested a review from m1kola October 24, 2025 10:15
Julien-Ben added a commit that referenced this pull request Oct 24, 2025
Fix create replica set test

Rename fixture

Rename file

Changelog entry

Lint

Cleanup TLSConfigurationWillBeDisabled

Remove code to handle tls disable + scale

Add new scale down step
Julien-Ben added a commit that referenced this pull request Oct 24, 2025
Fix create replica set test

Rename fixture

Rename file

Changelog entry

Lint

Cleanup TLSConfigurationWillBeDisabled

Remove code to handle tls disable + scale

Add new scale down step
Copy link
Contributor

@m1kola m1kola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a good candidate for validation on the API server side, but I'm approving because it is consistent with how we do validations for many other things already (unfortunately).

return v1.ValidationSuccess()
}

func noSimultaneousTLSDisablingAndScaling(newObj, oldObj MongoDbSpec) v1.ValidationResult {
Copy link
Contributor

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.

Copy link
Collaborator Author

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 !

Copy link
Collaborator

@MaciejKaras MaciejKaras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

One question though: do we have the same logic for multi and multi sharded? Are we also blocking scaling and disabling TLS for other resources?

@Julien-Ben
Copy link
Collaborator Author

Looks good!

One question though: do we have the same logic for multi and multi sharded? Are we also blocking scaling and disabling TLS for other resources?

This has to be checked for other resources, I opened a ticket

@Julien-Ben Julien-Ben merged commit 7dae9c2 into master Oct 27, 2025
37 checks passed
@Julien-Ben Julien-Ben deleted the jben/block-disable-tls-and-scale branch October 27, 2025 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants