Skip to content

Commit

Permalink
chore: drop k8s timeout in the default kubeconfig
Browse files Browse the repository at this point in the history
(This is not user-facing, but rather internal use of the kubeconfig in
the tests/inside the machine).

This was added 4 years ago as a workaround, but instead of a global
timeout we should rather use contexts with timeouts/deadlines (and we
do!).

Setting a global timeout breaks streaming Kubernetes pod logs.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
  • Loading branch information
smira committed Jun 10, 2024
1 parent 7cbdce7 commit e8ced2c
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 15 deletions.
2 changes: 0 additions & 2 deletions internal/integration/base/discovery_k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ package base

import (
"context"
"time"

v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -36,7 +35,6 @@ func discoverNodesK8s(ctx context.Context, client *client.Client, suite *TalosSu
}

// patch timeout
config.Timeout = time.Minute
if suite.K8sEndpoint != "" {
config.Host = suite.K8sEndpoint
}
Expand Down
2 changes: 0 additions & 2 deletions internal/integration/base/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ func (k8sSuite *K8sSuite) SetupSuite() {
})
k8sSuite.Require().NoError(err)

// patch timeout
config.Timeout = time.Minute
if k8sSuite.K8sEndpoint != "" {
config.Host = k8sSuite.K8sEndpoint
}
Expand Down
4 changes: 0 additions & 4 deletions pkg/cluster/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"net"
"strconv"
"strings"
"time"

"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
Expand Down Expand Up @@ -66,9 +65,6 @@ func (k *KubernetesClient) K8sRestConfig(ctx context.Context) (*rest.Config, err
return nil, err
}

// patch timeout
config.Timeout = time.Minute

if k.ForceEndpoint != "" {
forceEndpoint, _ := strings.CutPrefix(k.ForceEndpoint, "https://")

Expand Down
3 changes: 0 additions & 3 deletions pkg/cluster/sonobuoy/sonobuoy.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,6 @@ func Run(ctx context.Context, cluster cluster.K8sProvider, options *Options) err
return fmt.Errorf("error getting kubernetes config: %w", err)
}

// reset timeout to prevent log streaming from timing out
cfg.Timeout = 0

skc, err := sonodynamic.NewAPIHelperFromRESTConfig(cfg)
if err != nil {
return fmt.Errorf("couldn't get sonobuoy api helper: %w", err)
Expand Down
4 changes: 0 additions & 4 deletions pkg/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ func NewClientFromKubeletKubeconfig() (*Client, error) {
return nil, err
}

if config.Timeout == 0 {
config.Timeout = 30 * time.Second
}

return NewForConfig(config)
}

Expand Down

0 comments on commit e8ced2c

Please sign in to comment.