Skip to content

Commit

Permalink
Merge pull request #437 from glazychev-art/qps
Browse files Browse the repository at this point in the history
Use sdk-k8s QPS option
  • Loading branch information
denis-tingaikin authored Jan 19, 2024
2 parents 02c9611 + 6ef948b commit 2eaee79
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ linters-settings:
dupl:
threshold: 150
funlen:
Lines: 110
Statements: 50
lines: 120
statements: 60
goconst:
min-len: 2
min-occurrences: 2
Expand Down
19 changes: 8 additions & 11 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) 2020-2022 Doc.ai and/or its affiliates.
//
// Copyright (c) 2023 Cisco and/or its affiliates.
// Copyright (c) 2023-2024 Cisco and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand Down Expand Up @@ -34,7 +34,6 @@ import (

"github.com/networkservicemesh/sdk-k8s/pkg/registry/chains/registryk8s"
"github.com/networkservicemesh/sdk-k8s/pkg/tools/k8s"
"github.com/networkservicemesh/sdk-k8s/pkg/tools/k8s/client/clientset/versioned"
"github.com/networkservicemesh/sdk/pkg/registry/common/authorize"
"github.com/networkservicemesh/sdk/pkg/tools/opentelemetry"
"github.com/networkservicemesh/sdk/pkg/tools/spiffejwt"
Expand Down Expand Up @@ -160,8 +159,13 @@ func main() {
grpcfd.WithChainUnaryInterceptor(),
)

// Adjust config and create ClietSet
client, _ := newVersionedClient(config)
// Adjust config and create ClientSet
client, _, err := k8s.NewVersionedClient(
k8s.WithQPS(float32(config.KubeletQPS)),
k8s.WithBurst(config.KubeletQPS*2))
if err != nil {
logrus.Fatalf("error creating NewVersionedClient: %+v", err)
}

config.ClientSet = client
config.ChainCtx = ctx
Expand Down Expand Up @@ -199,10 +203,3 @@ func exitOnErr(ctx context.Context, cancel context.CancelFunc, errCh <-chan erro
cancel()
}(ctx, errCh)
}

func newVersionedClient(config *Config) (*versioned.Clientset, error) {
k8sConfig, _ := k8s.NewClientSetConfig()
k8sConfig.QPS = float32(config.KubeletQPS)
k8sConfig.Burst = config.KubeletQPS * 2
return versioned.NewForConfig(k8sConfig)
}
1 change: 0 additions & 1 deletion pkg/internal/imports/imports_linux.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2eaee79

Please sign in to comment.