Skip to content

Commit

Permalink
investigating memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
enekofb committed Sep 6, 2023
1 parent 17e51da commit 4d4623e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core/clustersmngr/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}

Expand Down
7 changes: 7 additions & 0 deletions core/clustersmngr/cluster/single.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 4d4623e

Please sign in to comment.