-
Notifications
You must be signed in to change notification settings - Fork 88
Open
Description
As we are scraping all the secrets from k8s, regardless of their type, it could take a LOT of memory (3G+).
I suppose it could be the reason of #97 #103
For example, long-running cluster can have hundreds of helm.sh/release.v1 secrets per namespace.
So my proposal is fetch only kubeSecretTypes types secrets from k8s API.
I prepared some POC #221 which works.
Disclaimer: unfortunately i'm not proficient in Go programming, so can't program anything complicated yet.
Cheers, Alexey
go tool pprof -sample_index=inuse_space -text heap2.out
File: x509-certificate-exporter
Type: inuse_space
Time: Dec 15, 2023 at 6:40pm (-03)
Showing nodes accounting for 1.54GB, 99.65% of 1.54GB total
Dropped 20 nodes (cum <= 0.01GB)
flat flat% sum% cum cum%
1.54GB 99.65% 99.65% 1.54GB 99.68% io.ReadAll
0 0% 99.65% 1.54GB 99.68% github.com/enix/x509-certificate-exporter/v3/internal.(*Exporter).DiscoverCertificates
0 0% 99.65% 1.54GB 99.68% github.com/enix/x509-certificate-exporter/v3/internal.(*Exporter).ListenAndServe
0 0% 99.65% 1.54GB 99.68% github.com/enix/x509-certificate-exporter/v3/internal.(*Exporter).getWatchedSecrets
0 0% 99.65% 1.54GB 99.68% github.com/enix/x509-certificate-exporter/v3/internal.(*Exporter).parseAllCertificates
0 0% 99.65% 1.54GB 99.68% github.com/enix/x509-certificate-exporter/v3/internal.(*Exporter).parseAllKubeSecrets
0 0% 99.65% 1.54GB 99.68% k8s.io/client-go/kubernetes/typed/core/v1.(*secrets).List
0 0% 99.65% 1.54GB 99.68% k8s.io/client-go/rest.(*Request).Do
0 0% 99.65% 1.54GB 99.68% k8s.io/client-go/rest.(*Request).Do.func1
0 0% 99.65% 1.54GB 99.68% k8s.io/client-go/rest.(*Request).request
0 0% 99.65% 1.54GB 99.68% k8s.io/client-go/rest.(*Request).request.func3
0 0% 99.65% 1.54GB 99.68% k8s.io/client-go/rest.(*Request).request.func3.1 (inline)
0 0% 99.65% 1.54GB 99.68% k8s.io/client-go/rest.(*Request).transformResponse
0 0% 99.65% 1.54GB 99.68% main.main
0 0% 99.65% 1.54GB 99.68% runtime.main
Metadata
Metadata
Assignees
Labels
No labels