Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
Merge pull request #1782 from egernst/debug-1781
Browse files Browse the repository at this point in the history
Revert shimv2, vendor commits
  • Loading branch information
ganeshmaharaj authored Jun 10, 2019
2 parents 64e5e21 + 7acdaa2 commit e4e5167
Show file tree
Hide file tree
Showing 105 changed files with 7,158 additions and 27,774 deletions.
32 changes: 11 additions & 21 deletions Gopkg.lock

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

10 changes: 3 additions & 7 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

[[constraint]]
name = "github.com/kata-containers/agent"
revision = "714bf625cc68505f31d802f98b84bf2b8006e146"
revision = "48dd1c031530fce9bf16b0f6a7305979cedd8fc9"

[[constraint]]
name = "github.com/containerd/cri-containerd"
Expand All @@ -64,19 +64,15 @@

[[constraint]]
name = "github.com/containerd/containerd"
revision = "25daa7355cdc1334718ce42e887f1c367aff9d0e"
revision = "f05672357f56f26751a521175c5a96fc21fa8603"

[[constraint]]
name = "github.com/firecracker-microvm/firecracker-go-sdk"
revision = "961461227bddf7e40a1d690634e866c343910f86"

[[constraint]]
name = "github.com/gogo/protobuf"
revision = "4cbf7e384e768b4e01799441fdf2a706a5635ae7"

[[override]]
name = "github.com/containerd/ttrpc"
revision = "f82148331ad2181edea8f3f649a1f7add6c3f9c2"
revision = "342cbe0a04158f6dcb03ca0079991a51a4248c02"

[[override]]
branch = "master"
Expand Down
23 changes: 12 additions & 11 deletions containerd-shim-v2/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (

eventstypes "github.com/containerd/containerd/api/events"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/events"
"github.com/containerd/containerd/namespaces"
cdruntime "github.com/containerd/containerd/runtime"
cdshim "github.com/containerd/containerd/runtime/v2/shim"
Expand Down Expand Up @@ -57,7 +58,7 @@ var (
var vci vc.VC = &vc.VCImpl{}

// New returns a new shim service that can be used via GRPC
func New(ctx context.Context, id string, publisher cdshim.Publisher, shutdown func()) (cdshim.Shim, error) {
func New(ctx context.Context, id string, publisher events.Publisher) (cdshim.Shim, error) {
logger := logrus.WithField("ID", id)
// Discard the log before shim init its log output. Otherwise
// it will output into stdio, from which containerd would like
Expand All @@ -66,20 +67,22 @@ func New(ctx context.Context, id string, publisher cdshim.Publisher, shutdown fu
vci.SetLogger(ctx, logger)
katautils.SetLogger(ctx, logger, logger.Logger.Level)

ctx, cancel := context.WithCancel(ctx)

s := &service{
id: id,
pid: uint32(os.Getpid()),
ctx: ctx,
containers: make(map[string]*container),
events: make(chan interface{}, chSize),
ec: make(chan exit, bufferSize),
cancel: shutdown,
cancel: cancel,
mount: false,
}

go s.processExits()

go s.forward(ctx, publisher)
go s.forward(publisher)

return s, nil
}
Expand Down Expand Up @@ -213,20 +216,15 @@ func (s *service) StartShim(ctx context.Context, id, containerdBinary, container
return address, nil
}

func (s *service) forward(ctx context.Context, publisher cdshim.Publisher) {
ns, _ := namespaces.Namespace(ctx)
ctx = namespaces.WithNamespace(context.Background(), ns)

func (s *service) forward(publisher events.Publisher) {
for e := range s.events {
ctx, cancel := context.WithTimeout(ctx, timeOut)
ctx, cancel := context.WithTimeout(s.ctx, timeOut)
err := publisher.Publish(ctx, getTopic(e), e)
cancel()
if err != nil {
logrus.WithError(err).Error("post event")
}
}

publisher.Close()
}

func (s *service) send(evt interface{}) {
Expand Down Expand Up @@ -771,8 +769,11 @@ func (s *service) Shutdown(ctx context.Context, r *taskAPI.ShutdownRequest) (_ *
s.mu.Unlock()

s.cancel()
close(s.events)

os.Exit(0)

// This will never be called, but this is only there to make sure the
// program can compile.
return empty, nil
}

Expand Down
22 changes: 0 additions & 22 deletions vendor/github.com/blang/semver/LICENSE

This file was deleted.

23 changes: 0 additions & 23 deletions vendor/github.com/blang/semver/json.go

This file was deleted.

Loading

0 comments on commit e4e5167

Please sign in to comment.