Currently, the Reviewfunction for this backend creates a new HTTP client every time it gets called. This can be quite expensive and does not allow the backend to re-use connections.
Design of Change
In this implementation, the kubeAuthBackend struct stores and instantiates a DefaultPooledHTTPClient for connection re-use. The client is then passed by reference down to the reviewFactory for use in the Kubernetes API. This will ensure that we only create and use one HTTP client.
Overview
Currently, the
Review
function for this backend creates a new HTTP client every time it gets called. This can be quite expensive and does not allow the backend to re-use connections.Design of Change
In this implementation, the
kubeAuthBackend
struct stores and instantiates aDefaultPooledHTTPClient
for connection re-use. The client is then passed by reference down to thereviewFactory
for use in the Kubernetes API. This will ensure that we only create and use one HTTP client.