@@ -578,32 +578,8 @@ func (r *ReconcileMongoDbReplicaSet) updateOmDeploymentRs(ctx context.Context, c
578578 }
579579
580580 caFilePath := fmt .Sprintf ("%s/ca-pem" , util .TLSCaMountPath )
581- // If current operation is to Disable TLS, then we should the current members of the Replica Set,
582- // this is, do not scale them up or down util TLS disabling has completed.
583- shouldLockMembers , err := updateOmDeploymentDisableTLSConfiguration (conn , r .imageUrls [mcoConstruct .MongodbImageEnv ], r .forceEnterprise , membersNumberBefore , rs , log , caFilePath , tlsCertPath )
584- if err != nil && ! isRecovering {
585- return workflow .Failed (err )
586- }
587-
588- var updatedMembers int
589- // This lock member logic will be removed soon, we should rather block possibility to disable tls + scale
590- // Tracked in CLOUDP-349087
591- if shouldLockMembers {
592- // We should not add or remove members during this run, we'll wait for
593- // TLS to be completely disabled first.
594- // However, on first reconciliation (membersNumberBefore=0), we need to use replicasTarget
595- // because the OM deployment is initialized with TLS enabled by default.
596- log .Debugf ("locking members for this reconciliation because TLS was disabled" )
597- if membersNumberBefore == 0 {
598- updatedMembers = replicasTarget
599- } else {
600- updatedMembers = membersNumberBefore
601- }
602- } else {
603- updatedMembers = replicasTarget
604- }
605581
606- replicaSet := replicaset .BuildFromMongoDBWithReplicas (r .imageUrls [mcoConstruct .MongodbImageEnv ], r .forceEnterprise , rs , updatedMembers , rs .CalculateFeatureCompatibilityVersion (), tlsCertPath )
582+ replicaSet := replicaset .BuildFromMongoDBWithReplicas (r .imageUrls [mcoConstruct .MongodbImageEnv ], r .forceEnterprise , rs , replicasTarget , rs .CalculateFeatureCompatibilityVersion (), tlsCertPath )
607583 processNames := replicaSet .GetProcessNames ()
608584
609585 status , additionalReconciliationRequired := r .updateOmAuthentication (ctx , conn , processNames , rs , deploymentOptionsRS .agentCertPath , caFilePath , internalClusterCertPath , isRecovering , log )
@@ -668,40 +644,6 @@ func (r *ReconcileMongoDbReplicaSet) updateOmDeploymentRs(ctx context.Context, c
668644 return workflow .OK ()
669645}
670646
671- // updateOmDeploymentDisableTLSConfiguration checks if TLS configuration needs
672- // to be disabled. In which case it will disable it and inform to the calling
673- // function.
674- func updateOmDeploymentDisableTLSConfiguration (conn om.Connection , mongoDBImage string , forceEnterprise bool , membersNumberBefore int , rs * mdbv1.MongoDB , log * zap.SugaredLogger , caFilePath , tlsCertPath string ) (bool , error ) {
675- tlsConfigWasDisabled := false
676-
677- err := conn .ReadUpdateDeployment (
678- func (d om.Deployment ) error {
679- if ! d .TLSConfigurationWillBeDisabled (rs .Spec .GetSecurity ()) {
680- return nil
681- }
682-
683- tlsConfigWasDisabled = true
684- d .ConfigureTLS (rs .Spec .GetSecurity (), caFilePath )
685-
686- // configure as many agents/Pods as we currently have, no more (in case
687- // there's a scale up change at the same time).
688- replicaSet := replicaset .BuildFromMongoDBWithReplicas (mongoDBImage , forceEnterprise , rs , membersNumberBefore , rs .CalculateFeatureCompatibilityVersion (), tlsCertPath )
689-
690- lastConfig , err := rs .GetLastAdditionalMongodConfigByType (mdbv1 .ReplicaSetConfig )
691- if err != nil {
692- return err
693- }
694-
695- d .MergeReplicaSet (replicaSet , rs .Spec .AdditionalMongodConfig .ToMap (), lastConfig .ToMap (), log )
696-
697- return nil
698- },
699- log ,
700- )
701-
702- return tlsConfigWasDisabled , err
703- }
704-
705647func (r * ReconcileMongoDbReplicaSet ) OnDelete (ctx context.Context , obj runtime.Object , log * zap.SugaredLogger ) error {
706648 rs := obj .(* mdbv1.MongoDB )
707649
0 commit comments