diff options
Diffstat (limited to 'pkg/shim')
-rw-r--r-- | pkg/shim/runsc/BUILD | 16 | ||||
-rw-r--r-- | pkg/shim/runsc/runsc_state_autogen.go | 3 | ||||
-rw-r--r-- | pkg/shim/v1/proc/BUILD | 36 | ||||
-rw-r--r-- | pkg/shim/v1/proc/proc_state_autogen.go | 3 | ||||
-rw-r--r-- | pkg/shim/v1/shim/BUILD | 40 | ||||
-rw-r--r-- | pkg/shim/v1/shim/shim_state_autogen.go | 3 | ||||
-rw-r--r-- | pkg/shim/v1/utils/BUILD | 27 | ||||
-rw-r--r-- | pkg/shim/v1/utils/utils_state_autogen.go | 3 | ||||
-rw-r--r-- | pkg/shim/v1/utils/volumes_test.go | 308 | ||||
-rw-r--r-- | pkg/shim/v2/BUILD | 43 | ||||
-rw-r--r-- | pkg/shim/v2/options/BUILD | 11 | ||||
-rw-r--r-- | pkg/shim/v2/options/options_state_autogen.go | 3 | ||||
-rw-r--r-- | pkg/shim/v2/runtimeoptions/BUILD | 32 | ||||
-rw-r--r-- | pkg/shim/v2/runtimeoptions/api_go_proto/runtimeoptions.pb.go | 89 | ||||
-rw-r--r-- | pkg/shim/v2/runtimeoptions/runtimeoptions.proto | 25 | ||||
-rw-r--r-- | pkg/shim/v2/runtimeoptions/runtimeoptions_state_autogen.go | 3 | ||||
-rw-r--r-- | pkg/shim/v2/runtimeoptions/runtimeoptions_test.go | 52 | ||||
-rw-r--r-- | pkg/shim/v2/v2_linux_state_autogen.go | 5 | ||||
-rw-r--r-- | pkg/shim/v2/v2_state_autogen.go | 5 |
19 files changed, 117 insertions, 590 deletions
diff --git a/pkg/shim/runsc/BUILD b/pkg/shim/runsc/BUILD deleted file mode 100644 index f08599ebd..000000000 --- a/pkg/shim/runsc/BUILD +++ /dev/null @@ -1,16 +0,0 @@ -load("//tools:defs.bzl", "go_library") - -package(licenses = ["notice"]) - -go_library( - name = "runsc", - srcs = [ - "runsc.go", - "utils.go", - ], - visibility = ["//:sandbox"], - deps = [ - "@com_github_containerd_go_runc//:go_default_library", - "@com_github_opencontainers_runtime_spec//specs-go:go_default_library", - ], -) diff --git a/pkg/shim/runsc/runsc_state_autogen.go b/pkg/shim/runsc/runsc_state_autogen.go new file mode 100644 index 000000000..ee470594f --- /dev/null +++ b/pkg/shim/runsc/runsc_state_autogen.go @@ -0,0 +1,3 @@ +// automatically generated by stateify. + +package runsc diff --git a/pkg/shim/v1/proc/BUILD b/pkg/shim/v1/proc/BUILD deleted file mode 100644 index 4377306af..000000000 --- a/pkg/shim/v1/proc/BUILD +++ /dev/null @@ -1,36 +0,0 @@ -load("//tools:defs.bzl", "go_library") - -package(licenses = ["notice"]) - -go_library( - name = "proc", - srcs = [ - "deleted_state.go", - "exec.go", - "exec_state.go", - "init.go", - "init_state.go", - "io.go", - "process.go", - "types.go", - "utils.go", - ], - visibility = [ - "//pkg/shim:__subpackages__", - "//shim:__subpackages__", - ], - deps = [ - "//pkg/shim/runsc", - "@com_github_containerd_console//:go_default_library", - "@com_github_containerd_containerd//errdefs:go_default_library", - "@com_github_containerd_containerd//log:go_default_library", - "@com_github_containerd_containerd//mount:go_default_library", - "@com_github_containerd_containerd//pkg/process:go_default_library", - "@com_github_containerd_containerd//pkg/stdio:go_default_library", - "@com_github_containerd_fifo//:go_default_library", - "@com_github_containerd_go_runc//:go_default_library", - "@com_github_gogo_protobuf//types:go_default_library", - "@com_github_opencontainers_runtime_spec//specs-go:go_default_library", - "@org_golang_x_sys//unix:go_default_library", - ], -) diff --git a/pkg/shim/v1/proc/proc_state_autogen.go b/pkg/shim/v1/proc/proc_state_autogen.go new file mode 100644 index 000000000..210252d9d --- /dev/null +++ b/pkg/shim/v1/proc/proc_state_autogen.go @@ -0,0 +1,3 @@ +// automatically generated by stateify. + +package proc diff --git a/pkg/shim/v1/shim/BUILD b/pkg/shim/v1/shim/BUILD deleted file mode 100644 index 05c595bc9..000000000 --- a/pkg/shim/v1/shim/BUILD +++ /dev/null @@ -1,40 +0,0 @@ -load("//tools:defs.bzl", "go_library") - -package(licenses = ["notice"]) - -go_library( - name = "shim", - srcs = [ - "api.go", - "platform.go", - "service.go", - ], - visibility = [ - "//pkg/shim:__subpackages__", - "//shim:__subpackages__", - ], - deps = [ - "//pkg/shim/runsc", - "//pkg/shim/v1/proc", - "//pkg/shim/v1/utils", - "@com_github_containerd_console//:go_default_library", - "@com_github_containerd_containerd//api/events:go_default_library", - "@com_github_containerd_containerd//api/types/task:go_default_library", - "@com_github_containerd_containerd//errdefs:go_default_library", - "@com_github_containerd_containerd//events:go_default_library", - "@com_github_containerd_containerd//log:go_default_library", - "@com_github_containerd_containerd//mount:go_default_library", - "@com_github_containerd_containerd//namespaces:go_default_library", - "@com_github_containerd_containerd//pkg/process:go_default_library", - "@com_github_containerd_containerd//pkg/stdio:go_default_library", - "@com_github_containerd_containerd//runtime:go_default_library", - "@com_github_containerd_containerd//runtime/linux/runctypes:go_default_library", - "@com_github_containerd_containerd//runtime/v1/shim/v1:go_default_library", - "@com_github_containerd_containerd//sys/reaper:go_default_library", - "@com_github_containerd_fifo//:go_default_library", - "@com_github_containerd_typeurl//:go_default_library", - "@com_github_gogo_protobuf//types:go_default_library", - "@org_golang_google_grpc//codes:go_default_library", - "@org_golang_google_grpc//status:go_default_library", - ], -) diff --git a/pkg/shim/v1/shim/shim_state_autogen.go b/pkg/shim/v1/shim/shim_state_autogen.go new file mode 100644 index 000000000..ce6579b97 --- /dev/null +++ b/pkg/shim/v1/shim/shim_state_autogen.go @@ -0,0 +1,3 @@ +// automatically generated by stateify. + +package shim diff --git a/pkg/shim/v1/utils/BUILD b/pkg/shim/v1/utils/BUILD deleted file mode 100644 index 54a0aabb7..000000000 --- a/pkg/shim/v1/utils/BUILD +++ /dev/null @@ -1,27 +0,0 @@ -load("//tools:defs.bzl", "go_library", "go_test") - -package(licenses = ["notice"]) - -go_library( - name = "utils", - srcs = [ - "annotations.go", - "utils.go", - "volumes.go", - ], - visibility = [ - "//pkg/shim:__subpackages__", - "//shim:__subpackages__", - ], - deps = [ - "@com_github_opencontainers_runtime_spec//specs-go:go_default_library", - ], -) - -go_test( - name = "utils_test", - size = "small", - srcs = ["volumes_test.go"], - library = ":utils", - deps = ["@com_github_opencontainers_runtime_spec//specs-go:go_default_library"], -) diff --git a/pkg/shim/v1/utils/utils_state_autogen.go b/pkg/shim/v1/utils/utils_state_autogen.go new file mode 100644 index 000000000..dba8bfb1a --- /dev/null +++ b/pkg/shim/v1/utils/utils_state_autogen.go @@ -0,0 +1,3 @@ +// automatically generated by stateify. + +package utils diff --git a/pkg/shim/v1/utils/volumes_test.go b/pkg/shim/v1/utils/volumes_test.go deleted file mode 100644 index 3e02c6151..000000000 --- a/pkg/shim/v1/utils/volumes_test.go +++ /dev/null @@ -1,308 +0,0 @@ -// Copyright 2019 The gVisor 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 -// -// https://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 utils - -import ( - "encoding/json" - "fmt" - "io/ioutil" - "os" - "path/filepath" - "reflect" - "testing" - - specs "github.com/opencontainers/runtime-spec/specs-go" -) - -func TestUpdateVolumeAnnotations(t *testing.T) { - dir, err := ioutil.TempDir("", "test-update-volume-annotations") - if err != nil { - t.Fatalf("create tempdir: %v", err) - } - defer os.RemoveAll(dir) - kubeletPodsDir = dir - - const ( - testPodUID = "testuid" - testVolumeName = "testvolume" - testLogDirPath = "/var/log/pods/testns_testname_" + testPodUID - testLegacyLogDirPath = "/var/log/pods/" + testPodUID - ) - testVolumePath := fmt.Sprintf("%s/%s/volumes/kubernetes.io~empty-dir/%s", dir, testPodUID, testVolumeName) - - if err := os.MkdirAll(testVolumePath, 0755); err != nil { - t.Fatalf("Create test volume: %v", err) - } - - for _, test := range []struct { - desc string - spec *specs.Spec - expected *specs.Spec - expectErr bool - expectUpdate bool - }{ - { - desc: "volume annotations for sandbox", - spec: &specs.Spec{ - Annotations: map[string]string{ - sandboxLogDirAnnotation: testLogDirPath, - containerTypeAnnotation: containerTypeSandbox, - "dev.gvisor.spec.mount." + testVolumeName + ".share": "pod", - "dev.gvisor.spec.mount." + testVolumeName + ".type": "tmpfs", - "dev.gvisor.spec.mount." + testVolumeName + ".options": "ro", - }, - }, - expected: &specs.Spec{ - Annotations: map[string]string{ - sandboxLogDirAnnotation: testLogDirPath, - containerTypeAnnotation: containerTypeSandbox, - "dev.gvisor.spec.mount." + testVolumeName + ".share": "pod", - "dev.gvisor.spec.mount." + testVolumeName + ".type": "tmpfs", - "dev.gvisor.spec.mount." + testVolumeName + ".options": "ro", - "dev.gvisor.spec.mount." + testVolumeName + ".source": testVolumePath, - }, - }, - expectUpdate: true, - }, - { - desc: "volume annotations for sandbox with legacy log path", - spec: &specs.Spec{ - Annotations: map[string]string{ - sandboxLogDirAnnotation: testLegacyLogDirPath, - containerTypeAnnotation: containerTypeSandbox, - "dev.gvisor.spec.mount." + testVolumeName + ".share": "pod", - "dev.gvisor.spec.mount." + testVolumeName + ".type": "tmpfs", - "dev.gvisor.spec.mount." + testVolumeName + ".options": "ro", - }, - }, - expected: &specs.Spec{ - Annotations: map[string]string{ - sandboxLogDirAnnotation: testLegacyLogDirPath, - containerTypeAnnotation: containerTypeSandbox, - "dev.gvisor.spec.mount." + testVolumeName + ".share": "pod", - "dev.gvisor.spec.mount." + testVolumeName + ".type": "tmpfs", - "dev.gvisor.spec.mount." + testVolumeName + ".options": "ro", - "dev.gvisor.spec.mount." + testVolumeName + ".source": testVolumePath, - }, - }, - expectUpdate: true, - }, - { - desc: "tmpfs: volume annotations for container", - spec: &specs.Spec{ - Mounts: []specs.Mount{ - { - Destination: "/test", - Type: "bind", - Source: testVolumePath, - Options: []string{"ro"}, - }, - { - Destination: "/random", - Type: "bind", - Source: "/random", - Options: []string{"ro"}, - }, - }, - Annotations: map[string]string{ - containerTypeAnnotation: containerTypeContainer, - "dev.gvisor.spec.mount." + testVolumeName + ".share": "pod", - "dev.gvisor.spec.mount." + testVolumeName + ".type": "tmpfs", - "dev.gvisor.spec.mount." + testVolumeName + ".options": "ro", - }, - }, - expected: &specs.Spec{ - Mounts: []specs.Mount{ - { - Destination: "/test", - Type: "tmpfs", - Source: testVolumePath, - Options: []string{"ro"}, - }, - { - Destination: "/random", - Type: "bind", - Source: "/random", - Options: []string{"ro"}, - }, - }, - Annotations: map[string]string{ - containerTypeAnnotation: containerTypeContainer, - "dev.gvisor.spec.mount." + testVolumeName + ".share": "pod", - "dev.gvisor.spec.mount." + testVolumeName + ".type": "tmpfs", - "dev.gvisor.spec.mount." + testVolumeName + ".options": "ro", - }, - }, - expectUpdate: true, - }, - { - desc: "bind: volume annotations for container", - spec: &specs.Spec{ - Mounts: []specs.Mount{ - { - Destination: "/test", - Type: "bind", - Source: testVolumePath, - Options: []string{"ro"}, - }, - }, - Annotations: map[string]string{ - containerTypeAnnotation: containerTypeContainer, - "dev.gvisor.spec.mount." + testVolumeName + ".share": "container", - "dev.gvisor.spec.mount." + testVolumeName + ".type": "bind", - "dev.gvisor.spec.mount." + testVolumeName + ".options": "ro", - }, - }, - expected: &specs.Spec{ - Mounts: []specs.Mount{ - { - Destination: "/test", - Type: "bind", - Source: testVolumePath, - Options: []string{"ro"}, - }, - }, - Annotations: map[string]string{ - containerTypeAnnotation: containerTypeContainer, - "dev.gvisor.spec.mount." + testVolumeName + ".share": "container", - "dev.gvisor.spec.mount." + testVolumeName + ".type": "bind", - "dev.gvisor.spec.mount." + testVolumeName + ".options": "ro", - }, - }, - expectUpdate: true, - }, - { - desc: "should not return error without pod log directory", - spec: &specs.Spec{ - Annotations: map[string]string{ - containerTypeAnnotation: containerTypeSandbox, - "dev.gvisor.spec.mount." + testVolumeName + ".share": "pod", - "dev.gvisor.spec.mount." + testVolumeName + ".type": "tmpfs", - "dev.gvisor.spec.mount." + testVolumeName + ".options": "ro", - }, - }, - expected: &specs.Spec{ - Annotations: map[string]string{ - containerTypeAnnotation: containerTypeSandbox, - "dev.gvisor.spec.mount." + testVolumeName + ".share": "pod", - "dev.gvisor.spec.mount." + testVolumeName + ".type": "tmpfs", - "dev.gvisor.spec.mount." + testVolumeName + ".options": "ro", - }, - }, - }, - { - desc: "should return error if volume path does not exist", - spec: &specs.Spec{ - Annotations: map[string]string{ - sandboxLogDirAnnotation: testLogDirPath, - containerTypeAnnotation: containerTypeSandbox, - "dev.gvisor.spec.mount.notexist.share": "pod", - "dev.gvisor.spec.mount.notexist.type": "tmpfs", - "dev.gvisor.spec.mount.notexist.options": "ro", - }, - }, - expectErr: true, - }, - { - desc: "no volume annotations for sandbox", - spec: &specs.Spec{ - Annotations: map[string]string{ - sandboxLogDirAnnotation: testLogDirPath, - containerTypeAnnotation: containerTypeSandbox, - }, - }, - expected: &specs.Spec{ - Annotations: map[string]string{ - sandboxLogDirAnnotation: testLogDirPath, - containerTypeAnnotation: containerTypeSandbox, - }, - }, - }, - { - desc: "no volume annotations for container", - spec: &specs.Spec{ - Mounts: []specs.Mount{ - { - Destination: "/test", - Type: "bind", - Source: "/test", - Options: []string{"ro"}, - }, - { - Destination: "/random", - Type: "bind", - Source: "/random", - Options: []string{"ro"}, - }, - }, - Annotations: map[string]string{ - containerTypeAnnotation: containerTypeContainer, - }, - }, - expected: &specs.Spec{ - Mounts: []specs.Mount{ - { - Destination: "/test", - Type: "bind", - Source: "/test", - Options: []string{"ro"}, - }, - { - Destination: "/random", - Type: "bind", - Source: "/random", - Options: []string{"ro"}, - }, - }, - Annotations: map[string]string{ - containerTypeAnnotation: containerTypeContainer, - }, - }, - }, - } { - t.Run(test.desc, func(t *testing.T) { - bundle, err := ioutil.TempDir(dir, "test-bundle") - if err != nil { - t.Fatalf("Create test bundle: %v", err) - } - err = UpdateVolumeAnnotations(bundle, test.spec) - if test.expectErr { - if err == nil { - t.Fatal("Expected error, but got nil") - } - return - } - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } - if !reflect.DeepEqual(test.expected, test.spec) { - t.Fatalf("Expected %+v, got %+v", test.expected, test.spec) - } - if test.expectUpdate { - b, err := ioutil.ReadFile(filepath.Join(bundle, "config.json")) - if err != nil { - t.Fatalf("Read spec from bundle: %v", err) - } - var spec specs.Spec - if err := json.Unmarshal(b, &spec); err != nil { - t.Fatalf("Unmarshal spec: %v", err) - } - if !reflect.DeepEqual(test.expected, &spec) { - t.Fatalf("Expected %+v, got %+v", test.expected, &spec) - } - } - }) - } -} diff --git a/pkg/shim/v2/BUILD b/pkg/shim/v2/BUILD deleted file mode 100644 index 7e0a114a0..000000000 --- a/pkg/shim/v2/BUILD +++ /dev/null @@ -1,43 +0,0 @@ -load("//tools:defs.bzl", "go_library") - -package(licenses = ["notice"]) - -go_library( - name = "v2", - srcs = [ - "api.go", - "epoll.go", - "service.go", - "service_linux.go", - ], - visibility = ["//shim:__subpackages__"], - deps = [ - "//pkg/shim/runsc", - "//pkg/shim/v1/proc", - "//pkg/shim/v1/utils", - "//pkg/shim/v2/options", - "//pkg/shim/v2/runtimeoptions", - "//runsc/specutils", - "@com_github_burntsushi_toml//:go_default_library", - "@com_github_containerd_cgroups//:go_default_library", - "@com_github_containerd_console//:go_default_library", - "@com_github_containerd_containerd//api/events:go_default_library", - "@com_github_containerd_containerd//api/types/task:go_default_library", - "@com_github_containerd_containerd//errdefs:go_default_library", - "@com_github_containerd_containerd//events:go_default_library", - "@com_github_containerd_containerd//log:go_default_library", - "@com_github_containerd_containerd//mount:go_default_library", - "@com_github_containerd_containerd//namespaces:go_default_library", - "@com_github_containerd_containerd//pkg/process:go_default_library", - "@com_github_containerd_containerd//pkg/stdio:go_default_library", - "@com_github_containerd_containerd//runtime:go_default_library", - "@com_github_containerd_containerd//runtime/linux/runctypes:go_default_library", - "@com_github_containerd_containerd//runtime/v2/shim:go_default_library", - "@com_github_containerd_containerd//runtime/v2/task:go_default_library", - "@com_github_containerd_containerd//sys/reaper:go_default_library", - "@com_github_containerd_fifo//:go_default_library", - "@com_github_containerd_typeurl//:go_default_library", - "@com_github_gogo_protobuf//types:go_default_library", - "@org_golang_x_sys//unix:go_default_library", - ], -) diff --git a/pkg/shim/v2/options/BUILD b/pkg/shim/v2/options/BUILD deleted file mode 100644 index ca212e874..000000000 --- a/pkg/shim/v2/options/BUILD +++ /dev/null @@ -1,11 +0,0 @@ -load("//tools:defs.bzl", "go_library") - -package(licenses = ["notice"]) - -go_library( - name = "options", - srcs = [ - "options.go", - ], - visibility = ["//:sandbox"], -) diff --git a/pkg/shim/v2/options/options_state_autogen.go b/pkg/shim/v2/options/options_state_autogen.go new file mode 100644 index 000000000..45857f685 --- /dev/null +++ b/pkg/shim/v2/options/options_state_autogen.go @@ -0,0 +1,3 @@ +// automatically generated by stateify. + +package options diff --git a/pkg/shim/v2/runtimeoptions/BUILD b/pkg/shim/v2/runtimeoptions/BUILD deleted file mode 100644 index ba2ed1ea7..000000000 --- a/pkg/shim/v2/runtimeoptions/BUILD +++ /dev/null @@ -1,32 +0,0 @@ -load("//tools:defs.bzl", "go_library", "go_test", "proto_library") - -package(licenses = ["notice"]) - -proto_library( - name = "api", - srcs = [ - "runtimeoptions.proto", - ], -) - -go_library( - name = "runtimeoptions", - srcs = ["runtimeoptions.go"], - visibility = ["//pkg/shim/v2:__pkg__"], - deps = [ - ":api_go_proto", - "@com_github_gogo_protobuf//proto:go_default_library", - ], -) - -go_test( - name = "runtimeoptions_test", - size = "small", - srcs = ["runtimeoptions_test.go"], - library = ":runtimeoptions", - deps = [ - "@com_github_containerd_containerd//runtime/v1/shim/v1:go_default_library", - "@com_github_containerd_typeurl//:go_default_library", - "@com_github_golang_protobuf//proto:go_default_library", - ], -) diff --git a/pkg/shim/v2/runtimeoptions/api_go_proto/runtimeoptions.pb.go b/pkg/shim/v2/runtimeoptions/api_go_proto/runtimeoptions.pb.go new file mode 100644 index 000000000..ecbdd2282 --- /dev/null +++ b/pkg/shim/v2/runtimeoptions/api_go_proto/runtimeoptions.pb.go @@ -0,0 +1,89 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: pkg/shim/v2/runtimeoptions/runtimeoptions.proto + +package cri_runtimeoptions_v1 + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type Options struct { + TypeUrl string `protobuf:"bytes,1,opt,name=type_url,json=typeUrl,proto3" json:"type_url,omitempty"` + ConfigPath string `protobuf:"bytes,2,opt,name=config_path,json=configPath,proto3" json:"config_path,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Options) Reset() { *m = Options{} } +func (m *Options) String() string { return proto.CompactTextString(m) } +func (*Options) ProtoMessage() {} +func (*Options) Descriptor() ([]byte, []int) { + return fileDescriptor_66926f9a3a61f972, []int{0} +} + +func (m *Options) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Options.Unmarshal(m, b) +} +func (m *Options) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Options.Marshal(b, m, deterministic) +} +func (m *Options) XXX_Merge(src proto.Message) { + xxx_messageInfo_Options.Merge(m, src) +} +func (m *Options) XXX_Size() int { + return xxx_messageInfo_Options.Size(m) +} +func (m *Options) XXX_DiscardUnknown() { + xxx_messageInfo_Options.DiscardUnknown(m) +} + +var xxx_messageInfo_Options proto.InternalMessageInfo + +func (m *Options) GetTypeUrl() string { + if m != nil { + return m.TypeUrl + } + return "" +} + +func (m *Options) GetConfigPath() string { + if m != nil { + return m.ConfigPath + } + return "" +} + +func init() { + proto.RegisterType((*Options)(nil), "cri.runtimeoptions.v1.Options") +} + +func init() { + proto.RegisterFile("pkg/shim/v2/runtimeoptions/runtimeoptions.proto", fileDescriptor_66926f9a3a61f972) +} + +var fileDescriptor_66926f9a3a61f972 = []byte{ + // 132 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x2f, 0xc8, 0x4e, 0xd7, + 0x2f, 0xce, 0xc8, 0xcc, 0xd5, 0x2f, 0x33, 0xd2, 0x2f, 0x2a, 0xcd, 0x2b, 0xc9, 0xcc, 0x4d, 0xcd, + 0x2f, 0x28, 0xc9, 0xcc, 0xcf, 0x2b, 0x46, 0xe3, 0xea, 0x15, 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0x89, + 0x26, 0x17, 0x65, 0xea, 0xa1, 0xc9, 0x94, 0x19, 0x2a, 0xb9, 0x72, 0xb1, 0xfb, 0x43, 0x78, 0x42, + 0x92, 0x5c, 0x1c, 0x25, 0x95, 0x05, 0xa9, 0xf1, 0xa5, 0x45, 0x39, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, + 0x9c, 0x41, 0xec, 0x20, 0x7e, 0x68, 0x51, 0x8e, 0x90, 0x3c, 0x17, 0x77, 0x72, 0x7e, 0x5e, 0x5a, + 0x66, 0x7a, 0x7c, 0x41, 0x62, 0x49, 0x86, 0x04, 0x13, 0x58, 0x96, 0x0b, 0x22, 0x14, 0x90, 0x58, + 0x92, 0x91, 0xc4, 0x06, 0xb6, 0xc4, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x7e, 0xaf, 0x7b, 0x2c, + 0x97, 0x00, 0x00, 0x00, +} diff --git a/pkg/shim/v2/runtimeoptions/runtimeoptions.proto b/pkg/shim/v2/runtimeoptions/runtimeoptions.proto deleted file mode 100644 index 057032e34..000000000 --- a/pkg/shim/v2/runtimeoptions/runtimeoptions.proto +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2020 The gVisor 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 -// -// https://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. - -syntax = "proto3"; - -package cri.runtimeoptions.v1; - -// This is a version of the runtimeoptions CRI API that is vendored. -// -// Importing the full CRI package is a nightmare. -message Options { - string type_url = 1; - string config_path = 2; -} diff --git a/pkg/shim/v2/runtimeoptions/runtimeoptions_state_autogen.go b/pkg/shim/v2/runtimeoptions/runtimeoptions_state_autogen.go new file mode 100644 index 000000000..f5c883045 --- /dev/null +++ b/pkg/shim/v2/runtimeoptions/runtimeoptions_state_autogen.go @@ -0,0 +1,3 @@ +// automatically generated by stateify. + +package runtimeoptions diff --git a/pkg/shim/v2/runtimeoptions/runtimeoptions_test.go b/pkg/shim/v2/runtimeoptions/runtimeoptions_test.go deleted file mode 100644 index f4c238a00..000000000 --- a/pkg/shim/v2/runtimeoptions/runtimeoptions_test.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2020 The gVisor 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 -// -// https://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 runtimeoptions - -import ( - "testing" - - shim "github.com/containerd/containerd/runtime/v1/shim/v1" - "github.com/containerd/typeurl" - "github.com/golang/protobuf/proto" -) - -func TestCreateTaskRequest(t *testing.T) { - // Serialize the top-level message. - const encodedText = `options: < - type_url: "cri.runtimeoptions.v1.Options" - value: "\n\010type_url\022\013config_path" ->` - got := &shim.CreateTaskRequest{} // Should have raw options. - if err := proto.UnmarshalText(encodedText, got); err != nil { - t.Fatalf("unable to unmarshal text: %v", err) - } - t.Logf("got: %s", proto.MarshalTextString(got)) - - // Check the options. - wantOptions := &Options{} - wantOptions.TypeUrl = "type_url" - wantOptions.ConfigPath = "config_path" - gotMessage, err := typeurl.UnmarshalAny(got.Options) - if err != nil { - t.Fatalf("unable to unmarshal any: %v", err) - } - gotOptions, ok := gotMessage.(*Options) - if !ok { - t.Fatalf("got %v, want %v", gotMessage, wantOptions) - } - if !proto.Equal(gotOptions, wantOptions) { - t.Fatalf("got %v, want %v", gotOptions, wantOptions) - } -} diff --git a/pkg/shim/v2/v2_linux_state_autogen.go b/pkg/shim/v2/v2_linux_state_autogen.go new file mode 100644 index 000000000..1023f4d8f --- /dev/null +++ b/pkg/shim/v2/v2_linux_state_autogen.go @@ -0,0 +1,5 @@ +// automatically generated by stateify. + +// +build linux + +package v2 diff --git a/pkg/shim/v2/v2_state_autogen.go b/pkg/shim/v2/v2_state_autogen.go new file mode 100644 index 000000000..1023f4d8f --- /dev/null +++ b/pkg/shim/v2/v2_state_autogen.go @@ -0,0 +1,5 @@ +// automatically generated by stateify. + +// +build linux + +package v2 |