Skip to content

Commit

Permalink
cluster: reduce timeout/retries on cluster health check
Browse files Browse the repository at this point in the history
Set a timeout on the request, which will both be passed onto the
server as well as used to create a child context with a deadline.
A fixed value of 10sec is used here for now.

Additionally, max retries is set to 1 vs the default of up to 10.

See #5729.
  • Loading branch information
milas committed May 6, 2022
1 parent 802fb41 commit 732a54b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion internal/k8s/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,14 @@ func (k *K8sClient) ClusterHealth(ctx context.Context, verbose bool) (ClusterHea
//
// See https://kubernetes.io/docs/reference/using-api/health-checks/
func (k *K8sClient) apiServerHealthCheck(ctx context.Context, route string, verbose bool) (bool, string, error) {
req := k.discovery.RESTClient().Get().AbsPath(route)
req := k.discovery.RESTClient().
Get().
AbsPath(route).
// timeout will both be passed as a param to server as well as used to
// create a child context with a deadline
Timeout(10*time.Second).
MaxRetries(1)

if verbose {
req = req.Param("verbose", "")
}
Expand Down

0 comments on commit 732a54b

Please sign in to comment.