diff --git a/e2e-tests/monitoring-2-0/run b/e2e-tests/monitoring-2-0/run index 1c50adc6ae..3d448e47ad 100755 --- a/e2e-tests/monitoring-2-0/run +++ b/e2e-tests/monitoring-2-0/run @@ -126,6 +126,12 @@ wait_for_delete "pod/${cluster}-mongos-0" wait_for_delete "pod/${cluster}-rs0-0" wait_for_delete "pod/${cluster}-cfg-0" +desc 'check if services are not deleted' + +kubectl_bin get svc $cluster-rs0 +kubectl_bin get svc $cluster-cfg +kubectl_bin get svc $cluster-mongos + does_node_id_exists_in_pmm=($(does_node_id_exists "${nodeList[@]}")) for instance in "${does_node_id_exists_in_pmm[@]}"; do if [ -n "$instance" ]; then diff --git a/pkg/controller/perconaservermongodb/psmdb_controller.go b/pkg/controller/perconaservermongodb/psmdb_controller.go index 152ef9d78d..eb741bf70b 100644 --- a/pkg/controller/perconaservermongodb/psmdb_controller.go +++ b/pkg/controller/perconaservermongodb/psmdb_controller.go @@ -1289,6 +1289,10 @@ func (r *ReconcilePerconaServerMongoDB) reconcileMongos(ctx context.Context, cr } func (r *ReconcilePerconaServerMongoDB) removeOutdatedMongosSvc(ctx context.Context, cr *api.PerconaServerMongoDB) error { + if cr.Spec.Pause && cr.Spec.Sharding.Enabled { + return nil + } + svcNames := make(map[string]struct{}, cr.Spec.Sharding.Mongos.Size) if cr.Spec.Sharding.Mongos.Expose.ServicePerPod { for i := 0; i < int(cr.Spec.Sharding.Mongos.Size); i++ {