Skip to content

Commit

Permalink
use latest core
Browse files Browse the repository at this point in the history
  • Loading branch information
CMGS committed Feb 6, 2023
1 parent 5c916d9 commit 8ff3a5d
Show file tree
Hide file tree
Showing 6 changed files with 151 additions and 1,009 deletions.
46 changes: 23 additions & 23 deletions cmd/node/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,29 +134,29 @@ func Command() *cli.Command {
this value can be set multiple times, the index will be the numa node ID,
e.g. --numa-memory 10G --numa-memory 15G, means node ID 0 will be 10GB, node ID 1 will be 15GB`,
},
// &cli.StringFlag{
// Name: "storage",
// Usage: `storage, unit can be K/M/G/T,
// when using --delta flag, this can be a negtive number indicating how much to add to the current value,
// e.g. --storage -10G --delta, means storage will be the current value - 10`,
// },
// &cli.StringSliceFlag{
// Name: "volume",
// Usage: `volume value in string, can set multiple times. e.g. "--volume /data:100G",
// when using --delta flag, this can be a negative number indicating how much to add to the current value,
// e.g. --volume /data0:-10G --volume /data1:20G, means /data0 will be subtract 10G and /data1 will be added 20G`,
// },
// &cli.StringSliceFlag{
// Name: "disk",
// Usage: `disk value in string, format: device:mounts:read-iops:write-iops:read-bps:write-bps
// e.g. --disk /dev/sda1:/data0:100:100:100M:100M
// when using --delta flag, this can be a negative number indicating how much to add to the current value`,
// },
// &cli.StringFlag{
// Name: "rm-disk",
// Usage: `remove disks, e.g. --rm-disk /dev/vda,/dev/vdb
// rm-disk is not supported in delta mode`,
// },
&cli.StringFlag{
Name: "storage",
Usage: `storage, unit can be K/M/G/T,
when using --delta flag, this can be a negtive number indicating how much to add to the current value,
e.g. --storage -10G --delta, means storage will be the current value - 10`,
},
&cli.StringSliceFlag{
Name: "volume",
Usage: `volume value in string, can set multiple times. e.g. "--volume /data:100G",
when using --delta flag, this can be a negative number indicating how much to add to the current value,
e.g. --volume /data0:-10G --volume /data1:20G, means /data0 will be subtract 10G and /data1 will be added 20G`,
},
&cli.StringSliceFlag{
Name: "disk",
Usage: `disk value in string, format: device:mounts:read-iops:write-iops:read-bps:write-bps
e.g. --disk /dev/sda1:/data0:100:100:100M:100M
when using --delta flag, this can be a negative number indicating how much to add to the current value`,
},
&cli.StringFlag{
Name: "rm-disk",
Usage: `remove disks, e.g. --rm-disk /dev/vda,/dev/vdb
rm-disk is not supported in delta mode`,
},
&cli.StringSliceFlag{
Name: "label",
Usage: "label for the node, can set multiple times, e.g. --label a=1 --label b=2",
Expand Down
5 changes: 2 additions & 3 deletions cmd/node/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ import (
)

type getNodeOptions struct {
client corepb.CoreRPCClient
plugins []string
name string
client corepb.CoreRPCClient
name string
}

func (o *getNodeOptions) run(ctx context.Context) error {
Expand Down
32 changes: 16 additions & 16 deletions cmd/node/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func generateSetNodeOptions(c *cli.Context, _ corepb.CoreRPCClient) (*corepb.Set
}

cpumem := resourcetypes.RawParams{}
// storage := resourcetypes.RawParams{}
storage := resourcetypes.RawParams{}

if c.IsSet("cpu") {
cpumem["cpu"] = c.String("cpu")
Expand All @@ -78,24 +78,24 @@ func generateSetNodeOptions(c *cli.Context, _ corepb.CoreRPCClient) (*corepb.Set
if c.IsSet("numa-memory") {
cpumem["numa-memory"] = c.StringSlice("numa-memory")
}
// if c.IsSet("disk") {
// storage["disks"] = c.StringSlice("disk")
// }
// if c.IsSet("storage") {
// storage["storage"] = c.String("storage")
// }
// if c.IsSet("volume") {
// storage["volumes"] = c.StringSlice("volume")
// }
// if c.IsSet("rm-disk") {
// storage["rm-disks"] = c.String("rm-disk")
// }
if c.IsSet("disk") {
storage["disks"] = c.StringSlice("disk")
}
if c.IsSet("storage") {
storage["storage"] = c.String("storage")
}
if c.IsSet("volume") {
storage["volumes"] = c.StringSlice("volume")
}
if c.IsSet("rm-disk") {
storage["rm-disks"] = c.String("rm-disk")
}

cb, _ := json.Marshal(cpumem)
// sb, _ := json.Marshal(storage)
sb, _ := json.Marshal(storage)
resources := map[string][]byte{
"cpumem": cb,
// "storage": sb,
"cpumem": cb,
"storage": sb,
}

return &corepb.SetNodeOptions{
Expand Down
2 changes: 1 addition & 1 deletion cmd/pod/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func attr(nr *corepb.NodeResource, name string) float64 {
if err != nil {
return 0.0
}
switch { //nolint
switch {
case name == "cpu":
return cr["cpu"]
case name == "memory":
Expand Down
72 changes: 34 additions & 38 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,81 +7,77 @@ require (
github.com/getlantern/deepcopy v0.0.0-20160317154340-7f45deb8130a
github.com/ghodss/yaml v1.0.0
github.com/google/uuid v1.3.0
github.com/jedib0t/go-pretty/v6 v6.0.6
github.com/jedib0t/go-pretty/v6 v6.4.4
github.com/juju/errors v1.0.0
github.com/pkg/term v1.1.0
github.com/projecteru2/core v0.0.0-20221101084940-0899829619a5
github.com/projecteru2/core v0.0.0-20230206041219-19ba952bf7a2
github.com/sethgrid/curse v0.0.0-20181231162520-d4ee583ebf0f
github.com/sethvargo/go-signalcontext v0.1.0
github.com/sethvargo/go-signalcontext v0.2.1
github.com/sirupsen/logrus v1.9.0
github.com/urfave/cli/v2 v2.23.7
golang.org/x/sys v0.2.0
github.com/urfave/cli/v2 v2.24.3
golang.org/x/sys v0.4.0
gopkg.in/yaml.v2 v2.4.0
)

require (
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/BurntSushi/toml v1.2.1 // indirect
github.com/Microsoft/go-winio v0.6.0 // indirect
github.com/Microsoft/hcsshim v0.9.6 // indirect
github.com/alphadose/haxmap v1.2.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.2.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/cockroachdb/errors v1.9.0 // indirect
github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cockroachdb/errors v1.9.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/redact v1.1.3 // indirect
github.com/containerd/cgroups v1.0.4 // indirect
github.com/containerd/containerd v1.6.13 // indirect
github.com/containerd/containerd v1.6.16 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/docker/distribution v2.8.1+incompatible // indirect
github.com/docker/docker v20.10.22+incompatible // indirect
github.com/docker/docker v23.0.0+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-metrics v0.0.1 // indirect
github.com/getsentry/sentry-go v0.16.0 // indirect
github.com/getsentry/sentry-go v0.17.0 // indirect
github.com/go-ping/ping v1.1.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/jinzhu/configor v1.2.1 // indirect
github.com/klauspost/compress v1.15.15 // indirect
github.com/kless/term v0.0.0-20161130133337-e551c64f56c0 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/moby/sys/mount v0.3.3 // indirect
github.com/moby/sys/mountinfo v0.6.2 // indirect
github.com/moby/term v0.0.0-20220808134915-39b0c02b01ae // indirect
github.com/moby/patternmatcher v0.5.0 // indirect
github.com/moby/sys/sequential v0.5.0 // indirect
github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0-rc2 // indirect
github.com/opencontainers/runc v1.1.4 // indirect
github.com/panjf2000/ants/v2 v2.7.0 // indirect
github.com/panjf2000/ants/v2 v2.7.1 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.13.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/rogpeppe/go-internal v1.8.1 // indirect
github.com/rs/zerolog v1.28.0 // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.39.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/rivo/uniseg v0.4.3 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
github.com/rs/zerolog v1.29.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/tredoe/term v0.0.0-20161130133337-e551c64f56c0 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
go.opencensus.io v0.23.0 // indirect
golang.org/x/exp v0.0.0-20221217163422-3c43f8badb15 // indirect
golang.org/x/mod v0.6.0 // indirect
golang.org/x/net v0.2.0 // indirect
golang.org/x/exp v0.0.0-20230203172020-98cc5a0785f9 // indirect
golang.org/x/mod v0.7.0 // indirect
golang.org/x/net v0.5.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/text v0.4.0 // indirect
golang.org/x/tools v0.2.0 // indirect
google.golang.org/genproto v0.0.0-20220930163606-c98284e70a91 // indirect
google.golang.org/grpc v1.50.0 // indirect
golang.org/x/text v0.6.0 // indirect
golang.org/x/tools v0.5.0 // indirect
google.golang.org/genproto v0.0.0-20230202175211-008b39050e57 // indirect
google.golang.org/grpc v1.52.3 // indirect
google.golang.org/protobuf v1.28.1 // indirect
)

replace github.com/projecteru2/core => /Users/cmgs/.go/src/github/projecteru2/core
Loading

0 comments on commit 8ff3a5d

Please sign in to comment.