diff --git a/core/clustersmngr/cluster/cluster.go b/core/clustersmngr/cluster/cluster.go index cab6c79a34..7bae71033e 100644 --- a/core/clustersmngr/cluster/cluster.go +++ b/core/clustersmngr/cluster/cluster.go @@ -3,10 +3,12 @@ package cluster import ( "context" "fmt" + "net/http" "os" "time" "github.com/weaveworks/weave-gitops/pkg/server/auth" + machnet "k8s.io/apimachinery/pkg/util/net" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" "sigs.k8s.io/cli-utils/pkg/flowcontrol" @@ -77,6 +79,11 @@ func WithFlowControl(config *rest.Config) (*rest.Config, error) { config.QPS = ClientQPS config.Burst = ClientBurst + // From https://github.com/weaveworks/weave-gitops-enterprise/issues/3189 + // Suggested in https://github.com/kubernetes/kubernetes/issues/118703#issuecomment-1595072383 + // TODO: Revert or adapt when upstream fix is available + config.Proxy = machnet.NewProxierWithNoProxyCIDR(http.ProxyFromEnvironment) + return config, nil } diff --git a/core/clustersmngr/cluster/single.go b/core/clustersmngr/cluster/single.go index 16721cfbad..3e587a011e 100644 --- a/core/clustersmngr/cluster/single.go +++ b/core/clustersmngr/cluster/single.go @@ -3,10 +3,12 @@ package cluster import ( "fmt" "net" + "net/http" "github.com/weaveworks/weave-gitops/pkg/kube" "github.com/weaveworks/weave-gitops/pkg/server/auth" apiruntime "k8s.io/apimachinery/pkg/runtime" + machnet "k8s.io/apimachinery/pkg/util/net" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" "sigs.k8s.io/controller-runtime/pkg/client" @@ -60,6 +62,11 @@ func getClientFromConfig(config *rest.Config, scheme *apiruntime.Scheme) (client return nil, fmt.Errorf("could not create RESTMapper from config: %w", err) } + // From https://github.com/weaveworks/weave-gitops-enterprise/issues/3189 + // Suggested in https://github.com/kubernetes/kubernetes/issues/118703#issuecomment-1595072383 + // TODO: Revert or adapt when upstream fix is available + config.Proxy = machnet.NewProxierWithNoProxyCIDR(http.ProxyFromEnvironment) + client, err := client.New(config, client.Options{ Scheme: scheme, Mapper: mapper,