nginxinc/nginx-loadbalancer-kubernetes

Genericize BorderClient creation in Synchronizer using an interface

ciroque opened this issue · 1 comments

Is your feature request related to a problem? Please describe

No Problem.

In order to allow extension and implement support for various Border Servers the Synchronizer module should not import the NGINX Plus client ("github.com/nginxinc/nginx-plus-go-client/client") directly. It does this presently in 'Synchronizer::buildBorderClient' method on line 93.

This direct creation of a concrete implementation should use an interface and factory to create an instance of a configurable implementation.

Describe the solution you'd like

Define an interface that is generic against the NGINX Plus client that can be extended for other clients down the road (sure, this is a modicum of 'future-proofing', but will hopefully incentivize more developers to join in the fun and contribute.

Describe alternatives you've considered

The current implementation is the alternative. Use clients directly with no separation that would allow for easier testing and extension.

Additional context

Add any other context or screenshots about the feature request here.

Alternative: simply pass the HttpClient into a factory method on the HttpBorderClient / TcpBorderClient and let those modules create the NGINX Plus client.

This is cleaner, does it adversely affect testing?