DefaultHttpClientsFactory is a thread-safe, caching implementation of HttpClientsFactory. It caches one HTTP client and one health-check client, rebuilding either only when the relevant routing configuration (proxy settings, TLS certificates) changes.
| 52 | // It caches one HTTP client and one health-check client, rebuilding either only when the |
| 53 | // relevant routing configuration (proxy settings, TLS certificates) changes. |
| 54 | type DefaultHttpClientsFactory struct { |
| 55 | k8s client.Client |
| 56 | logger logr.Logger |
| 57 | |
| 58 | httpClient *http.Client |
| 59 | healthCheckHttpClient *http.Client |
| 60 | |
| 61 | mu sync.RWMutex |
| 62 | |
| 63 | httpClientConfigmapRef *controller.ConfigmapReference |
| 64 | httpClientCertsVersion string |
| 65 | |
| 66 | systemCertPool *x509.CertPool |
| 67 | proxyFunc func(*http.Request) (*url.URL, error) |
| 68 | } |
| 69 | |
| 70 | func SetupHttpClientsFactory(k8s client.Client, logger logr.Logger) error { |
| 71 | systemCertPool, err := x509.SystemCertPool() |
nothing calls this directly
no outgoing calls
no test coverage detected