I have 3 existing mongo instances serving an existing kubernetes cluster, and added 3 new instances to the replica set while setting up a new kubernetes cluster. The goal is to switch to the 3 new instances and tear down the 3 old instances when I remove my old k8s cluster. codebase is golang, so using the Go Mongo driver. In a new cluster, I have mongo hostnames set to only the new instances I created. From my testing, it seems like the Go Mongo driver programmatically determines the primary node even though I don’t have the primary node in the hostnames list in my new kubernetes cluster and writes go through fine. can someone point me to where in the codebase it does this? I assume it determines the primary node given a hostname and directs writes to the primary node.
Thank you!