Skip to content

Commit

Permalink
Merged PR 3872058: Update to GitHub windows_port at 2defc91
Browse files Browse the repository at this point in the history
  • Loading branch information
kevpar committed Dec 7, 2020
2 parents 84a4fba + 2defc91 commit d378bab
Show file tree
Hide file tree
Showing 22 changed files with 321 additions and 524 deletions.
11 changes: 9 additions & 2 deletions pkg/server/container_stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import (
"syscall"
"time"

"github.com/containerd/containerd"
eventtypes "github.com/containerd/containerd/api/events"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/log"
"github.com/docker/docker/pkg/signal"
"github.com/pkg/errors"
"golang.org/x/net/context"

Expand Down Expand Up @@ -125,11 +125,18 @@ func (c *criService) stopContainer(ctx context.Context, container containerstore
}
}
}
sig, err := signal.ParseSignal(stopSignal)

sandboxPlatform, err := c.getSandboxPlatform(container.Metadata.SandboxID)
if err != nil {
return errors.Wrapf(err, "failed to get container's sandbox platform")
}

sig, err := containerd.ParsePlatformSignal(stopSignal, sandboxPlatform)
if err != nil {
return errors.Wrapf(err, "failed to parse stop signal %q", stopSignal)
}
log.G(ctx).Infof("Stop container %q with signal %v", id, sig)

if err = task.Kill(ctx, sig); err != nil && !errdefs.IsNotFound(err) {
return errors.Wrapf(err, "failed to stop container %q", id)
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/server/helpers_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"fmt"
"regexp"

"github.com/containerd/containerd/platforms"
"github.com/opencontainers/selinux/go-selinux"
"github.com/opencontainers/selinux/go-selinux/label"
"github.com/pkg/errors"
Expand Down Expand Up @@ -65,3 +66,7 @@ func checkSelinuxLevel(level string) (bool, error) {
}
return true, nil
}

func (c *criService) getSandboxPlatform(_ string) (string, error) {
return platforms.DefaultString(), nil
}
28 changes: 28 additions & 0 deletions pkg/server/helpers_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,38 @@ limitations under the License.
package server

import (
runhcsoptions "github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/options"
criconfig "github.com/containerd/cri/pkg/config"
"github.com/pkg/errors"
runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2"
)

// initSelinuxOpts is not supported on Windows.
func initSelinuxOpts(selinuxOpt *runtime.SELinuxOption) (string, string, error) {
return "", "", nil
}

func (c *criService) getSandboxPlatform(sandboxID string) (string, error) {
sandbox, err := c.sandboxStore.Get(sandboxID)
if err != nil {
return "", err
}

// Get the RuntimeHandler config overrides
var ociRuntime criconfig.Runtime
if sandbox.RuntimeHandler != "" {
ociRuntime = c.config.Runtimes[sandbox.RuntimeHandler]
} else {
ociRuntime = c.config.DefaultRuntime
}
runtimeOpts, err := generateRuntimeOptions(ociRuntime, c.config)
if err != nil {
return "", errors.Wrap(err, "failed to generate runtime options")
}
rhcso := runtimeOpts.(*runhcsoptions.Options)
sandboxPlatform := rhcso.SandboxPlatform
if sandboxPlatform == "" {
sandboxPlatform = "windows/amd64"
}
return sandboxPlatform, nil
}
4 changes: 2 additions & 2 deletions vendor.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ github.com/blang/semver v3.1.0
github.com/BurntSushi/toml a368813c5e648fee92e5f6c30e3944ff9d5e8895
github.com/containerd/cgroups caf71576c8b19daf80ab4685916e4d5b4c74887e
github.com/containerd/console c12b1e7919c14469339a5d38f2f8ed9b64a9de23
github.com/containerd/containerd 12e49bbd4d6124ebdbbc3f66919416f360b46dda https://github.com/kevpar/containerd.git # fork/release/1.4
github.com/containerd/containerd 17959a99a417e21d67e8fab630f85a3279839a3c https://github.com/kevpar/containerd.git # fork/release/1.4
github.com/containerd/continuity bd77b46c8352f74eb12c85bdc01f4b90f69d66b4
github.com/containerd/fifo 3d5202aec260678c48179c56f40e6f38a095738c
github.com/containerd/go-cni 40bcf8ec8acd7372be1d77031d585d5d8e561c90
github.com/containerd/go-runc 5a6d9f37cfa36b15efba46dc7ea349fa9b7143c3
github.com/containerd/ttrpc 92c8520ef9f86600c650dd540266a007bf03670f
github.com/containerd/ttrpc a43d9fd2cb85a767787a707cfbdd7fe798316b61 https://github.com/kevpar/ttrpc.git # deadlock
github.com/containerd/typeurl a93fcdb778cd272c6e9b3028b2f42d813e785d40
github.com/containernetworking/cni v0.6.0
github.com/containernetworking/plugins v0.7.0
Expand Down

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

12 changes: 8 additions & 4 deletions vendor/github.com/containerd/containerd/signals.go

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

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

127 changes: 112 additions & 15 deletions vendor/github.com/containerd/containerd/signals_windows.go

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

Loading

0 comments on commit d378bab

Please sign in to comment.