Skip to content

Commit

Permalink
update requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
CMGS committed Jan 5, 2024
1 parent ce65507 commit c8b84e2
Show file tree
Hide file tree
Showing 6 changed files with 180 additions and 452 deletions.
6 changes: 3 additions & 3 deletions engine/docker/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

dockertypes "github.com/docker/docker/api/types"
dockerfilters "github.com/docker/docker/api/types/filters"

registrytypes "github.com/docker/docker/api/types/registry"
enginetypes "github.com/projecteru2/core/engine/types"
)

Expand Down Expand Up @@ -86,14 +86,14 @@ func (e *Engine) ImagePush(ctx context.Context, ref string) (io.ReadCloser, erro

// ImageBuild build image
func (e *Engine) ImageBuild(ctx context.Context, input io.Reader, refs []string, platform string) (io.ReadCloser, error) {
authConfigs := map[string]dockertypes.AuthConfig{}
authConfigs := map[string]registrytypes.AuthConfig{}
for domain, conf := range e.config.Docker.AuthConfigs {
b64auth, err := encodeAuthToBase64(conf)
if err != nil {
return nil, err
}
if _, ok := authConfigs[domain]; !ok {
authConfigs[domain] = dockertypes.AuthConfig{
authConfigs[domain] = registrytypes.AuthConfig{
Username: conf.Username,
Password: conf.Password,
Auth: b64auth,
Expand Down
27 changes: 13 additions & 14 deletions engine/factory/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ func NewEngineCache(config types.Config, stor store.Store) *EngineCache {
}

// InitEngineCache init engine cache and start engine cache checker
func InitEngineCache(ctx context.Context, config types.Config, sto store.Store) {
engineCache = NewEngineCache(config, sto)
func InitEngineCache(ctx context.Context, config types.Config, stor store.Store) {
engineCache = NewEngineCache(config, stor)
// init the cache, we don't care the return values
if sto != nil {
if stor != nil {
_, _ = engineCache.stor.GetNodesByPod(ctx, &types.NodeFilter{
All: true,
})
Expand Down Expand Up @@ -166,16 +166,16 @@ func (e *EngineCache) CheckNodeStatus(ctx context.Context) {
if _, err := e.stor.GetNode(ctx, ns.Nodename); err != nil {
logger.Warnf(ctx, "failed to get node %s: %s", ns.Nodename, err)
}
} else {
// a node may have multiple engines, so we need check all key here
e.keysToCheck.ForEach(func(k string, ep engineParams) bool {
if ep.nodename == ns.Nodename {
logger.Infof(ctx, "remove engine %+v from cache", ep.getCacheKey())
RemoveEngineFromCache(ctx, ep.endpoint, ep.ca, ep.cert, ep.key)
}
return true
})
continue
}
// a node may have multiple engines, so we need check all key here
e.keysToCheck.ForEach(func(k string, ep engineParams) bool {
if ep.nodename == ns.Nodename {
logger.Infof(ctx, "remove engine %+v from cache", ep.getCacheKey())
RemoveEngineFromCache(ctx, ep.endpoint, ep.ca, ep.cert, ep.key)
}
return true
})
}
}
}
Expand Down Expand Up @@ -282,8 +282,7 @@ func (e *EngineCache) checkOneNodeStatus(ctx context.Context, params *enginePara
logger := log.WithFunc("engine.factory.checkOneNodeStatus")
nodename := params.nodename
cacheKey := params.getCacheKey()
ns, err := e.stor.GetNodeStatus(ctx, nodename)
if (err != nil && errors.Is(err, types.ErrInvaildCount)) || (!ns.Alive) {
if ns, err := e.stor.GetNodeStatus(ctx, nodename); (err != nil && errors.Is(err, types.ErrInvaildCount)) || (!ns.Alive) {
logger.Warnf(ctx, "node %s is offline, the cache will be removed", nodename)
e.Delete(cacheKey)
}
Expand Down
89 changes: 46 additions & 43 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ require (
github.com/cenkalti/backoff/v4 v4.2.1
github.com/cockroachdb/errors v1.9.1
github.com/docker/distribution v2.8.2+incompatible
github.com/docker/docker v23.0.4+incompatible
github.com/docker/docker v24.0.7+incompatible
github.com/docker/go-connections v0.4.0
github.com/docker/go-units v0.5.0
github.com/getsentry/sentry-go v0.20.0
github.com/go-git/go-git/v5 v5.6.1
github.com/go-git/go-git/v5 v5.11.0
github.com/go-ping/ping v1.1.0
github.com/go-redis/redis/v8 v8.11.5
github.com/google/uuid v1.3.0
github.com/google/uuid v1.3.1
github.com/jinzhu/configor v1.2.1
github.com/mitchellh/mapstructure v1.5.0
github.com/muroq/redislock v0.0.0-20210327061935-5425e33e6f9f
Expand All @@ -29,30 +29,30 @@ require (
github.com/prometheus/client_model v0.3.0
github.com/rs/zerolog v1.29.1
github.com/sanity-io/litter v1.5.5
github.com/stretchr/testify v1.8.2
github.com/stretchr/testify v1.8.4
github.com/urfave/cli/v2 v2.25.1
go.etcd.io/bbolt v1.3.7
go.etcd.io/etcd/api/v3 v3.5.8
go.etcd.io/etcd/client/pkg/v3 v3.5.8
go.etcd.io/etcd/client/v3 v3.5.8
go.etcd.io/etcd/tests/v3 v3.5.8
go.etcd.io/bbolt v1.3.8
go.etcd.io/etcd/api/v3 v3.5.11
go.etcd.io/etcd/client/pkg/v3 v3.5.11
go.etcd.io/etcd/client/v3 v3.5.11
go.etcd.io/etcd/tests/v3 v3.5.11
go.uber.org/automaxprocs v1.5.2
go.uber.org/zap v1.24.0
golang.org/x/crypto v0.14.0
golang.org/x/crypto v0.17.0
golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53
golang.org/x/net v0.17.0
golang.org/x/sync v0.1.0
google.golang.org/grpc v1.54.1
google.golang.org/protobuf v1.30.0
golang.org/x/net v0.19.0
golang.org/x/sync v0.4.0
google.golang.org/grpc v1.60.1
google.golang.org/protobuf v1.31.0
gopkg.in/natefinch/lumberjack.v2 v2.2.1
)

require (
dario.cat/mergo v1.0.0 // 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.1 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230424174541-a2e3b023bd29 // indirect
github.com/acomagu/bufpipe v1.0.4 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect
github.com/alexcesaro/statsd v2.0.0+incompatible // indirect
github.com/alicebob/gopher-json v0.0.0-20230218143504-906a9b012302 // indirect
github.com/benbjohnson/clock v1.3.3 // indirect
Expand All @@ -61,19 +61,20 @@ require (
github.com/cloudflare/circl v1.3.3 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/redact v1.1.3 // indirect
github.com/containerd/containerd v1.7.0 // indirect
github.com/containerd/containerd v1.7.11 // indirect
github.com/coreos/go-semver v0.3.1 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/docker/go-metrics v0.0.1 // indirect
github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/go-git/gcfg v1.5.0 // indirect
github.com/go-git/go-billy/v5 v5.4.1 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.5.0 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
Expand All @@ -85,8 +86,7 @@ require (
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 // indirect
github.com/imdario/mergo v0.3.15 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jonboulle/clockwork v0.4.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
Expand All @@ -109,11 +109,11 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sergi/go-diff v1.3.1 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/skeema/knownhosts v1.1.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/skeema/knownhosts v1.2.1 // indirect
github.com/soheilhy/cmux v0.1.5 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.5.0 // indirect
Expand All @@ -122,30 +122,33 @@ require (
github.com/xiang90/probing v0.0.0-20221125231312-a49e3df8f510 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
github.com/yuin/gopher-lua v1.1.0 // indirect
go.etcd.io/etcd/client/v2 v2.305.8 // indirect
go.etcd.io/etcd/pkg/v3 v3.5.8 // indirect
go.etcd.io/etcd/raft/v3 v3.5.8 // indirect
go.etcd.io/etcd/server/v3 v3.5.8 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.40.0 // indirect
go.opentelemetry.io/otel v1.14.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.14.0 // indirect
go.opentelemetry.io/otel/metric v0.37.0 // indirect
go.opentelemetry.io/otel/sdk v1.14.0 // indirect
go.opentelemetry.io/otel/trace v1.14.0 // indirect
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
go.etcd.io/etcd/client/v2 v2.305.11 // indirect
go.etcd.io/etcd/pkg/v3 v3.5.11 // indirect
go.etcd.io/etcd/raft/v3 v3.5.11 // indirect
go.etcd.io/etcd/server/v3 v3.5.11 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 // indirect
go.opentelemetry.io/otel v1.20.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 // indirect
go.opentelemetry.io/otel/metric v1.20.0 // indirect
go.opentelemetry.io/otel/sdk v1.20.0 // indirect
go.opentelemetry.io/otel/trace v1.20.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/mod v0.10.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.8.0 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
golang.org/x/tools v0.13.0 // indirect
google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gotest.tools/v3 v3.4.0 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)

replace google.golang.org/grpc/test/grpc_testing => google.golang.org/grpc/interop/grpc_testing v1.60.1
Loading

0 comments on commit c8b84e2

Please sign in to comment.