Skip to content

Commit

Permalink
fix(*): fix lint errors for katalyst
Browse files Browse the repository at this point in the history
  • Loading branch information
waynepeking348 committed Apr 11, 2023
1 parent cd0d9b4 commit ad413c9
Show file tree
Hide file tree
Showing 82 changed files with 220 additions and 162 deletions.
5 changes: 3 additions & 2 deletions cmd/base/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"net/http/pprof"
"time"

"github.com/prometheus/client_golang/prometheus/promhttp"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/client-go/dynamic/dynamicinformer"
Expand All @@ -40,7 +41,6 @@ import (
"github.com/kubewharf/katalyst-core/pkg/util/general"
"github.com/kubewharf/katalyst-core/pkg/util/native"
"github.com/kubewharf/katalyst-core/pkg/util/process"
"github.com/prometheus/client_golang/prometheus/promhttp"
)

const (
Expand All @@ -55,7 +55,8 @@ type GenericContext struct {
httpHandler *process.HTTPHandler
healthChecker *HealthzChecker

// those following components are shared by all generic components
// those following components are shared by all generic components.
//nolint
BroadcastAdapter events.EventBroadcasterAdapter
Client *client.GenericClientSet
EmitterPool metricspool.MetricsEmitterPool
Expand Down
2 changes: 1 addition & 1 deletion cmd/base/options/generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import (

"k8s.io/apimachinery/pkg/util/errors"
cliflag "k8s.io/component-base/cli/flag"
componentbaseconfig "k8s.io/component-base/config"
"k8s.io/klog/v2"

"github.com/kubewharf/katalyst-core/pkg/config/generic"
"github.com/kubewharf/katalyst-core/pkg/util/process"
componentbaseconfig "k8s.io/component-base/config"
)

// GenericOptions holds the configurations for multi components.
Expand Down
3 changes: 2 additions & 1 deletion cmd/katalyst-controller/app/options/lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ package options
import (
"time"

"github.com/kubewharf/katalyst-core/pkg/config/controller"
cliflag "k8s.io/component-base/cli/flag"

"github.com/kubewharf/katalyst-core/pkg/config/controller"
)

// LifeCycleOptions holds the configurations for life cycle.
Expand Down
3 changes: 2 additions & 1 deletion cmd/katalyst-controller/app/options/spd.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ import (
"fmt"
"time"

"github.com/kubewharf/katalyst-core/pkg/config/controller"
cliflag "k8s.io/component-base/cli/flag"

"github.com/kubewharf/katalyst-core/pkg/config/controller"
)

// SPDOptions holds the configurations for service profile data.
Expand Down
5 changes: 4 additions & 1 deletion cmd/katalyst-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ func main() {
for _, f := range fss.FlagSets {
commandLine.AddFlagSet(f)
}
commandLine.Parse(os.Args[1:])
if err := commandLine.Parse(os.Args[1:]); err != nil {
fmt.Printf("parse command error: %v\n", err)
os.Exit(1)
}

rand.Seed(time.Now().UnixNano())
if err := app.Run(opt); err != nil {
Expand Down
3 changes: 2 additions & 1 deletion cmd/katalyst-metric/app/options/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ package options

import (
"fmt"
"k8s.io/apimachinery/pkg/labels"
"time"

"k8s.io/apimachinery/pkg/labels"

cliflag "k8s.io/component-base/cli/flag"

"github.com/kubewharf/katalyst-core/pkg/config/metric"
Expand Down
5 changes: 5 additions & 0 deletions cmd/katalyst-metric/app/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"time"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/errors"
cliflag "k8s.io/component-base/cli/flag"
election "k8s.io/component-base/config"

Expand Down Expand Up @@ -129,6 +130,10 @@ func (o *Options) ApplyTo(c *config.Configuration) error {
errList = append(errList, o.StoreOptions.ApplyTo(c.StoreConfiguration))
errList = append(errList, o.ProviderOptions.ApplyTo(c.ProviderConfiguration))
errList = append(errList, o.CollectorOptions.ApplyTo(c.CollectorConfiguration))

if len(errList) > 0 {
return errors.NewAggregate(errList)
}
return nil
}

Expand Down
1 change: 1 addition & 0 deletions cmd/katalyst-metric/app/options/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package options

import (
"fmt"

"k8s.io/apimachinery/pkg/labels"
cliflag "k8s.io/component-base/cli/flag"

Expand Down
5 changes: 4 additions & 1 deletion cmd/katalyst-metric/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ func main() {
for _, f := range fss.FlagSets {
commandLine.AddFlagSet(f)
}
commandLine.Parse(os.Args[1:])
if err := commandLine.Parse(os.Args[1:]); err != nil {
fmt.Printf("parse command error: %v\n", err)
os.Exit(1)
}

rand.Seed(time.Now().UnixNano())
if err := app.Run(opt); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/katalyst-scheduler/app/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (o *Options) Config() (*schedulerappconfig.Config, *generic.QoSConfiguratio
}

qosConfig := generic.NewQoSConfiguration()
if o.QoSOptions.ApplyTo(qosConfig); err != nil {
if err = o.QoSOptions.ApplyTo(qosConfig); err != nil {
return nil, nil, err
}

Expand Down
1 change: 1 addition & 0 deletions cmd/katalyst-scheduler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (

"github.com/kubewharf/katalyst-core/cmd/katalyst-scheduler/app"
"github.com/kubewharf/katalyst-core/pkg/scheduler/plugins/qosawarenoderesources"

// Ensure scheme package is initialized.
_ "github.com/kubewharf/katalyst-api/pkg/apis/scheduling/config/scheme"
)
Expand Down
3 changes: 2 additions & 1 deletion cmd/katalyst-webhook/app/options/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ package options
import (
"fmt"

"github.com/kubewharf/katalyst-core/pkg/config/webhook"
cliflag "k8s.io/component-base/cli/flag"

"github.com/kubewharf/katalyst-core/pkg/config/webhook"
)

// PodOptions holds the configurations for Pod webhook.
Expand Down
3 changes: 2 additions & 1 deletion cmd/katalyst-webhook/app/options/vpa.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ limitations under the License.
package options

import (
"github.com/kubewharf/katalyst-core/pkg/config/webhook"
cliflag "k8s.io/component-base/cli/flag"

"github.com/kubewharf/katalyst-core/pkg/config/webhook"
)

// VPAOptions holds the configurations for VPA webhook.
Expand Down
5 changes: 4 additions & 1 deletion cmd/katalyst-webhook/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ func main() {
for _, f := range fss.FlagSets {
commandLine.AddFlagSet(f)
}
commandLine.Parse(os.Args[1:])
if err := commandLine.Parse(os.Args[1:]); err != nil {
fmt.Printf("parse command error: %v\n", err)
os.Exit(1)
}

rand.Seed(time.Now().UnixNano())
if err := app.Run(opt); err != nil {
Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ require (
go.opentelemetry.io/otel/sdk/export/metric v0.20.0
go.opentelemetry.io/otel/sdk/metric v0.20.0
go.uber.org/atomic v1.7.0
golang.org/x/sys v0.3.0
golang.org/x/sys v0.7.0
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8
google.golang.org/grpc v1.51.0
k8s.io/api v0.24.6
Expand Down Expand Up @@ -113,11 +113,11 @@ require (
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.19.1 // indirect
golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd // indirect
golang.org/x/net v0.3.1-0.20221206200815-1e63c2f08a10 // indirect
golang.org/x/net v0.9.0 // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect
golang.org/x/term v0.3.0 // indirect
golang.org/x/text v0.5.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/term v0.7.0 // indirect
golang.org/x/text v0.9.0 // indirect
gomodules.xyz/jsonpatch/v3 v3.0.1 // indirect
gomodules.xyz/orderedmap v0.1.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
Expand Down
21 changes: 16 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,7 @@ golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -1093,8 +1094,10 @@ golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qx
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.3.1-0.20221206200815-1e63c2f08a10 h1:Frnccbp+ok2GkUS2tC84yAq/U9Vg+0sIO7aRL3T4Xnc=
golang.org/x/net v0.3.1-0.20221206200815-1e63c2f08a10/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM=
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -1123,8 +1126,9 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down Expand Up @@ -1218,13 +1222,17 @@ golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ=
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.3.0 h1:qoo4akIqOcDME5bhc/NgxUdovd6BSS2uMsVjB56q1xI=
golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.7.0 h1:BEvjmm5fURWqcfbSKTdpkDXYBrUS1c0m8agp14W48vQ=
golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand All @@ -1235,8 +1243,10 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM=
golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down Expand Up @@ -1331,6 +1341,7 @@ golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.10-0.20220218145154-897bd77cd717/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E=
golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
2 changes: 1 addition & 1 deletion pkg/agent/evictionmanager/endpoint/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ import (
"sync"
"time"

"google.golang.org/grpc"
"k8s.io/klog/v2"

pluginapi "github.com/kubewharf/katalyst-api/pkg/protocol/evictionplugin/v1alpha1"
"github.com/kubewharf/katalyst-core/pkg/consts"
"github.com/kubewharf/katalyst-core/pkg/util/process"
"google.golang.org/grpc"
)

const (
Expand Down
7 changes: 4 additions & 3 deletions pkg/agent/evictionmanager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ import (
"sync"
"time"

//nolint
"github.com/golang/protobuf/proto"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/clock"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/tools/events"
"k8s.io/klog/v2"
clocks "k8s.io/utils/clock"

"github.com/kubewharf/katalyst-api/pkg/apis/node/v1alpha1"
"github.com/kubewharf/katalyst-api/pkg/plugins/registration"
Expand Down Expand Up @@ -71,7 +72,7 @@ type EvictionManger struct {

// clock is an interface that provides time related functionality in a way that makes it
// easy to test the code.
clock clock.Clock
clock clocks.WithTickerAndDelayedExecution

podKiller podkiller.PodKiller

Expand Down Expand Up @@ -132,7 +133,7 @@ func NewEvictionManager(genericClient *client.GenericClientSet, recorder events.
conditions: make(map[string]*pluginapi.Condition),
conditionsLastObservedAt: make(map[string]conditionObservedAt),
thresholdsFirstObservedAt: make(map[string]thresholdObservedAt),
clock: clock.RealClock{},
clock: clocks.RealClock{},
genericClient: genericClient,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (a *cpuAccumulator) freeCores() []int {
return free
}

// freeCPUs eturns free CPU IDs as a slice sorted by sortAvailableCPUs().
// freeCPUs returns free CPU IDs as a slice sorted by sortAvailableCPUs().
func (a *cpuAccumulator) freeCPUs() []int {
return a.sortAvailableCPUs()
}
Expand Down
11 changes: 6 additions & 5 deletions pkg/agent/qrm-plugins/cpu/dynamicpolicy/cpuadvisor/cpu.pb.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,19 @@ package cpuadvisor
import (
context "context"
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
reflect "reflect"
strings "strings"

_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
io "io"
v1alpha1 "k8s.io/kubelet/pkg/apis/resourceplugin/v1alpha1"
math "math"
math_bits "math/bits"
reflect "reflect"
strings "strings"
)

// Reference imports to suppress errors if they are not otherwise used.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ import (

func TestClientAddContainer(t *testing.T) {
client := NewCPUAdvisorClientStub()
client.AddContainer(context.Background(), &AddContainerRequest{})
_, _ = client.AddContainer(context.Background(), &AddContainerRequest{})
}

func TestClientRemovePod(t *testing.T) {
client := NewCPUAdvisorClientStub()
client.RemovePod(context.Background(), &RemovePodRequest{})
_, _ = client.RemovePod(context.Background(), &RemovePodRequest{})
}

func TestClientListAndWatch(t *testing.T) {
client := NewCPUAdvisorClientStub()
client.ListAndWatch(context.Background(), &Empty{})
_, _ = client.ListAndWatch(context.Background(), &Empty{})
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ import (
pluginapi "k8s.io/kubelet/pkg/apis/resourceplugin/v1alpha1"
maputil "k8s.io/kubernetes/pkg/util/maps"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

apiconsts "github.com/kubewharf/katalyst-api/pkg/consts"
evictionpluginapi "github.com/kubewharf/katalyst-api/pkg/protocol/evictionplugin/v1alpha1"
"github.com/kubewharf/katalyst-core/pkg/agent/qrm-plugins/cpu/dynamicpolicy/state"
Expand All @@ -41,8 +44,6 @@ import (
"github.com/kubewharf/katalyst-core/pkg/metaserver/agent/metric"
"github.com/kubewharf/katalyst-core/pkg/metrics"
"github.com/kubewharf/katalyst-core/pkg/util/machine"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

var (
Expand Down
Loading

0 comments on commit ad413c9

Please sign in to comment.