diff --git a/cmd/containerd-shim-runc-v2/main.go b/cmd/containerd-shim-runc-v2/main.go index ccd4cc77c..4bd80d6d4 100644 --- a/cmd/containerd-shim-runc-v2/main.go +++ b/cmd/containerd-shim-runc-v2/main.go @@ -22,7 +22,6 @@ import ( "context" "github.com/containerd/containerd/v2/cmd/containerd-shim-runc-v2/manager" - _ "github.com/containerd/containerd/v2/cmd/containerd-shim-runc-v2/pause" _ "github.com/containerd/containerd/v2/cmd/containerd-shim-runc-v2/task/plugin" "github.com/containerd/containerd/v2/core/runtime/v2/shim" ) diff --git a/cmd/containerd-shim-runc-v2/pause/sandbox.go b/cmd/containerd-shim-runc-v2/pause/sandbox.go deleted file mode 100644 index a25196aa5..000000000 --- a/cmd/containerd-shim-runc-v2/pause/sandbox.go +++ /dev/null @@ -1,122 +0,0 @@ -//go:build linux - -/* - Copyright The containerd Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package pause - -import ( - "context" - "runtime" - - api "github.com/containerd/containerd/v2/api/runtime/sandbox/v1" - "github.com/containerd/containerd/v2/api/types" - "github.com/containerd/containerd/v2/core/runtime/v2/shim" - "github.com/containerd/containerd/v2/pkg/shutdown" - "github.com/containerd/containerd/v2/plugins" - "github.com/containerd/log" - "github.com/containerd/plugin" - "github.com/containerd/plugin/registry" - "github.com/containerd/ttrpc" -) - -func init() { - registry.Register(&plugin.Registration{ - Type: plugins.TTRPCPlugin, - ID: "pause", - Requires: []plugin.Type{ - plugins.InternalPlugin, - }, - InitFn: func(ic *plugin.InitContext) (interface{}, error) { - ss, err := ic.GetByID(plugins.InternalPlugin, "shutdown") - if err != nil { - return nil, err - } - - return &pauseService{ - shutdown: ss.(shutdown.Service), - }, nil - }, - }) -} - -var ( - _ = shim.TTRPCService(&pauseService{}) - _ = api.TTRPCSandboxService(&pauseService{}) -) - -// pauseService is an extension for task v2 runtime to support Pod "pause" containers via sandbox API. -type pauseService struct { - shutdown shutdown.Service -} - -func (p *pauseService) RegisterTTRPC(server *ttrpc.Server) error { - api.RegisterTTRPCSandboxService(server, p) - return nil -} - -func (p *pauseService) CreateSandbox(ctx context.Context, req *api.CreateSandboxRequest) (*api.CreateSandboxResponse, error) { - log.G(ctx).Debugf("create sandbox request: %+v", req) - return &api.CreateSandboxResponse{}, nil -} - -func (p *pauseService) StartSandbox(ctx context.Context, req *api.StartSandboxRequest) (*api.StartSandboxResponse, error) { - log.G(ctx).Debugf("start sandbox request: %+v", req) - return &api.StartSandboxResponse{}, nil -} - -func (p *pauseService) Platform(ctx context.Context, req *api.PlatformRequest) (*api.PlatformResponse, error) { - log.G(ctx).Debugf("platform request: %+v", req) - - platform := types.Platform{ - OS: runtime.GOOS, - Architecture: runtime.GOARCH, - } - - return &api.PlatformResponse{Platform: &platform}, nil -} - -func (p *pauseService) StopSandbox(ctx context.Context, req *api.StopSandboxRequest) (*api.StopSandboxResponse, error) { - log.G(ctx).Debugf("stop sandbox request: %+v", req) - p.shutdown.Shutdown() - return &api.StopSandboxResponse{}, nil -} - -func (p *pauseService) WaitSandbox(ctx context.Context, req *api.WaitSandboxRequest) (*api.WaitSandboxResponse, error) { - log.G(ctx).Debugf("wait sandbox request: %+v", req) - return &api.WaitSandboxResponse{ - ExitStatus: 0, - }, nil -} - -func (p *pauseService) SandboxStatus(ctx context.Context, req *api.SandboxStatusRequest) (*api.SandboxStatusResponse, error) { - log.G(ctx).Debugf("sandbox status request: %+v", req) - return &api.SandboxStatusResponse{}, nil -} - -func (p *pauseService) PingSandbox(ctx context.Context, req *api.PingRequest) (*api.PingResponse, error) { - return &api.PingResponse{}, nil -} - -func (p *pauseService) ShutdownSandbox(ctx context.Context, req *api.ShutdownSandboxRequest) (*api.ShutdownSandboxResponse, error) { - log.G(ctx).Debugf("shutdown sandbox request: %+v", req) - return &api.ShutdownSandboxResponse{}, nil -} - -func (p *pauseService) SandboxMetrics(ctx context.Context, req *api.SandboxMetricsRequest) (*api.SandboxMetricsResponse, error) { - log.G(ctx).Debugf("sandbox metrics request: %+v", req) - return &api.SandboxMetricsResponse{}, nil -} diff --git a/integration/failpoint/cmd/containerd-shim-runc-fp-v1/main_linux.go b/integration/failpoint/cmd/containerd-shim-runc-fp-v1/main_linux.go index 02f92b50a..8723170eb 100644 --- a/integration/failpoint/cmd/containerd-shim-runc-fp-v1/main_linux.go +++ b/integration/failpoint/cmd/containerd-shim-runc-fp-v1/main_linux.go @@ -20,7 +20,6 @@ import ( "context" "github.com/containerd/containerd/v2/cmd/containerd-shim-runc-v2/manager" - _ "github.com/containerd/containerd/v2/cmd/containerd-shim-runc-v2/pause" "github.com/containerd/containerd/v2/core/runtime/v2/shim" )