Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions controllers/operator/mongodbreplicaset_controller_multi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,22 +97,6 @@ func checkReplicaSetReconcileSuccessful(
assert.NoError(t, err)
}

// getReplicaSetMultiClusterMap simulates multiple K8s clusters using fake clients
func getReplicaSetMultiClusterMap(omConnectionFactory *om.CachedOMConnectionFactory) map[string]client.Client {
clientMap := make(map[string]client.Client)

for _, clusterName := range multiClusters {
fakeClientBuilder := mock.NewEmptyFakeClientBuilder()
fakeClientBuilder.WithInterceptorFuncs(interceptor.Funcs{
Get: mock.GetFakeClientInterceptorGetFunc(omConnectionFactory, true, true),
})

clientMap[clusterName] = kubernetesClient.NewClient(fakeClientBuilder.Build())
}

return clientMap
}

// TestReplicaSetMultiClusterScaling tests that multi-cluster ReplicaSets scale one member at a time
// across all clusters, similar to single-cluster behavior.
//
Expand Down
5 changes: 1 addition & 4 deletions pkg/dns/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ func GetMultiServiceFQDN(stsName string, namespace string, clusterNum int, podNu
domain = strings.TrimPrefix(clusterDomain, ".")
}

// For StatefulSet pods, DNS format is: <pod-name>.<headless-service>.<namespace>.svc.<domain>
podName := GetMultiPodName(stsName, clusterNum, podNum)
headlessService := GetMultiHeadlessServiceName(stsName, clusterNum)
return fmt.Sprintf("%s.%s.%s.svc.%s", podName, headlessService, namespace, domain)
return fmt.Sprintf("%s.%s.svc.%s", GetMultiServiceName(stsName, clusterNum, podNum), namespace, domain)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverting back to this (original, as seen in master) code fixes most of the tests, but breaks MongoDB-based multi-cluster.

Controller for MongoDBMultiCluster generates hostnames like this:

multi-replica-set-0-0-svc.mongodb-test.svc.cluster.local
multi-replica-set-1-0-svc.mongodb-test.svc.cluster.local
multi-replica-set-2-0-svc.mongodb-test.svc.cluster.local

But the controller for MongoDB multi-cluster replica sets creates hostnames like this even with the revert:

multi-replica-set-0-0.multi-replica-set-0-svc.mongodb-test.svc.cluster.local
multi-replica-set-1-0.multi-replica-set-1-svc.mongodb-test.svc.cluster.local
multi-replica-set-2-0.multi-replica-set-2-svc.mongodb-test.svc.cluster.local

Still trying to understand why.

}

func GetMultiServiceExternalDomain(stsName, externalDomain string, clusterNum, podNum int) string {
Expand Down
Loading