Merge pull request #126627 from fusida/fix-reduce-etcd-conn

fix short circuit if the compaction request from apiserver is disabled
This commit is contained in:
Kubernetes Prow Robot 2024-08-28 19:28:57 +01:00 committed by GitHub
commit 26f399921f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -378,6 +378,10 @@ func startCompactorOnce(c storagebackend.TransportConfig, interval time.Duration
compactorsMu.Lock()
defer compactorsMu.Unlock()
if interval == 0 {
// short circuit, if the compaction request from apiserver is disabled
return func() {}, nil
}
key := fmt.Sprintf("%v", c) // gives: {[server1 server2] keyFile certFile caFile}
if compactor, foundBefore := compactors[key]; !foundBefore || compactor.interval > interval {
compactorClient, err := newETCD3Client(c)