Skip to content

Commit

Permalink
upgrade to latest etcd
Browse files Browse the repository at this point in the history
  • Loading branch information
CMGS committed Jun 17, 2021
1 parent 653d157 commit 8d0810d
Show file tree
Hide file tree
Showing 43 changed files with 3,784 additions and 3,593 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ jobs:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.31
version: v1.41
# Optional: show only new issues if it's a pull request. The default value is `false`.
only-new-issues: true
2 changes: 1 addition & 1 deletion .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.15
go-version: 1.16

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
Expand Down
13 changes: 9 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ run:
skip-dirs:
- vendor
- tools
- 3rdmocks
modules-download-mode: readonly

linters-settings:
Expand All @@ -25,18 +26,23 @@ linters:
- gocyclo
- gofmt
- goimports
- golint
# golint is replaced by revive
# - golint
- revive
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- interfacer
# interfacer is deprecated
# - interfacer
- misspell
- nakedret
- nolintlint
- rowserrcheck
- scopelint
# scopelint is replaced by exportloopref
# - scopelint
- exportloopref
- staticcheck
- structcheck
- typecheck
Expand All @@ -48,7 +54,6 @@ linters:
- nestif
- errcheck
- gocritic
- exportloopref
#- gocognit
#- gomnd
#- dupl
Expand Down
11 changes: 7 additions & 4 deletions 3rdmocks/grpc.go → 3rdmocks/ServerStream.go

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

11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ ifneq ($(KEEP_SYMBOL), 1)
endif

grpc:
protoc --proto_path=./rpc/gen --go_out=plugins=grpc:./rpc/gen --go_opt=module=github.com/projecteru2/core/rpc/gen core.proto
protoc --go_out=. --go-grpc_out=. \
--go_opt=paths=source_relative \
--go-grpc_opt=require_unimplemented_servers=false,paths=source_relative \
./rpc/gen/core.proto

deps:
env GO111MODULE=on go mod download
Expand All @@ -26,13 +29,15 @@ build: deps binary
test: deps unit-test

mock: deps
mockery --dir ./vendor/google.golang.org/grpc --name ServerStream --output 3rdmocks
mockery --dir vendor/github.com/docker/docker/client --name APIClient --output engine/docker/mocks
mockery --dir vendor/google.golang.org/grpc --output 3rdmocks --name ServerStream
mockery --dir vendor/github.com/docker/docker/client --output engine/docker/mocks --name APIClient
mockery --dir scheduler --output scheduler/mocks --name Scheduler
mockery --dir source --output source/mocks --name Source
mockery --dir store --output store/mocks --name Store
mockery --dir cluster --output cluster/mocks --name Cluster
mockery --dir lock --output lock/mocks --name DistributedLock
mockery --dir store/etcdv3/meta --output store/etcdv3/meta/mocks --all
mockery --dir vendor/go.etcd.io/etcd/client/v3 --output store/etcdv3/meta/mocks --name Txn
mockery --dir rpc/gen/ --output rpc/mocks --name CoreRPC_RunAndWaitServer

.ONESHELL:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Generate golang grpc definitions.

```shell
go get -u github.com/golang/protobuf/{proto,protoc-gen-go}
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
make grpc
```

Expand Down
2 changes: 1 addition & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func dial(ctx context.Context, addr string, authConfig types.AuthConfig) (*grpc.
opts := []grpc.DialOption{
grpc.WithInsecure(),
grpc.WithKeepaliveParams(keepalive.ClientParameters{Time: 6 * 60 * time.Second, Timeout: time.Second}),
grpc.WithBalancerName("round_robin"), // nolintlint
grpc.WithBalancerName("round_robin"), // nolint
grpc.WithUnaryInterceptor(interceptor.NewUnaryRetry(interceptor.RetryOptions{Max: 1})),
grpc.WithStreamInterceptor(interceptor.NewStreamRetry(interceptor.RetryOptions{Max: 1})),
}
Expand Down
4 changes: 2 additions & 2 deletions client/resolver/eru/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func New(cc resolver.ClientConn, endpoint string, authority string) *Resolver {
cc: cc,
discovery: servicediscovery.New(endpoint, authConfig),
}
cc.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: endpoint}}})
cc.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: endpoint}}}) // nolint
go r.sync()
return r
}
Expand Down Expand Up @@ -69,7 +69,7 @@ func (r *Resolver) sync() {
for _, ep := range endpoints {
addresses = append(addresses, resolver.Address{Addr: ep})
}
r.cc.UpdateState(resolver.State{Addresses: addresses})
r.cc.UpdateState(resolver.State{Addresses: addresses}) // nolint
}
}

