Skip to content

Commit

Permalink
Set timeout for k8s HTTP client (#186)
Browse files Browse the repository at this point in the history
* Set timeout for k8s HTTP client

We had a request to an ingesters take 20m and block the reconiliation loop. We want to avoid that, so adding a timeout. We use this client for both k8s and StatefulSet requests.

__I assume the operations that the StatefulSet requests will always be fast and will never have to actually do a lot of work (like uploading blocks). Can the reviewers confirm this assumption?__

* Add CHANGELOG.md entry PR number
  • Loading branch information
dimitarvdimitrov authored Dec 10, 2024
1 parent 91de5d2 commit 1f8b2a3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
## main / unreleased

* [ENHANCEMENT] New parameter log.format allows to set logging format to logfmt (default) or json (new). #184

* [ENHANCEMENT] Add a 5 minute timeout to requests to Pods and to the Kubernetes control plane. #186

## v0.21.0

* [ENHANCEMENT] Log debug information about StatefulSets as they are created, updated and deleted. #182
Expand Down
4 changes: 4 additions & 0 deletions cmd/rollout-operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,10 @@ func buildKubeConfig(apiURL, cfgFile string) (*rest.Config, error) {
if err != nil {
return nil, err
}
// Set a generous timeout.
// We use this client for various HTTP operations against the k8s API and against the StatefulSets.
// We want to not be stuck waiting forever on a TCP timeout, but also not interrupt any process the StatefulSets might eb doing.
config.Timeout = 5 * time.Minute
return config, nil
}

Expand Down

0 comments on commit 1f8b2a3

Please sign in to comment.