VictoriaMetrics/lib/promscrape/discovery/kubernetes
Zakhar Bessarab 06947c2685
vmagent: add support of HTTP2 client for Kubernetes SD ()
### Describe Your Changes

Currently, vmagent always uses a separate `http.Client` for every group
watcher in Kubernetes SD. With a high number of group watchers this
leads to large amount of opened connections.

This PR adds 2 changes to address this:
- re-use of existing `http.Client` - in case `http.Client` is connecting
to the same API server and uses the same parameters it will be re-used
between group watchers
- HTTP2 support - this allows to reuse connections more efficiently due
to ability of using streaming via existing connections.

See this issue for the details and test results -
https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5971

### Checklist

The following checks are **mandatory**:

- [ ] My change adheres [VictoriaMetrics contributing
guidelines](https://docs.victoriametrics.com/contributing/).

---------

Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>
Co-authored-by: Roman Khavronenko <roman@victoriametrics.com>
(cherry picked from commit eefae85450)
2024-10-08 10:37:48 +02:00
..
testdata lib/promscrape/discovery/kubernetes: follow-up after 0b5c874911 () 2022-06-04 01:11:23 +03:00
api_watcher_test.go all: consistently use 'any' instead of 'interface{}' 2024-07-10 00:23:26 +02:00
api_watcher.go vmagent: add support of HTTP2 client for Kubernetes SD () 2024-10-08 10:37:48 +02:00
api.go lib/promscrape/discovery/kubernetes: propagate possible errors at newAPIWatcher() to the caller 2023-10-27 20:27:58 +02:00
common_types.go lib/promscrape: optimize service discovery speed 2022-11-29 21:26:23 -08:00
endpoints_test.go lib/promscrape/discovery/kubernetes: follow-up for d5e94721db () 2023-05-09 21:29:27 -07:00
endpoints.go lib/promscrape/discovery/kubernetes: do not generate targets for already terminated pods and containers 2024-01-24 14:58:51 +02:00
endpointslice_test.go lib: consistently use f-tests instead of table-driven tests 2024-07-09 22:39:13 +02:00
endpointslice.go lib/promscrape/discovery/kubernetes: do not generate targets for already terminated pods and containers 2024-01-24 14:58:51 +02:00
ingress_test.go lib/promscrape: optimize service discovery speed 2022-11-29 21:26:23 -08:00
ingress.go Makefile: update golangci-lint from v1.51.2 to v1.54.2 2023-09-01 10:25:49 +02:00
kubeconfig_test.go lib/promscrape/discovery/kubernetes/kubeconfig_test.go: make TestParseKubeConfigSuccess test code easier to follow 2023-10-26 09:54:40 +02:00
kubeconfig.go lib: consistently use f-tests instead of table-driven tests 2024-07-09 22:39:13 +02:00
kubernetes.go all: consistently use 'any' instead of 'interface{}' 2024-07-10 00:23:26 +02:00
node_test.go lib/promscrape: optimize service discovery speed 2022-11-29 21:26:23 -08:00
node.go Makefile: update golangci-lint from v1.51.2 to v1.54.2 2023-09-01 10:25:49 +02:00
pod_test.go lib/promscrape/discovery/kubernetes: do not generate targets for already terminated pods and containers 2024-01-24 14:58:51 +02:00
pod_timing_test.go all: consistently use %w instead of %s in when error is passed to fmt.Errorf() 2023-10-26 09:44:40 +02:00
pod.go lib/promscrape/discovery/kubernetes: typo fix in the comment for ContainerStateTerminated struct 2024-01-24 15:10:47 +02:00
service_test.go lib/promscrape: optimize service discovery speed 2022-11-29 21:26:23 -08:00
service.go Makefile: update golangci-lint from v1.51.2 to v1.54.2 2023-09-01 10:25:49 +02:00