Skip to content

Commit

Permalink
vault: do not reuse TCP connections
Browse files Browse the repository at this point in the history
This commit disables TCP connection reuse for Vault.
Apparently, TCP connections to Vault might hang if Vault
gets shutdown forcefully.

The downside of this commit is that KES has to re-open a new
TCP connection for every interaction with Vault. However,
KES should not rach out to Vault most of them time. Hence, this
change seems acceptable.

Signed-off-by: Andreas Auernhammer <[email protected]>
  • Loading branch information
aead committed Sep 10, 2024
1 parent 1da59a0 commit 503251c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/keystore/vault/vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ func Connect(ctx context.Context, c *Config) (*Store, error) {
config.CloneTLSConfig = true // Required for status checks
config.CloneToken = true // Required for status checks
config.ConfigureTLS(tlsConfig)
if tr, ok := config.HttpClient.Transport.(*http.Transport); ok {
tr.DisableKeepAlives = true
tr.MaxIdleConnsPerHost = -1
}
vaultClient, err := vaultapi.NewClient(config)
if err != nil {
return nil, err
Expand Down

0 comments on commit 503251c

Please sign in to comment.