Skip to content

Commit

Permalink
version updates and lint fixes
Browse files Browse the repository at this point in the history
Tighter linter settings, version updates and related fixes.

Signed-off-by: Ukri Niemimuukko <ukri.niemimuukko@intel.com>
  • Loading branch information
uniemimu committed Jun 13, 2023
1 parent f61f135 commit 1e2274b
Show file tree
Hide file tree
Showing 13 changed files with 767 additions and 507 deletions.
15 changes: 7 additions & 8 deletions gpu-aware-scheduling/.golangci.yml
Expand Up @@ -7,32 +7,27 @@ linters:
enable-all: true
disable:
- paralleltest
- gomoddirectives
- exhaustivestruct
- varnamelen
- gofumpt
- nonamedreturns
- exhaustruct

linters-settings:
gofmt:
simplify: true
gofumpt:
lang-version: "1.18"
lang-version: "1.19"
golint:
min-confidence: 0.9
govet:
check-shadowing: true
enable:
- "fieldalignment"
gocyclo:
min-complexity: 15
min-complexity: 10
gocognit:
min-complexity: 31
funlen:
lines: 70
cyclop:
max-complexity: 12
max-complexity: 10

issues:
exclude-rules:
Expand All @@ -45,3 +40,7 @@ issues:
- goimports
- gofmt
- unparam
- exhaustivestruct
- exhaustruct
- gocyclo
- cyclop
4 changes: 2 additions & 2 deletions gpu-aware-scheduling/Makefile
Expand Up @@ -2,7 +2,7 @@ ifneq ($(TAG),)
IMAGE_TAG=:$(TAG)
endif

GOLICENSES_VERSION?=v1.5.0
GOLICENSES_VERSION?=v1.6.0
BUILD_OUTPUT_DIR?=./bin

ifneq ("$(wildcard licenses/)","")
Expand Down Expand Up @@ -40,7 +40,7 @@ image:
-f deploy/images/Dockerfile_gpu-extender ../ -t $(IMAGE_PATH)gpu-extender$(IMAGE_TAG)

release-image: clean
docker build --build-arg GOLICENSES_VERSION=$(GOLICENSES_IN_GO_MOD) -f deploy/images/Dockerfile_gpu-extender ../ \
docker build --build-arg GOLICENSES_VERSION=$(GOLICENSES_VERSION) -f deploy/images/Dockerfile_gpu-extender ../ \
-t $(IMAGE_PATH)gpu-extender$(IMAGE_TAG)

format:
Expand Down
8 changes: 4 additions & 4 deletions gpu-aware-scheduling/cmd/gas-scheduler-extender/main.go
Expand Up @@ -23,7 +23,7 @@ var (
)

const (
l1 = klog.Level(1)
logL1 = klog.Level(1)
defaultQPS = 5
defaultBurst = 10
maxQPSandBurst = 1000
Expand All @@ -44,12 +44,13 @@ func main() {
flag.BoolVar(&enableAllowlist, "enableAllowlist", false, "enable allowed GPUs annotation (csv list of names)")
flag.BoolVar(&enableDenylist, "enableDenylist", false, "enable denied GPUs annotation (csv list of names)")
flag.StringVar(&balancedRes, "balancedResource", "", "enable resource balacing within a node")
flag.UintVar(&burst, "burst", defaultBurst, fmt.Sprintf("burst value used with kube client (limited to %d)", maxQPSandBurst))
flag.UintVar(&burst, "burst", defaultBurst, fmt.Sprintf("burst value used with kube client (limited to %d)",
maxQPSandBurst))
flag.UintVar(&qps, "qps", defaultQPS, fmt.Sprintf("qps value used with kube client (limited to %d)", maxQPSandBurst))
klog.InitFlags(nil)
flag.Parse()

klog.V(l1).Infof("%s built on %s with go %s", version, buildDate, goVersion)
klog.V(logL1).Infof("%s built on %s with go %s", version, buildDate, goVersion)

for _, ptr := range []*uint{&qps, &burst} {
if *ptr > maxQPSandBurst {
Expand All @@ -59,7 +60,6 @@ func main() {
}

kubeClient, _, err := extender.GetKubeClientExt(kubeConfig, int(burst), float32(qps))

if err != nil {
klog.Error("couldn't get kube client, cannot continue: ", err.Error())
os.Exit(1)
Expand Down
45 changes: 24 additions & 21 deletions gpu-aware-scheduling/go.mod
Expand Up @@ -5,29 +5,30 @@ go 1.19
require (
github.com/intel/platform-aware-scheduling/extender v0.5.0
github.com/pkg/errors v0.9.1
github.com/smartystreets/goconvey v1.7.2
github.com/stretchr/testify v1.8.1
k8s.io/api v0.26.0
k8s.io/apimachinery v0.26.0
k8s.io/client-go v0.26.0
k8s.io/klog/v2 v2.80.1
github.com/smartystreets/goconvey v1.8.0
github.com/stretchr/testify v1.8.3
k8s.io/api v0.27.2
k8s.io/apimachinery v0.27.2
k8s.io/client-go v0.27.2
k8s.io/klog/v2 v2.100.1
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.10.1 // indirect
github.com/emicklei/go-restful/v3 v3.10.2 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.20.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic v0.6.9 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gopherjs/gopherjs v1.17.2 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/imdario/mergo v0.3.15 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/jtolds/gls v4.20.0+incompatible // indirect
Expand All @@ -36,22 +37,24 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/smartystreets/assertions v1.13.0 // indirect
github.com/smartystreets/assertions v1.13.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.5.0 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/oauth2 v0.3.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/term v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
golang.org/x/mod v0.10.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/term v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.9.1 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.28.1 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/kube-openapi v0.0.0-20221207184640-f3cff1453715 // indirect
k8s.io/utils v0.0.0-20221128185143-99ec85e7a448 // indirect
k8s.io/kube-openapi v0.0.0-20230525220651-2546d827e515 // indirect
k8s.io/utils v0.0.0-20230505201702-9f6742963106 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
Expand Down

0 comments on commit 1e2274b

Please sign in to comment.