Expand Down
2 changes: 1 addition & 1 deletion client/resolver/static/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func New(cc resolver.ClientConn, endpoints string) *Resolver {
for _, ep := range strings.Split(endpoints, ",") {
addresses = append(addresses, resolver.Address{Addr: ep})
}
cc.UpdateState(resolver.State{Addresses: addresses})
cc.UpdateState(resolver.State{Addresses: addresses}) // nolint
return &Resolver{
cc: cc,
addresses: addresses,
Expand Down
2 changes: 1 addition & 1 deletion client/servicediscovery/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (r *lbResolver) updateAddresses(endpoints ...string) {
for _, ep := range endpoints {
addresses = append(addresses, resolver.Address{Addr: ep})
}
r.cc.UpdateState(resolver.State{Addresses: addresses})
r.cc.UpdateState(resolver.State{Addresses: addresses}) // nolint
}

func (r *lbResolver) ResolveNow(_ resolver.ResolveNowOptions) {}
Expand Down
2 changes: 1 addition & 1 deletion cluster/calcium/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ func (c *Calcium) doMakeWorkloadOptions(ctx context.Context, no int, msg *types.
// extra args is dynamically
config.Cmd = opts.Entrypoint.Commands
// env
env := append(opts.Env, fmt.Sprintf("APP_NAME=%s", opts.Name))
env := append(opts.Env, fmt.Sprintf("APP_NAME=%s", opts.Name)) // nolint
env = append(env, fmt.Sprintf("ERU_POD=%s", opts.Podname))
env = append(env, fmt.Sprintf("ERU_NODE_NAME=%s", node.Name))
env = append(env, fmt.Sprintf("ERU_WORKLOAD_SEQ=%d", no))
Expand Down
2 changes: 1 addition & 1 deletion cluster/mocks/Cluster.go

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

6 changes: 2 additions & 4 deletions discovery/helium/helium.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@ func (h *Helium) start(ctx context.Context) {
go func() {
log.Info("[WatchServiceStatus] service discovery start")
defer log.Error("[WatchServiceStatus] service discovery exited")
var (
latestStatus types.ServiceStatus
timer *time.Timer = time.NewTimer(h.config.ServiceDiscoveryPushInterval)
)
var latestStatus types.ServiceStatus
timer := time.NewTimer(h.config.ServiceDiscoveryPushInterval)
for {
select {
case addresses, ok := <-ch:
Expand Down
2 changes: 1 addition & 1 deletion engine/docker/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type RawArgs struct {
}

// VirtualizationCreate create a workload
func (e *Engine) VirtualizationCreate(ctx context.Context, opts *enginetypes.VirtualizationCreateOptions) (*enginetypes.VirtualizationCreated, error) { // nolintlint
func (e *Engine) VirtualizationCreate(ctx context.Context, opts *enginetypes.VirtualizationCreateOptions) (*enginetypes.VirtualizationCreated, error) { // nolint
r := &enginetypes.VirtualizationCreated{}
// memory should more than 4MiB
if opts.Memory > 0 && opts.Memory < minMemory || opts.Memory < 0 {
Expand Down
2 changes: 1 addition & 1 deletion engine/docker/mocks/APIClient.go

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

26 changes: 13 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/projecteru2/core

go 1.14
go 1.16

require (
github.com/CMGS/statsd v0.0.0-20160223095033-48c421b3c1ab
Expand All @@ -10,7 +10,6 @@ require (
github.com/cenkalti/backoff/v4 v4.0.2
github.com/containerd/containerd v1.4.3 // indirect
github.com/containerd/continuity v0.0.0-20200710164510-efbc4488d8fe // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/docker/distribution v2.7.1+incompatible
github.com/docker/docker v20.10.0+incompatible
github.com/docker/go-connections v0.4.0
Expand All @@ -21,7 +20,6 @@ require (
github.com/go-git/go-git/v5 v5.2.0
github.com/go-ping/ping v0.0.0-20210407214646-e4e642a95741
github.com/go-redis/redis/v8 v8.8.2
github.com/golang/protobuf v1.4.2
github.com/google/uuid v1.1.2
github.com/gorilla/mux v1.7.4 // indirect
github.com/jinzhu/configor v1.2.0
Expand All @@ -35,19 +33,21 @@ require (
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/pkg/errors v0.9.1
github.com/projecteru2/libyavirt v0.0.0-20210514093713-959b2e232319
github.com/prometheus/client_golang v1.7.1
github.com/prometheus/client_golang v1.11.0
github.com/sanity-io/litter v1.3.0
github.com/sethvargo/go-signalcontext v0.1.0
github.com/sirupsen/logrus v1.6.0
github.com/sirupsen/logrus v1.7.0
github.com/stretchr/testify v1.7.0
github.com/urfave/cli/v2 v2.2.0
go.etcd.io/bbolt v1.3.5
go.etcd.io/etcd/v3 v3.3.0-rc.0.0.20200925060232-add86bbd1a7a
go.etcd.io/bbolt v1.3.6
go.etcd.io/etcd/api/v3 v3.5.0
go.etcd.io/etcd/client/pkg/v3 v3.5.0
go.etcd.io/etcd/client/v3 v3.5.0
go.etcd.io/etcd/tests/v3 v3.5.0
go.uber.org/automaxprocs v1.3.0
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de
golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9
google.golang.org/grpc v1.29.1
google.golang.org/protobuf v1.25.0
gopkg.in/alexcesaro/statsd.v2 v2.0.0 // indirect
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
google.golang.org/grpc v1.38.0
google.golang.org/protobuf v1.26.0
)
Loading

0 comments on commit 8d0810d

Please sign in to comment.