aerospike / aerospike-client-go

Aerospike Client Go
Apache License 2.0
432 stars 198 forks source link

Add a param in clientPolicy for using only seedNodes for connection #407

Closed sud82 closed 1 year ago

khaf commented 1 year ago

Could you add a bit of info regarding why this feature is needed?

sud82 commented 1 year ago

We are using this go client in our https://github.com/aerospike/aerospike-kubernetes-operator (AKO). The AKO uses the IP of the server pod as the seed address to establish the connection. However, a problem arises when the pod's IP differs from the IP obtained through the "service-clear-std" command. In such cases, the Go client mistakenly identifies the pod IP as the IP of a load balancer. Consequently, the client attempts to connect using this fetched IP. This issue can occur due to user configurations where the address in the aerospike config file is configured in a way that allows customer's clients to access the server pod using the configured IP, but prevents the Operator's pod from accessing it.

To address this problem, we have introduced a new field in the clientPolicy. This addition ensures that the client only uses the seed IPs for establishing connections, thus avoiding the confusion caused by the above situation.