From 6379fd0346ab16d657e1aabf5550994c470160f9 Mon Sep 17 00:00:00 2001 From: Lantao Liu Date: Thu, 9 Aug 2018 01:53:44 -0700 Subject: [PATCH] Update containerd to b9eeaa1ce83dd9970605ddbd0b35d4d3fa5f87bd. Signed-off-by: Lantao Liu --- cmd/containerd/containerd.go | 2 +- cri.go | 4 +- pkg/containerd/importer/importer.go | 2 +- vendor.conf | 12 +- .../github.com/containerd/cgroups/cgroup.go | 30 + .../github.com/containerd/cgroups/control.go | 5 +- .../github.com/containerd/cgroups/cpuset.go | 4 + .../containerd/cgroups/metrics.pb.go | 437 ++ .../containerd/cgroups/metrics.proto | 12 + vendor/github.com/containerd/cgroups/rdma.go | 153 + .../containerd/cgroups/subsystem.go | 2 + vendor/github.com/containerd/cgroups/utils.go | 1 + .../containerd/containerd/README.md | 24 +- .../services/containers/v1/containers.pb.go | 307 +- .../services/containers/v1/containers.proto | 5 + .../api/services/leases/v1/leases.pb.go | 104 +- .../api/services/leases/v1/leases.proto | 6 + .../archive/compression/compression.go | 20 +- .../containerd/containerd/archive/tar.go | 38 +- .../containerd/containerd/archive/tar_opts.go | 18 + .../containerd/archive/tar_opts_unix.go | 1 + .../containerd/archive/tar_opts_windows.go | 1 + .../containerd/containerd/cio/io_windows.go | 6 - .../containerd/containerd/client.go | 146 +- .../containerd/containerd/client_opts.go | 19 +- .../cmd/containerd/command/config.go | 3 +- .../containerd/cmd/containerd/command/main.go | 13 +- .../cmd/containerd/command/oci-hook.go | 34 +- .../containerd/containerd/cmd/ctr/app/main.go | 4 + .../containerd/cmd/ctr/commands/client.go | 4 +- .../containerd/cmd/ctr/commands/commands.go | 2 +- .../cmd/ctr/commands/content/fetch.go | 26 +- .../cmd/ctr/commands/images/pull.go | 38 +- .../cmd/ctr/commands/install/install.go | 61 + .../cmd/ctr/commands/leases/leases.go | 202 + .../containerd/cmd/ctr/commands/run/run.go | 13 - .../cmd/ctr/commands/run/run_unix.go | 22 +- .../cmd/ctr/commands/run/run_windows.go | 18 +- .../containerd/cmd/ctr/commands/shim/shim.go | 40 +- .../cmd/ctr/commands/tasks/checkpoint.go | 38 +- .../cmd/ctr/commands/tasks/metrics.go | 108 + .../cmd/ctr/commands/tasks/tasks_windows.go | 11 +- .../containerd/containerd/container.go | 5 +- .../containerd/containerd/container_opts.go | 7 +- .../containerd/containerd/containerstore.go | 47 +- .../containerd/content/local/store.go | 34 + .../containerd/contrib/nvidia/nvidia.go | 106 +- .../containerd/diff/walking/differ.go | 2 +- .../github.com/containerd/containerd/image.go | 29 +- .../containerd/images/oci/exporter.go | 3 +- .../containerd/containerd/import.go | 5 +- .../containerd/containerd/install.go | 91 + .../containerd/containerd/install_opts.go | 38 + .../github.com/containerd/containerd/lease.go | 74 +- .../containerd/containerd/leases/context.go | 4 +- .../containerd/containerd/leases/id.go | 43 + .../containerd/containerd/leases/lease.go | 76 + .../containerd/leases/proxy/manager.go | 93 + .../containerd/containerd/log/context.go | 4 + .../containerd/metadata/adaptors.go | 18 + .../containerd/containerd/metadata/buckets.go | 1 + .../containerd/containerd/metadata/content.go | 102 +- .../containerd/containerd/metadata/db.go | 2 +- .../containerd/containerd/metadata/gc.go | 157 +- .../containerd/containerd/metadata/leases.go | 136 +- .../containerd/metrics/cgroups/cgroups.go | 32 +- .../containerd/metrics/cgroups/metrics.go | 55 +- .../containerd/metrics/cgroups/oom.go | 3 +- .../containerd/containerd/mount/temp_unix.go | 11 +- .../containerd/mount/temp_unsupported.go | 4 +- .../containerd/containerd/oci/spec.go | 17 +- .../containerd/containerd/oci/spec_opts.go | 35 + .../containerd/oci/spec_opts_unix.go | 17 +- .../containerd/containerd/oci/spec_unix.go | 9 +- .../containerd/containerd/oci/spec_windows.go | 7 +- .../containerd/containerd/plugin/plugin.go | 2 + .../remotes/docker/schema1/converter.go | 27 +- .../containerd/containerd/rootfs/apply.go | 2 +- .../containerd/containerd/runtime/runtime.go | 12 +- .../containerd/containerd/runtime/task.go | 12 +- .../containerd/runtime/task_list.go | 12 +- .../runtime/{ => v1}/linux/bundle.go | 4 +- .../{ => v1}/linux/proc/deleted_state.go | 0 .../runtime/{ => v1}/linux/proc/exec.go | 4 +- .../runtime/{ => v1}/linux/proc/exec_state.go | 0 .../runtime/{ => v1}/linux/proc/init.go | 168 +- .../runtime/{ => v1}/linux/proc/init_state.go | 4 +- .../runtime/{ => v1}/linux/proc/io.go | 0 .../runtime/{ => v1}/linux/proc/process.go | 0 .../runtime/{ => v1}/linux/proc/types.go | 9 +- .../runtime/{ => v1}/linux/proc/utils.go | 0 .../runtime/{ => v1}/linux/process.go | 17 +- .../runtime/{ => v1}/linux/runtime.go | 102 +- .../containerd/runtime/{ => v1}/linux/task.go | 74 +- .../runtime/{ => v1}/shim/client/client.go | 4 +- .../{ => v1}/shim/client/client_linux.go | 0 .../{ => v1}/shim/client/client_unix.go | 0 .../containerd/runtime/{ => v1}/shim/local.go | 2 +- .../runtime/{ => v1}/shim/reaper.go | 0 .../runtime/{ => v1}/shim/service.go | 105 +- .../runtime/{ => v1}/shim/service_linux.go | 0 .../runtime/{ => v1}/shim/service_unix.go | 0 .../runtime/{ => v1}/shim/v1/doc.go | 0 .../runtime/{ => v1}/shim/v1/shim.pb.go | 150 +- .../runtime/{ => v1}/shim/v1/shim.proto | 2 +- .../containerd/runtime/v2/README.md | 173 + .../containerd/runtime/v2/binary.go | 145 + .../containerd/runtime/v2/bundle.go | 120 + .../containerd/runtime/v2/manager.go | 252 + .../containerd/runtime/v2/process.go | 160 + .../containerd/runtime/v2/runc/options/doc.go | 17 + .../runtime/v2/runc/options/oci.pb.go | 1142 ++++ .../runtime/v2/runc/options/oci.proto | 50 + .../containerd/containerd/runtime/v2/shim.go | 409 ++ .../containerd/runtime/v2/shim/reaper_unix.go | 110 + .../containerd/runtime/v2/shim/shim.go | 257 + .../containerd/runtime/v2/shim/shim_darwin.go | 29 + .../containerd/runtime/v2/shim/shim_linux.go | 30 + .../containerd/runtime/v2/shim/shim_unix.go | 117 + .../runtime/v2/shim/shim_windows.go | 145 + .../containerd/runtime/v2/shim/util.go | 120 + .../containerd/runtime/v2/shim/util_unix.go | 70 + .../runtime/v2/shim/util_windows.go | 80 + .../containerd/runtime/v2/shim_unix.go | 32 + .../containerd/runtime/v2/shim_windows.go | 87 + .../containerd/runtime/v2/task/doc.go | 17 + .../containerd/runtime/v2/task/shim.pb.go | 5693 +++++++++++++++++ .../containerd/runtime/v2/task/shim.proto | 184 + .../containerd/containerd/services.go | 6 +- .../containerd/services/containers/local.go | 59 +- .../containerd/services/containers/service.go | 26 + .../containerd/services/leases/local.go | 97 +- .../containerd/services/leases/service.go | 57 +- .../containerd/services/server/config.go | 8 + .../containerd/services/server/server.go | 88 +- .../containerd/services/tasks/local.go | 117 +- .../containerd/services/tasks/local_unix.go | 56 + .../services/tasks/local_windows_v2.go | 35 + .../containerd/containerd/sys/reaper.go | 4 +- .../containerd/containerd/sys/reaper_linux.go | 52 + .../github.com/containerd/containerd/task.go | 9 +- .../containerd/containerd/task_opts.go | 9 - .../containerd/containerd/vendor.conf | 12 +- .../containerd/go-runc/command_linux.go | 2 + .../containerd/go-runc/command_other.go | 5 +- .../github.com/containerd/go-runc/console.go | 8 +- vendor/github.com/containerd/go-runc/runc.go | 9 +- vendor/github.com/containerd/go-runc/utils.go | 4 +- .../opencontainers/runtime-spec/README.md | 6 +- .../runtime-spec/specs-go/config.go | 64 +- .../runtime-spec/specs-go/version.go | 2 +- vendor/golang.org/x/sys/cpu/cpu.go | 38 + vendor/golang.org/x/sys/cpu/cpu_arm.go | 7 + vendor/golang.org/x/sys/cpu/cpu_arm64.go | 7 + vendor/golang.org/x/sys/cpu/cpu_gc_x86.go | 16 + vendor/golang.org/x/sys/cpu/cpu_gccgo.c | 43 + vendor/golang.org/x/sys/cpu/cpu_gccgo.go | 26 + vendor/golang.org/x/sys/cpu/cpu_mips64x.go | 9 + vendor/golang.org/x/sys/cpu/cpu_mipsx.go | 9 + vendor/golang.org/x/sys/cpu/cpu_ppc64x.go | 9 + vendor/golang.org/x/sys/cpu/cpu_s390x.go | 7 + vendor/golang.org/x/sys/cpu/cpu_x86.go | 55 + vendor/golang.org/x/sys/cpu/cpu_x86.s | 27 + .../golang.org/x/sys/unix/affinity_linux.go | 124 + .../x/sys/unix/asm_dragonfly_amd64.s | 10 +- vendor/golang.org/x/sys/unix/asm_linux_386.s | 36 +- .../golang.org/x/sys/unix/asm_linux_amd64.s | 30 +- vendor/golang.org/x/sys/unix/asm_linux_arm.s | 35 +- .../golang.org/x/sys/unix/asm_linux_arm64.s | 30 +- .../golang.org/x/sys/unix/asm_linux_mips64x.s | 36 +- .../golang.org/x/sys/unix/asm_linux_mipsx.s | 33 +- .../golang.org/x/sys/unix/asm_linux_ppc64x.s | 30 +- .../golang.org/x/sys/unix/asm_linux_s390x.s | 28 + vendor/golang.org/x/sys/unix/cap_freebsd.go | 30 +- vendor/golang.org/x/sys/unix/dirent.go | 89 +- vendor/golang.org/x/sys/unix/env_unix.go | 6 +- vendor/golang.org/x/sys/unix/env_unset.go | 14 - .../x/sys/unix/{flock.go => fcntl.go} | 10 + ...ck_linux_32bit.go => fcntl_linux_32bit.go} | 0 vendor/golang.org/x/sys/unix/file_unix.go | 27 - vendor/golang.org/x/sys/unix/gccgo.go | 19 +- vendor/golang.org/x/sys/unix/gccgo_c.c | 11 +- .../x/sys/unix/gccgo_linux_amd64.go | 2 +- .../golang.org/x/sys/unix/openbsd_pledge.go | 4 +- vendor/golang.org/x/sys/unix/pagesize_unix.go | 2 +- vendor/golang.org/x/sys/unix/race.go | 2 +- vendor/golang.org/x/sys/unix/race0.go | 2 +- .../golang.org/x/sys/unix/sockcmsg_linux.go | 2 +- vendor/golang.org/x/sys/unix/syscall.go | 35 +- vendor/golang.org/x/sys/unix/syscall_bsd.go | 79 +- .../golang.org/x/sys/unix/syscall_darwin.go | 188 +- .../x/sys/unix/syscall_darwin_386.go | 17 +- .../x/sys/unix/syscall_darwin_amd64.go | 17 +- .../x/sys/unix/syscall_darwin_arm.go | 21 +- .../x/sys/unix/syscall_darwin_arm64.go | 17 +- .../x/sys/unix/syscall_dragonfly.go | 148 +- .../x/sys/unix/syscall_dragonfly_amd64.go | 15 +- .../golang.org/x/sys/unix/syscall_freebsd.go | 114 +- .../x/sys/unix/syscall_freebsd_386.go | 15 +- .../x/sys/unix/syscall_freebsd_amd64.go | 15 +- .../x/sys/unix/syscall_freebsd_arm.go | 15 +- vendor/golang.org/x/sys/unix/syscall_linux.go | 266 +- .../x/sys/unix/syscall_linux_386.go | 36 +- .../x/sys/unix/syscall_linux_amd64.go | 38 +- .../x/sys/unix/syscall_linux_arm.go | 26 +- .../x/sys/unix/syscall_linux_arm64.go | 80 +- .../golang.org/x/sys/unix/syscall_linux_gc.go | 14 + .../x/sys/unix/syscall_linux_gc_386.go | 16 + .../x/sys/unix/syscall_linux_gccgo_386.go | 30 + .../x/sys/unix/syscall_linux_gccgo_arm.go | 20 + .../x/sys/unix/syscall_linux_mips64x.go | 31 +- .../x/sys/unix/syscall_linux_mipsx.go | 29 +- .../x/sys/unix/syscall_linux_ppc64x.go | 24 +- .../x/sys/unix/syscall_linux_s390x.go | 20 +- .../x/sys/unix/syscall_linux_sparc64.go | 19 +- .../golang.org/x/sys/unix/syscall_netbsd.go | 128 +- .../x/sys/unix/syscall_netbsd_386.go | 15 +- .../x/sys/unix/syscall_netbsd_amd64.go | 15 +- .../x/sys/unix/syscall_netbsd_arm.go | 15 +- .../golang.org/x/sys/unix/syscall_no_getwd.go | 11 - .../golang.org/x/sys/unix/syscall_openbsd.go | 152 +- .../x/sys/unix/syscall_openbsd_386.go | 15 +- .../x/sys/unix/syscall_openbsd_amd64.go | 19 +- .../x/sys/unix/syscall_openbsd_arm.go | 15 +- .../golang.org/x/sys/unix/syscall_solaris.go | 75 +- .../x/sys/unix/syscall_solaris_amd64.go | 20 +- vendor/golang.org/x/sys/unix/syscall_unix.go | 105 +- vendor/golang.org/x/sys/unix/timestruct.go | 82 + .../x/sys/unix/zerrors_darwin_386.go | 388 +- .../x/sys/unix/zerrors_darwin_amd64.go | 388 +- .../x/sys/unix/zerrors_darwin_arm.go | 388 +- .../x/sys/unix/zerrors_darwin_arm64.go | 388 +- .../x/sys/unix/zerrors_dragonfly_amd64.go | 288 +- .../x/sys/unix/zerrors_freebsd_386.go | 320 +- .../x/sys/unix/zerrors_freebsd_amd64.go | 320 +- .../x/sys/unix/zerrors_freebsd_arm.go | 320 +- .../x/sys/unix/zerrors_linux_386.go | 705 +- .../x/sys/unix/zerrors_linux_amd64.go | 706 +- .../x/sys/unix/zerrors_linux_arm.go | 706 +- .../x/sys/unix/zerrors_linux_arm64.go | 707 +- .../x/sys/unix/zerrors_linux_mips.go | 709 +- .../x/sys/unix/zerrors_linux_mips64.go | 711 +- .../x/sys/unix/zerrors_linux_mips64le.go | 711 +- .../x/sys/unix/zerrors_linux_mipsle.go | 709 +- .../x/sys/unix/zerrors_linux_ppc64.go | 707 +- .../x/sys/unix/zerrors_linux_ppc64le.go | 707 +- .../x/sys/unix/zerrors_linux_s390x.go | 705 +- .../x/sys/unix/zerrors_linux_sparc64.go | 2 +- .../x/sys/unix/zerrors_netbsd_386.go | 278 +- .../x/sys/unix/zerrors_netbsd_amd64.go | 278 +- .../x/sys/unix/zerrors_netbsd_arm.go | 278 +- .../x/sys/unix/zerrors_openbsd_386.go | 268 +- .../x/sys/unix/zerrors_openbsd_amd64.go | 515 +- .../x/sys/unix/zerrors_openbsd_arm.go | 268 +- .../x/sys/unix/zerrors_solaris_amd64.go | 336 +- .../golang.org/x/sys/unix/zptrace386_linux.go | 80 + .../golang.org/x/sys/unix/zptracearm_linux.go | 41 + .../x/sys/unix/zptracemips_linux.go | 50 + .../x/sys/unix/zptracemipsle_linux.go | 50 + .../x/sys/unix/zsyscall_darwin_386.go | 103 + .../x/sys/unix/zsyscall_darwin_amd64.go | 103 + .../x/sys/unix/zsyscall_darwin_arm.go | 107 +- .../x/sys/unix/zsyscall_darwin_arm64.go | 103 + .../x/sys/unix/zsyscall_dragonfly_amd64.go | 68 + .../x/sys/unix/zsyscall_freebsd_386.go | 60 + .../x/sys/unix/zsyscall_freebsd_amd64.go | 60 + .../x/sys/unix/zsyscall_freebsd_arm.go | 60 + .../x/sys/unix/zsyscall_linux_386.go | 233 +- .../x/sys/unix/zsyscall_linux_amd64.go | 225 +- .../x/sys/unix/zsyscall_linux_arm.go | 235 +- .../x/sys/unix/zsyscall_linux_arm64.go | 154 +- .../x/sys/unix/zsyscall_linux_mips.go | 279 +- .../x/sys/unix/zsyscall_linux_mips64.go | 220 +- .../x/sys/unix/zsyscall_linux_mips64le.go | 220 +- .../x/sys/unix/zsyscall_linux_mipsle.go | 279 +- .../x/sys/unix/zsyscall_linux_ppc64.go | 213 +- .../x/sys/unix/zsyscall_linux_ppc64le.go | 213 +- .../x/sys/unix/zsyscall_linux_s390x.go | 199 +- .../x/sys/unix/zsyscall_linux_sparc64.go | 501 +- .../x/sys/unix/zsyscall_netbsd_386.go | 93 + .../x/sys/unix/zsyscall_netbsd_amd64.go | 93 + .../x/sys/unix/zsyscall_netbsd_arm.go | 93 + .../x/sys/unix/zsyscall_openbsd_386.go | 104 + .../x/sys/unix/zsyscall_openbsd_amd64.go | 104 + .../x/sys/unix/zsyscall_openbsd_arm.go | 104 + .../x/sys/unix/zsyscall_solaris_amd64.go | 67 + ...sctl_openbsd.go => zsysctl_openbsd_386.go} | 2 +- .../x/sys/unix/zsysctl_openbsd_amd64.go | 257 + .../x/sys/unix/zsysctl_openbsd_arm.go | 270 + .../x/sys/unix/zsysnum_darwin_386.go | 60 +- .../x/sys/unix/zsysnum_darwin_amd64.go | 60 +- .../x/sys/unix/zsysnum_darwin_arm.go | 14 +- .../x/sys/unix/zsysnum_darwin_arm64.go | 14 +- .../x/sys/unix/zsysnum_linux_ppc64.go | 3 + .../x/sys/unix/zsysnum_linux_ppc64le.go | 3 + .../x/sys/unix/zsysnum_linux_s390x.go | 46 +- .../x/sys/unix/zsysnum_linux_sparc64.go | 2 +- .../x/sys/unix/zsysnum_netbsd_386.go | 2 +- .../x/sys/unix/zsysnum_netbsd_amd64.go | 2 +- .../x/sys/unix/zsysnum_netbsd_arm.go | 2 +- .../x/sys/unix/zsysnum_openbsd_386.go | 2 +- .../x/sys/unix/zsysnum_openbsd_amd64.go | 24 +- .../x/sys/unix/zsysnum_openbsd_arm.go | 2 +- .../x/sys/unix/zsysnum_solaris_amd64.go | 13 - .../x/sys/unix/ztypes_darwin_386.go | 139 +- .../x/sys/unix/ztypes_darwin_amd64.go | 185 +- .../x/sys/unix/ztypes_darwin_arm.go | 139 +- .../x/sys/unix/ztypes_darwin_arm64.go | 190 +- .../x/sys/unix/ztypes_dragonfly_amd64.go | 138 +- .../x/sys/unix/ztypes_freebsd_386.go | 32 + .../x/sys/unix/ztypes_freebsd_amd64.go | 32 + .../x/sys/unix/ztypes_freebsd_arm.go | 32 + .../golang.org/x/sys/unix/ztypes_linux_386.go | 1377 +++- .../x/sys/unix/ztypes_linux_amd64.go | 1385 +++- .../golang.org/x/sys/unix/ztypes_linux_arm.go | 1395 +++- .../x/sys/unix/ztypes_linux_arm64.go | 1387 +++- .../x/sys/unix/ztypes_linux_mips.go | 1359 +++- .../x/sys/unix/ztypes_linux_mips64.go | 1383 +++- .../x/sys/unix/ztypes_linux_mips64le.go | 1383 +++- .../x/sys/unix/ztypes_linux_mipsle.go | 1359 +++- .../x/sys/unix/ztypes_linux_ppc64.go | 1393 +++- .../x/sys/unix/ztypes_linux_ppc64le.go | 1393 +++- .../x/sys/unix/ztypes_linux_s390x.go | 1293 +++- .../x/sys/unix/ztypes_linux_sparc64.go | 222 +- .../x/sys/unix/ztypes_netbsd_386.go | 51 +- .../x/sys/unix/ztypes_netbsd_amd64.go | 51 +- .../x/sys/unix/ztypes_netbsd_arm.go | 51 +- .../x/sys/unix/ztypes_openbsd_386.go | 42 +- .../x/sys/unix/ztypes_openbsd_amd64.go | 133 +- .../x/sys/unix/ztypes_openbsd_arm.go | 42 +- .../x/sys/unix/ztypes_solaris_amd64.go | 203 +- .../x/sys/windows/asm_windows_386.s | 4 +- .../x/sys/windows/asm_windows_amd64.s | 2 +- .../golang.org/x/sys/windows/dll_windows.go | 9 +- vendor/golang.org/x/sys/windows/env_unset.go | 15 - .../golang.org/x/sys/windows/env_windows.go | 6 +- .../x/sys/windows/memory_windows.go | 2 +- vendor/golang.org/x/sys/windows/mksyscall.go | 2 +- vendor/golang.org/x/sys/windows/race.go | 2 +- vendor/golang.org/x/sys/windows/race0.go | 2 +- .../x/sys/windows/security_windows.go | 47 +- vendor/golang.org/x/sys/windows/service.go | 19 + vendor/golang.org/x/sys/windows/svc/go12.go | 2 +- vendor/golang.org/x/sys/windows/svc/go13.go | 2 +- .../golang.org/x/sys/windows/svc/service.go | 4 +- .../golang.org/x/sys/windows/svc/sys_amd64.s | 2 +- vendor/golang.org/x/sys/windows/syscall.go | 9 +- .../x/sys/windows/syscall_windows.go | 148 +- .../golang.org/x/sys/windows/types_windows.go | 124 +- .../x/sys/windows/types_windows_386.go | 2 +- .../x/sys/windows/types_windows_amd64.go | 2 +- .../x/sys/windows/zsyscall_windows.go | 274 +- 352 files changed, 43348 insertions(+), 9244 deletions(-) create mode 100644 vendor/github.com/containerd/cgroups/rdma.go create mode 100644 vendor/github.com/containerd/containerd/cmd/ctr/commands/install/install.go create mode 100644 vendor/github.com/containerd/containerd/cmd/ctr/commands/leases/leases.go create mode 100644 vendor/github.com/containerd/containerd/cmd/ctr/commands/tasks/metrics.go create mode 100644 vendor/github.com/containerd/containerd/install.go create mode 100644 vendor/github.com/containerd/containerd/install_opts.go create mode 100644 vendor/github.com/containerd/containerd/leases/id.go create mode 100644 vendor/github.com/containerd/containerd/leases/lease.go create mode 100644 vendor/github.com/containerd/containerd/leases/proxy/manager.go rename vendor/github.com/containerd/containerd/runtime/{ => v1}/linux/bundle.go (97%) rename vendor/github.com/containerd/containerd/runtime/{ => v1}/linux/proc/deleted_state.go (100%) rename vendor/github.com/containerd/containerd/runtime/{ => v1}/linux/proc/exec.go (97%) rename vendor/github.com/containerd/containerd/runtime/{ => v1}/linux/proc/exec_state.go (100%) rename vendor/github.com/containerd/containerd/runtime/{ => v1}/linux/proc/init.go (67%) rename vendor/github.com/containerd/containerd/runtime/{ => v1}/linux/proc/init_state.go (98%) rename vendor/github.com/containerd/containerd/runtime/{ => v1}/linux/proc/io.go (100%) rename vendor/github.com/containerd/containerd/runtime/{ => v1}/linux/proc/process.go (100%) rename vendor/github.com/containerd/containerd/runtime/{ => v1}/linux/proc/types.go (86%) rename vendor/github.com/containerd/containerd/runtime/{ => v1}/linux/proc/utils.go (100%) rename vendor/github.com/containerd/containerd/runtime/{ => v1}/linux/process.go (90%) rename vendor/github.com/containerd/containerd/runtime/{ => v1}/linux/runtime.go (81%) rename vendor/github.com/containerd/containerd/runtime/{ => v1}/linux/task.go (85%) rename vendor/github.com/containerd/containerd/runtime/{ => v1}/shim/client/client.go (98%) rename vendor/github.com/containerd/containerd/runtime/{ => v1}/shim/client/client_linux.go (100%) rename vendor/github.com/containerd/containerd/runtime/{ => v1}/shim/client/client_unix.go (100%) rename vendor/github.com/containerd/containerd/runtime/{ => v1}/shim/local.go (98%) rename vendor/github.com/containerd/containerd/runtime/{ => v1}/shim/reaper.go (100%) rename vendor/github.com/containerd/containerd/runtime/{ => v1}/shim/service.go (84%) rename vendor/github.com/containerd/containerd/runtime/{ => v1}/shim/service_linux.go (100%) rename vendor/github.com/containerd/containerd/runtime/{ => v1}/shim/service_unix.go (100%) rename vendor/github.com/containerd/containerd/runtime/{ => v1}/shim/v1/doc.go (100%) rename vendor/github.com/containerd/containerd/runtime/{ => v1}/shim/v1/shim.pb.go (93%) rename vendor/github.com/containerd/containerd/runtime/{ => v1}/shim/v1/shim.proto (97%) create mode 100644 vendor/github.com/containerd/containerd/runtime/v2/README.md create mode 100644 vendor/github.com/containerd/containerd/runtime/v2/binary.go create mode 100644 vendor/github.com/containerd/containerd/runtime/v2/bundle.go create mode 100644 vendor/github.com/containerd/containerd/runtime/v2/manager.go create mode 100644 vendor/github.com/containerd/containerd/runtime/v2/process.go create mode 100644 vendor/github.com/containerd/containerd/runtime/v2/runc/options/doc.go create mode 100644 vendor/github.com/containerd/containerd/runtime/v2/runc/options/oci.pb.go create mode 100644 vendor/github.com/containerd/containerd/runtime/v2/runc/options/oci.proto create mode 100644 vendor/github.com/containerd/containerd/runtime/v2/shim.go create mode 100644 vendor/github.com/containerd/containerd/runtime/v2/shim/reaper_unix.go create mode 100644 vendor/github.com/containerd/containerd/runtime/v2/shim/shim.go create mode 100644 vendor/github.com/containerd/containerd/runtime/v2/shim/shim_darwin.go create mode 100644 vendor/github.com/containerd/containerd/runtime/v2/shim/shim_linux.go create mode 100644 vendor/github.com/containerd/containerd/runtime/v2/shim/shim_unix.go create mode 100644 vendor/github.com/containerd/containerd/runtime/v2/shim/shim_windows.go create mode 100644 vendor/github.com/containerd/containerd/runtime/v2/shim/util.go create mode 100644 vendor/github.com/containerd/containerd/runtime/v2/shim/util_unix.go create mode 100644 vendor/github.com/containerd/containerd/runtime/v2/shim/util_windows.go create mode 100644 vendor/github.com/containerd/containerd/runtime/v2/shim_unix.go create mode 100644 vendor/github.com/containerd/containerd/runtime/v2/shim_windows.go create mode 100644 vendor/github.com/containerd/containerd/runtime/v2/task/doc.go create mode 100644 vendor/github.com/containerd/containerd/runtime/v2/task/shim.pb.go create mode 100644 vendor/github.com/containerd/containerd/runtime/v2/task/shim.proto create mode 100644 vendor/github.com/containerd/containerd/services/tasks/local_unix.go create mode 100644 vendor/github.com/containerd/containerd/services/tasks/local_windows_v2.go create mode 100644 vendor/github.com/containerd/containerd/sys/reaper_linux.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_arm.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_arm64.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_gc_x86.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_gccgo.c create mode 100644 vendor/golang.org/x/sys/cpu/cpu_gccgo.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_mips64x.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_mipsx.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_ppc64x.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_s390x.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_x86.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_x86.s create mode 100644 vendor/golang.org/x/sys/unix/affinity_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/env_unset.go rename vendor/golang.org/x/sys/unix/{flock.go => fcntl.go} (70%) rename vendor/golang.org/x/sys/unix/{flock_linux_32bit.go => fcntl_linux_32bit.go} (100%) delete mode 100644 vendor/golang.org/x/sys/unix/file_unix.go create mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_gc.go create mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go create mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go create mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_no_getwd.go create mode 100644 vendor/golang.org/x/sys/unix/timestruct.go create mode 100644 vendor/golang.org/x/sys/unix/zptrace386_linux.go create mode 100644 vendor/golang.org/x/sys/unix/zptracearm_linux.go create mode 100644 vendor/golang.org/x/sys/unix/zptracemips_linux.go create mode 100644 vendor/golang.org/x/sys/unix/zptracemipsle_linux.go rename vendor/golang.org/x/sys/unix/{zsysctl_openbsd.go => zsysctl_openbsd_386.go} (99%) create mode 100644 vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go create mode 100644 vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_solaris_amd64.go delete mode 100644 vendor/golang.org/x/sys/windows/env_unset.go diff --git a/cmd/containerd/containerd.go b/cmd/containerd/containerd.go index bb98ff30a..3b4a7a61c 100644 --- a/cmd/containerd/containerd.go +++ b/cmd/containerd/containerd.go @@ -25,7 +25,7 @@ import ( _ "github.com/containerd/containerd/diff/walking/plugin" _ "github.com/containerd/containerd/gc/scheduler" _ "github.com/containerd/containerd/metrics/cgroups" - _ "github.com/containerd/containerd/runtime/linux" + _ "github.com/containerd/containerd/runtime/v1/linux" _ "github.com/containerd/containerd/services/containers" _ "github.com/containerd/containerd/services/content" _ "github.com/containerd/containerd/services/diff" diff --git a/cri.go b/cri.go index b51b284de..ba94ebc4e 100644 --- a/cri.go +++ b/cri.go @@ -24,10 +24,10 @@ import ( "github.com/containerd/containerd/api/services/containers/v1" "github.com/containerd/containerd/api/services/diff/v1" "github.com/containerd/containerd/api/services/images/v1" - "github.com/containerd/containerd/api/services/leases/v1" "github.com/containerd/containerd/api/services/namespaces/v1" "github.com/containerd/containerd/api/services/tasks/v1" "github.com/containerd/containerd/content" + "github.com/containerd/containerd/leases" "github.com/containerd/containerd/log" "github.com/containerd/containerd/platforms" "github.com/containerd/containerd/plugin" @@ -137,7 +137,7 @@ func getServicesOpts(ic *plugin.InitContext) ([]containerd.ServicesOpt, error) { return containerd.WithNamespaceService(s.(namespaces.NamespacesClient)) }, services.LeasesService: func(s interface{}) containerd.ServicesOpt { - return containerd.WithLeasesService(s.(leases.LeasesClient)) + return containerd.WithLeasesService(s.(leases.Manager)) }, } { p := plugins[s] diff --git a/pkg/containerd/importer/importer.go b/pkg/containerd/importer/importer.go index 0ec9b869c..eabce9ca6 100644 --- a/pkg/containerd/importer/importer.go +++ b/pkg/containerd/importer/importer.go @@ -123,7 +123,7 @@ func Import(ctx context.Context, client *containerd.Client, reader io.Reader, op defer deferCancel() if err := done(deferCtx); err != nil { // Get lease id from context still works after context is done. - leaseID, _ := leases.Lease(ctx) + leaseID, _ := leases.FromContext(ctx) log.G(ctx).WithError(err).Errorf("Failed to release lease %q", leaseID) } }() diff --git a/vendor.conf b/vendor.conf index 4fca291a6..3d3a7a314 100644 --- a/vendor.conf +++ b/vendor.conf @@ -2,13 +2,13 @@ github.com/beorn7/perks 4c0e84591b9aa9e6dcfdf3e020114cd81f89d5f9 github.com/blang/semver v3.1.0 github.com/boltdb/bolt e9cf4fae01b5a8ff89d0ec6b32f0d9c9f79aefdd github.com/BurntSushi/toml a368813c5e648fee92e5f6c30e3944ff9d5e8895 -github.com/containerd/cgroups fe281dd265766145e943a034aa41086474ea6130 -github.com/containerd/console 5d1b48d6114b8c9666f0c8b916f871af97b0a761 -github.com/containerd/containerd b382b6fe0bdbf7604c0a4f5c2089c0b159ad58b2 +github.com/containerd/cgroups 5e610833b72089b37d0e615de9a92dfc043757c2 +github.com/containerd/console 4d8a41f4ce5b9bae77c41786ea2458330f43f081 +github.com/containerd/containerd b9eeaa1ce83dd9970605ddbd0b35d4d3fa5f87bd github.com/containerd/continuity d3c23511c1bf5851696cba83143d9cbcd666869b github.com/containerd/fifo 3d5202aec260678c48179c56f40e6f38a095738c github.com/containerd/go-cni 5882530828ecf62032409b298a3e8b19e08b6534 -github.com/containerd/go-runc f271fa2021de855d4d918dbef83c5fe19db1bdd5 +github.com/containerd/go-runc edcf3de1f4971445c42d61f20d506b30612aa031 github.com/containerd/ttrpc 94dde388801693c54f88a6596f713b51a8b30b2d github.com/containerd/typeurl a93fcdb778cd272c6e9b3028b2f42d813e785d40 github.com/containernetworking/cni v0.6.0 @@ -41,7 +41,7 @@ github.com/modern-go/reflect2 05fbef0ca5da472bbf96c9322b84a53edc03c9fd github.com/opencontainers/go-digest c9281466c8b2f606084ac71339773efd177436e7 github.com/opencontainers/image-spec v1.0.1 github.com/opencontainers/runc 69663f0bd4b60df09991c08812a60108003fa340 -github.com/opencontainers/runtime-spec v1.0.1 +github.com/opencontainers/runtime-spec d810dbc60d8c5aeeb3d054bd1132fab2121968ce github.com/opencontainers/runtime-tools v0.6.0 github.com/opencontainers/selinux 4a2974bf1ee960774ffd517717f1f45325af0206 github.com/pkg/errors v0.8.0 @@ -62,7 +62,7 @@ github.com/xeipuuv/gojsonschema 1d523034197ff1f222f6429836dd36a2457a1874 golang.org/x/crypto 49796115aa4b964c318aad4f3084fdb41e9aa067 golang.org/x/net b3756b4b77d7b13260a0a2ec658753cf48922eac golang.org/x/sync 450f422ab23cf9881c94e2db30cac0eb1b7cf80c -golang.org/x/sys 314a259e304ff91bd6985da2a7149bbf91237993 https://github.com/golang/sys +golang.org/x/sys 1b2967e3c290b7c545b3db0deeda16e9be4f98a2 https://github.com/golang/sys golang.org/x/text 19e51611da83d6be54ddafce4a4af510cb3e9ea4 golang.org/x/time f51c12702a4d776e4c1fa9b0fabab841babae631 google.golang.org/genproto d80a6e20e776b0b17a324d0ba1ab50a39c8e8944 diff --git a/vendor/github.com/containerd/cgroups/cgroup.go b/vendor/github.com/containerd/cgroups/cgroup.go index d4c40f749..7959feb49 100644 --- a/vendor/github.com/containerd/cgroups/cgroup.go +++ b/vendor/github.com/containerd/cgroups/cgroup.go @@ -137,6 +137,36 @@ func (c *cgroup) add(process Process) error { return nil } +// AddTask moves the provided tasks (threads) into the new cgroup +func (c *cgroup) AddTask(process Process) error { + if process.Pid <= 0 { + return ErrInvalidPid + } + c.mu.Lock() + defer c.mu.Unlock() + if c.err != nil { + return c.err + } + return c.addTask(process) +} + +func (c *cgroup) addTask(process Process) error { + for _, s := range pathers(c.subsystems) { + p, err := c.path(s.Name()) + if err != nil { + return err + } + if err := ioutil.WriteFile( + filepath.Join(s.Path(p), cgroupTasks), + []byte(strconv.Itoa(process.Pid)), + defaultFilePerm, + ); err != nil { + return err + } + } + return nil +} + // Delete will remove the control group from each of the subsystems registered func (c *cgroup) Delete() error { c.mu.Lock() diff --git a/vendor/github.com/containerd/cgroups/control.go b/vendor/github.com/containerd/cgroups/control.go index a554a528f..63e2df93d 100644 --- a/vendor/github.com/containerd/cgroups/control.go +++ b/vendor/github.com/containerd/cgroups/control.go @@ -24,6 +24,7 @@ import ( const ( cgroupProcs = "cgroup.procs" + cgroupTasks = "tasks" defaultDirPerm = 0755 ) @@ -48,8 +49,10 @@ type Process struct { type Cgroup interface { // New creates a new cgroup under the calling cgroup New(string, *specs.LinuxResources) (Cgroup, error) - // Add adds a process to the cgroup + // Add adds a process to the cgroup (cgroup.procs) Add(Process) error + // AddTask adds a process to the cgroup (tasks) + AddTask(Process) error // Delete removes the cgroup as a whole Delete() error // MoveTo moves all the processes under the calling cgroup to the provided one diff --git a/vendor/github.com/containerd/cgroups/cpuset.go b/vendor/github.com/containerd/cgroups/cpuset.go index 50d95da93..f182aa68c 100644 --- a/vendor/github.com/containerd/cgroups/cpuset.go +++ b/vendor/github.com/containerd/cgroups/cpuset.go @@ -82,6 +82,10 @@ func (c *cpusetController) Create(path string, resources *specs.LinuxResources) return nil } +func (c *cpusetController) Update(path string, resources *specs.LinuxResources) error { + return c.Create(path, resources) +} + func (c *cpusetController) getValues(path string) (cpus []byte, mems []byte, err error) { if cpus, err = ioutil.ReadFile(filepath.Join(path, "cpuset.cpus")); err != nil && !os.IsNotExist(err) { return diff --git a/vendor/github.com/containerd/cgroups/metrics.pb.go b/vendor/github.com/containerd/cgroups/metrics.pb.go index c1125588a..6043a8f7d 100644 --- a/vendor/github.com/containerd/cgroups/metrics.pb.go +++ b/vendor/github.com/containerd/cgroups/metrics.pb.go @@ -19,6 +19,8 @@ MemoryEntry BlkIOStat BlkIOEntry + RdmaStat + RdmaEntry */ package cgroups @@ -49,6 +51,7 @@ type Metrics struct { CPU *CPUStat `protobuf:"bytes,3,opt,name=cpu" json:"cpu,omitempty"` Memory *MemoryStat `protobuf:"bytes,4,opt,name=memory" json:"memory,omitempty"` Blkio *BlkIOStat `protobuf:"bytes,5,opt,name=blkio" json:"blkio,omitempty"` + Rdma *RdmaStat `protobuf:"bytes,6,opt,name=rdma" json:"rdma,omitempty"` } func (m *Metrics) Reset() { *m = Metrics{} } @@ -187,6 +190,25 @@ func (m *BlkIOEntry) Reset() { *m = BlkIOEntry{} } func (*BlkIOEntry) ProtoMessage() {} func (*BlkIOEntry) Descriptor() ([]byte, []int) { return fileDescriptorMetrics, []int{9} } +type RdmaStat struct { + Current []*RdmaEntry `protobuf:"bytes,1,rep,name=current" json:"current,omitempty"` + Limit []*RdmaEntry `protobuf:"bytes,2,rep,name=limit" json:"limit,omitempty"` +} + +func (m *RdmaStat) Reset() { *m = RdmaStat{} } +func (*RdmaStat) ProtoMessage() {} +func (*RdmaStat) Descriptor() ([]byte, []int) { return fileDescriptorMetrics, []int{10} } + +type RdmaEntry struct { + Device string `protobuf:"bytes,1,opt,name=device,proto3" json:"device,omitempty"` + HcaHandles uint32 `protobuf:"varint,2,opt,name=hca_handles,json=hcaHandles,proto3" json:"hca_handles,omitempty"` + HcaObjects uint32 `protobuf:"varint,3,opt,name=hca_objects,json=hcaObjects,proto3" json:"hca_objects,omitempty"` +} + +func (m *RdmaEntry) Reset() { *m = RdmaEntry{} } +func (*RdmaEntry) ProtoMessage() {} +func (*RdmaEntry) Descriptor() ([]byte, []int) { return fileDescriptorMetrics, []int{11} } + func init() { proto.RegisterType((*Metrics)(nil), "io.containerd.cgroups.v1.Metrics") proto.RegisterType((*HugetlbStat)(nil), "io.containerd.cgroups.v1.HugetlbStat") @@ -198,6 +220,8 @@ func init() { proto.RegisterType((*MemoryEntry)(nil), "io.containerd.cgroups.v1.MemoryEntry") proto.RegisterType((*BlkIOStat)(nil), "io.containerd.cgroups.v1.BlkIOStat") proto.RegisterType((*BlkIOEntry)(nil), "io.containerd.cgroups.v1.BlkIOEntry") + proto.RegisterType((*RdmaStat)(nil), "io.containerd.cgroups.v1.RdmaStat") + proto.RegisterType((*RdmaEntry)(nil), "io.containerd.cgroups.v1.RdmaEntry") } func (m *Metrics) Marshal() (dAtA []byte, err error) { size := m.Size() @@ -266,6 +290,16 @@ func (m *Metrics) MarshalTo(dAtA []byte) (int, error) { } i += n4 } + if m.Rdma != nil { + dAtA[i] = 0x32 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.Rdma.Size())) + n5, err := m.Rdma.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + } return i, nil } @@ -732,6 +766,7 @@ func (m *MemoryEntry) MarshalTo(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Limit != 0 { dAtA[i] = 0x8 i++ @@ -914,6 +949,82 @@ func (m *BlkIOEntry) MarshalTo(dAtA []byte) (int, error) { return i, nil } +func (m *RdmaStat) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RdmaStat) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Current) > 0 { + for _, msg := range m.Current { + dAtA[i] = 0xa + i++ + i = encodeVarintMetrics(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.Limit) > 0 { + for _, msg := range m.Limit { + dAtA[i] = 0x12 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *RdmaEntry) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RdmaEntry) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Device) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintMetrics(dAtA, i, uint64(len(m.Device))) + i += copy(dAtA[i:], m.Device) + } + if m.HcaHandles != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.HcaHandles)) + } + if m.HcaObjects != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.HcaObjects)) + } + return i, nil +} + func encodeFixed64Metrics(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) dAtA[offset+1] = uint8(v >> 8) @@ -966,6 +1077,10 @@ func (m *Metrics) Size() (n int) { l = m.Blkio.Size() n += 1 + l + sovMetrics(uint64(l)) } + if m.Rdma != nil { + l = m.Rdma.Size() + n += 1 + l + sovMetrics(uint64(l)) + } return n } @@ -1264,6 +1379,40 @@ func (m *BlkIOEntry) Size() (n int) { return n } +func (m *RdmaStat) Size() (n int) { + var l int + _ = l + if len(m.Current) > 0 { + for _, e := range m.Current { + l = e.Size() + n += 1 + l + sovMetrics(uint64(l)) + } + } + if len(m.Limit) > 0 { + for _, e := range m.Limit { + l = e.Size() + n += 1 + l + sovMetrics(uint64(l)) + } + } + return n +} + +func (m *RdmaEntry) Size() (n int) { + var l int + _ = l + l = len(m.Device) + if l > 0 { + n += 1 + l + sovMetrics(uint64(l)) + } + if m.HcaHandles != 0 { + n += 1 + sovMetrics(uint64(m.HcaHandles)) + } + if m.HcaObjects != 0 { + n += 1 + sovMetrics(uint64(m.HcaObjects)) + } + return n +} + func sovMetrics(x uint64) (n int) { for { n++ @@ -1287,6 +1436,7 @@ func (this *Metrics) String() string { `CPU:` + strings.Replace(fmt.Sprintf("%v", this.CPU), "CPUStat", "CPUStat", 1) + `,`, `Memory:` + strings.Replace(fmt.Sprintf("%v", this.Memory), "MemoryStat", "MemoryStat", 1) + `,`, `Blkio:` + strings.Replace(fmt.Sprintf("%v", this.Blkio), "BlkIOStat", "BlkIOStat", 1) + `,`, + `Rdma:` + strings.Replace(fmt.Sprintf("%v", this.Rdma), "RdmaStat", "RdmaStat", 1) + `,`, `}`, }, "") return s @@ -1440,6 +1590,29 @@ func (this *BlkIOEntry) String() string { }, "") return s } +func (this *RdmaStat) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&RdmaStat{`, + `Current:` + strings.Replace(fmt.Sprintf("%v", this.Current), "RdmaEntry", "RdmaEntry", 1) + `,`, + `Limit:` + strings.Replace(fmt.Sprintf("%v", this.Limit), "RdmaEntry", "RdmaEntry", 1) + `,`, + `}`, + }, "") + return s +} +func (this *RdmaEntry) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&RdmaEntry{`, + `Device:` + fmt.Sprintf("%v", this.Device) + `,`, + `HcaHandles:` + fmt.Sprintf("%v", this.HcaHandles) + `,`, + `HcaObjects:` + fmt.Sprintf("%v", this.HcaObjects) + `,`, + `}`, + }, "") + return s +} func valueToStringMetrics(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { @@ -1451,6 +1624,7 @@ func valueToStringMetrics(v interface{}) string { func (m *Metrics) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 + for iNdEx < l { preIndex := iNdEx var wire uint64 @@ -1640,6 +1814,39 @@ func (m *Metrics) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rdma", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMetrics + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Rdma == nil { + m.Rdma = &RdmaStat{} + } + if err := m.Rdma.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipMetrics(dAtA[iNdEx:]) @@ -3656,6 +3863,236 @@ func (m *BlkIOEntry) Unmarshal(dAtA []byte) error { } return nil } +func (m *RdmaStat) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RdmaStat: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RdmaStat: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Current", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMetrics + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Current = append(m.Current, &RdmaEntry{}) + if err := m.Current[len(m.Current)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMetrics + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Limit = append(m.Limit, &RdmaEntry{}) + if err := m.Limit[len(m.Limit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipMetrics(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthMetrics + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RdmaEntry) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RdmaEntry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RdmaEntry: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Device", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMetrics + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Device = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HcaHandles", wireType) + } + m.HcaHandles = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.HcaHandles |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HcaObjects", wireType) + } + m.HcaObjects = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.HcaObjects |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipMetrics(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthMetrics + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + func skipMetrics(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/vendor/github.com/containerd/cgroups/metrics.proto b/vendor/github.com/containerd/cgroups/metrics.proto index 8c3c3c4bd..642623fce 100644 --- a/vendor/github.com/containerd/cgroups/metrics.proto +++ b/vendor/github.com/containerd/cgroups/metrics.proto @@ -10,6 +10,7 @@ message Metrics { CPUStat cpu = 3 [(gogoproto.customname) = "CPU"]; MemoryStat memory = 4; BlkIOStat blkio = 5; + RdmaStat rdma = 6; } message HugetlbStat { @@ -109,3 +110,14 @@ message BlkIOEntry { uint64 minor = 4; uint64 value = 5; } + +message RdmaStat { + repeated RdmaEntry current = 1; + repeated RdmaEntry limit = 2; +} + +message RdmaEntry { + string device = 1; + uint32 hca_handles = 2; + uint32 hca_objects = 3; +} diff --git a/vendor/github.com/containerd/cgroups/rdma.go b/vendor/github.com/containerd/cgroups/rdma.go new file mode 100644 index 000000000..4f423d33a --- /dev/null +++ b/vendor/github.com/containerd/cgroups/rdma.go @@ -0,0 +1,153 @@ +/* + 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 cgroups + +import ( + "io/ioutil" + "math" + "os" + "path/filepath" + "strconv" + "strings" + + specs "github.com/opencontainers/runtime-spec/specs-go" +) + +type rdmaController struct { + root string +} + +func (p *rdmaController) Name() Name { + return Rdma +} + +func (p *rdmaController) Path(path string) string { + return filepath.Join(p.root, path) +} + +func NewRdma(root string) *rdmaController { + return &rdmaController{ + root: filepath.Join(root, string(Rdma)), + } +} + +func createCmdString(device string, limits *specs.LinuxRdma) string { + var cmdString string + + cmdString = device + if limits.HcaHandles != nil { + cmdString = cmdString + " " + "hca_handle=" + strconv.FormatUint(uint64(*limits.HcaHandles), 10) + } + + if limits.HcaObjects != nil { + cmdString = cmdString + " " + "hca_object=" + strconv.FormatUint(uint64(*limits.HcaObjects), 10) + } + return cmdString +} + +func (p *rdmaController) Create(path string, resources *specs.LinuxResources) error { + if err := os.MkdirAll(p.Path(path), defaultDirPerm); err != nil { + return err + } + + for device, limit := range resources.Rdma { + if device != "" && (limit.HcaHandles != nil || limit.HcaObjects != nil) { + return ioutil.WriteFile( + filepath.Join(p.Path(path), "rdma.max"), + []byte(createCmdString(device, &limit)), + defaultFilePerm, + ) + } + } + return nil +} + +func (p *rdmaController) Update(path string, resources *specs.LinuxResources) error { + return p.Create(path, resources) +} + +func parseRdmaKV(raw string, entry *RdmaEntry) { + var value uint64 + var err error + + parts := strings.Split(raw, "=") + switch len(parts) { + case 2: + if parts[1] == "max" { + value = math.MaxUint32 + } else { + value, err = parseUint(parts[1], 10, 32) + if err != nil { + return + } + } + if parts[0] == "hca_handle" { + entry.HcaHandles = uint32(value) + } else if parts[0] == "hca_object" { + entry.HcaObjects = uint32(value) + } + } +} + +func toRdmaEntry(strEntries []string) []*RdmaEntry { + var rdmaEntries []*RdmaEntry + for i := range strEntries { + parts := strings.Fields(strEntries[i]) + switch len(parts) { + case 3: + entry := new(RdmaEntry) + entry.Device = parts[0] + parseRdmaKV(parts[1], entry) + parseRdmaKV(parts[2], entry) + + rdmaEntries = append(rdmaEntries, entry) + default: + continue + } + } + return rdmaEntries +} + +func (p *rdmaController) Stat(path string, stats *Metrics) error { + + currentData, err := ioutil.ReadFile(filepath.Join(p.Path(path), "rdma.current")) + if err != nil { + return err + } + currentPerDevices := strings.Split(string(currentData), "\n") + + maxData, err := ioutil.ReadFile(filepath.Join(p.Path(path), "rdma.max")) + if err != nil { + return err + } + maxPerDevices := strings.Split(string(maxData), "\n") + + // If device got removed between reading two files, ignore returning + // stats. + if len(currentPerDevices) != len(maxPerDevices) { + return nil + } + + currentEntries := toRdmaEntry(currentPerDevices) + maxEntries := toRdmaEntry(maxPerDevices) + + stats.Rdma = &RdmaStat{ + Current: currentEntries, + Limit: maxEntries, + } + return nil +} diff --git a/vendor/github.com/containerd/cgroups/subsystem.go b/vendor/github.com/containerd/cgroups/subsystem.go index e1f10ec68..933a6c38d 100644 --- a/vendor/github.com/containerd/cgroups/subsystem.go +++ b/vendor/github.com/containerd/cgroups/subsystem.go @@ -38,6 +38,7 @@ const ( Cpuacct Name = "cpuacct" Memory Name = "memory" Blkio Name = "blkio" + Rdma Name = "rdma" ) // Subsystems returns a complete list of the default cgroups @@ -55,6 +56,7 @@ func Subsystems() []Name { Cpuacct, Memory, Blkio, + Rdma, } if !isUserNS { n = append(n, Devices) diff --git a/vendor/github.com/containerd/cgroups/utils.go b/vendor/github.com/containerd/cgroups/utils.go index 4e6a27054..345be4e46 100644 --- a/vendor/github.com/containerd/cgroups/utils.go +++ b/vendor/github.com/containerd/cgroups/utils.go @@ -80,6 +80,7 @@ func defaults(root string) ([]Subsystem, error) { NewCpuacct(root), NewMemory(root), NewBlkio(root), + NewRdma(root), } // only add the devices cgroup if we are not in a user namespace // because modifications are not allowed diff --git a/vendor/github.com/containerd/containerd/README.md b/vendor/github.com/containerd/containerd/README.md index 2130d68cf..a8acc9181 100644 --- a/vendor/github.com/containerd/containerd/README.md +++ b/vendor/github.com/containerd/containerd/README.md @@ -166,7 +166,7 @@ If you have [criu](https://criu.org/Main_Page) installed on your machine you can ```go // checkpoint the task then push it to a registry -checkpoint, err := task.Checkpoint(context, containerd.WithExit) +checkpoint, err := task.Checkpoint(context) err := client.Push(context, "myregistry/checkpoints/redis:master", checkpoint) @@ -184,6 +184,28 @@ defer task.Delete(context) err := task.Start(context) ``` +### Snapshot Plugins + +In addition to the built-in Snapshot plugins in containerd, additional external +plugins can be configured using GRPC. An external plugin is made available using +the configured name and appears as a plugin alongside the built-in ones. + +To add an external snapshot plugin, add the plugin to containerd's config file +(by default at `/etc/containerd/config.toml`). The string following +`proxy_plugin.` will be used as the name of the snapshotter and the address +should refer to a socket with a GRPC listener serving containerd's Snapshot +GRPC API. Remember to restart containerd for any configuration changes to take +effect. + +``` +[proxy_plugins] + [proxy_plugins.customsnapshot] + type = "snapshot" + address = "/var/run/mysnapshotter.sock" +``` + +See [PLUGINS.md](PLUGINS.md) for how to create plugins + ### Releases and API Stability Please see [RELEASES.md](RELEASES.md) for details on versioning and stability diff --git a/vendor/github.com/containerd/containerd/api/services/containers/v1/containers.pb.go b/vendor/github.com/containerd/containerd/api/services/containers/v1/containers.pb.go index a8720bb6f..4d9322164 100644 --- a/vendor/github.com/containerd/containerd/api/services/containers/v1/containers.pb.go +++ b/vendor/github.com/containerd/containerd/api/services/containers/v1/containers.pb.go @@ -18,6 +18,7 @@ UpdateContainerRequest UpdateContainerResponse DeleteContainerRequest + ListContainerMessage */ package containers @@ -218,6 +219,14 @@ func (m *DeleteContainerRequest) Reset() { *m = DeleteContain func (*DeleteContainerRequest) ProtoMessage() {} func (*DeleteContainerRequest) Descriptor() ([]byte, []int) { return fileDescriptorContainers, []int{9} } +type ListContainerMessage struct { + Container *Container `protobuf:"bytes,1,opt,name=container" json:"container,omitempty"` +} + +func (m *ListContainerMessage) Reset() { *m = ListContainerMessage{} } +func (*ListContainerMessage) ProtoMessage() {} +func (*ListContainerMessage) Descriptor() ([]byte, []int) { return fileDescriptorContainers, []int{10} } + func init() { proto.RegisterType((*Container)(nil), "containerd.services.containers.v1.Container") proto.RegisterType((*Container_Runtime)(nil), "containerd.services.containers.v1.Container.Runtime") @@ -230,6 +239,7 @@ func init() { proto.RegisterType((*UpdateContainerRequest)(nil), "containerd.services.containers.v1.UpdateContainerRequest") proto.RegisterType((*UpdateContainerResponse)(nil), "containerd.services.containers.v1.UpdateContainerResponse") proto.RegisterType((*DeleteContainerRequest)(nil), "containerd.services.containers.v1.DeleteContainerRequest") + proto.RegisterType((*ListContainerMessage)(nil), "containerd.services.containers.v1.ListContainerMessage") } // Reference imports to suppress errors if they are not otherwise used. @@ -245,6 +255,7 @@ const _ = grpc.SupportPackageIsVersion4 type ContainersClient interface { Get(ctx context.Context, in *GetContainerRequest, opts ...grpc.CallOption) (*GetContainerResponse, error) List(ctx context.Context, in *ListContainersRequest, opts ...grpc.CallOption) (*ListContainersResponse, error) + ListStream(ctx context.Context, in *ListContainersRequest, opts ...grpc.CallOption) (Containers_ListStreamClient, error) Create(ctx context.Context, in *CreateContainerRequest, opts ...grpc.CallOption) (*CreateContainerResponse, error) Update(ctx context.Context, in *UpdateContainerRequest, opts ...grpc.CallOption) (*UpdateContainerResponse, error) Delete(ctx context.Context, in *DeleteContainerRequest, opts ...grpc.CallOption) (*google_protobuf2.Empty, error) @@ -276,6 +287,38 @@ func (c *containersClient) List(ctx context.Context, in *ListContainersRequest, return out, nil } +func (c *containersClient) ListStream(ctx context.Context, in *ListContainersRequest, opts ...grpc.CallOption) (Containers_ListStreamClient, error) { + stream, err := grpc.NewClientStream(ctx, &_Containers_serviceDesc.Streams[0], c.cc, "/containerd.services.containers.v1.Containers/ListStream", opts...) + if err != nil { + return nil, err + } + x := &containersListStreamClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Containers_ListStreamClient interface { + Recv() (*ListContainerMessage, error) + grpc.ClientStream +} + +type containersListStreamClient struct { + grpc.ClientStream +} + +func (x *containersListStreamClient) Recv() (*ListContainerMessage, error) { + m := new(ListContainerMessage) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + func (c *containersClient) Create(ctx context.Context, in *CreateContainerRequest, opts ...grpc.CallOption) (*CreateContainerResponse, error) { out := new(CreateContainerResponse) err := grpc.Invoke(ctx, "/containerd.services.containers.v1.Containers/Create", in, out, c.cc, opts...) @@ -308,6 +351,7 @@ func (c *containersClient) Delete(ctx context.Context, in *DeleteContainerReques type ContainersServer interface { Get(context.Context, *GetContainerRequest) (*GetContainerResponse, error) List(context.Context, *ListContainersRequest) (*ListContainersResponse, error) + ListStream(*ListContainersRequest, Containers_ListStreamServer) error Create(context.Context, *CreateContainerRequest) (*CreateContainerResponse, error) Update(context.Context, *UpdateContainerRequest) (*UpdateContainerResponse, error) Delete(context.Context, *DeleteContainerRequest) (*google_protobuf2.Empty, error) @@ -353,6 +397,27 @@ func _Containers_List_Handler(srv interface{}, ctx context.Context, dec func(int return interceptor(ctx, in, info, handler) } +func _Containers_ListStream_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(ListContainersRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ContainersServer).ListStream(m, &containersListStreamServer{stream}) +} + +type Containers_ListStreamServer interface { + Send(*ListContainerMessage) error + grpc.ServerStream +} + +type containersListStreamServer struct { + grpc.ServerStream +} + +func (x *containersListStreamServer) Send(m *ListContainerMessage) error { + return x.ServerStream.SendMsg(m) +} + func _Containers_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(CreateContainerRequest) if err := dec(in); err != nil { @@ -432,7 +497,13 @@ var _Containers_serviceDesc = grpc.ServiceDesc{ Handler: _Containers_Delete_Handler, }, }, - Streams: []grpc.StreamDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "ListStream", + Handler: _Containers_ListStream_Handler, + ServerStreams: true, + }, + }, Metadata: "github.com/containerd/containerd/api/services/containers/v1/containers.proto", } @@ -842,6 +913,34 @@ func (m *DeleteContainerRequest) MarshalTo(dAtA []byte) (int, error) { return i, nil } +func (m *ListContainerMessage) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ListContainerMessage) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Container != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintContainers(dAtA, i, uint64(m.Container.Size())) + n13, err := m.Container.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n13 + } + return i, nil +} + func encodeVarintContainers(dAtA []byte, offset int, v uint64) int { for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) @@ -1004,6 +1103,16 @@ func (m *DeleteContainerRequest) Size() (n int) { return n } +func (m *ListContainerMessage) Size() (n int) { + var l int + _ = l + if m.Container != nil { + l = m.Container.Size() + n += 1 + l + sovContainers(uint64(l)) + } + return n +} + func sovContainers(x uint64) (n int) { for { n++ @@ -1158,6 +1267,16 @@ func (this *DeleteContainerRequest) String() string { }, "") return s } +func (this *ListContainerMessage) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ListContainerMessage{`, + `Container:` + strings.Replace(fmt.Sprintf("%v", this.Container), "Container", "Container", 1) + `,`, + `}`, + }, "") + return s +} func valueToStringContainers(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { @@ -2562,6 +2681,89 @@ func (m *DeleteContainerRequest) Unmarshal(dAtA []byte) error { } return nil } +func (m *ListContainerMessage) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ListContainerMessage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ListContainerMessage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Container", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthContainers + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Container == nil { + m.Container = &Container{} + } + if err := m.Container.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipContainers(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthContainers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipContainers(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 @@ -2672,54 +2874,57 @@ func init() { } var fileDescriptorContainers = []byte{ - // 776 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcd, 0x72, 0xd2, 0x50, - 0x14, 0x26, 0x81, 0x86, 0x72, 0x70, 0x46, 0xe7, 0x8a, 0x18, 0xe3, 0x0c, 0x50, 0x56, 0x8c, 0xa3, - 0xc1, 0xa2, 0xa3, 0xfd, 0x71, 0x53, 0xfa, 0x37, 0x8e, 0xad, 0xd3, 0x89, 0x3a, 0xe3, 0xe8, 0xa2, - 0x06, 0xb8, 0xa5, 0x91, 0xfc, 0x99, 0x7b, 0x61, 0x64, 0x5c, 0xe8, 0x23, 0xb8, 0xf3, 0x11, 0x7c, - 0x95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, 0x3a, 0x8a, 0xff, 0x6c, 0xb8, 0x67, 0xd7, 0x96, 0x31, 0xa1, - 0x73, 0xb3, 0xe5, 0x3e, 0xe4, 0xb7, 0xb0, 0x8e, 0x63, 0x5c, 0x99, 0xb0, 0x2c, 0xb5, 0xb3, 0x14, - 0x40, 0x38, 0x8c, 0xa8, 0x07, 0xc9, 0x5d, 0x4c, 0xd1, 0xa3, 0x29, 0x64, 0xc4, 0xac, 0xa4, 0xf4, - 0x78, 0x66, 0x9c, 0x6f, 0xc5, 0x27, 0x48, 0xb9, 0x6b, 0x81, 0xa6, 0xf9, 0x39, 0x8b, 0x5d, 0x39, - 0x69, 0xf5, 0x12, 0x48, 0xbf, 0xf8, 0x67, 0x10, 0xbc, 0xc9, 0x45, 0xd3, 0x90, 0xc4, 0x2f, 0x94, - 0xb4, 0x76, 0x19, 0x68, 0x28, 0xc0, 0x9b, 0x91, 0xa9, 0x04, 0xc4, 0xcf, 0xfd, 0x54, 0x02, 0x26, - 0x4d, 0xe2, 0x5b, 0x10, 0xbc, 0xb9, 0x99, 0x4a, 0x40, 0xfc, 0x88, 0x49, 0xf9, 0xb1, 0x8d, 0xd8, - 0x76, 0xff, 0x21, 0xd5, 0xdf, 0x9d, 0x9c, 0x17, 0x12, 0x3f, 0xcf, 0x0b, 0x89, 0x2f, 0x83, 0x02, - 0x77, 0x32, 0x28, 0x70, 0x3f, 0x06, 0x05, 0xee, 0x6c, 0x50, 0xe0, 0xde, 0xec, 0xfc, 0xc3, 0x9f, - 0xbe, 0xf5, 0x30, 0x7a, 0x9d, 0x68, 0x08, 0xac, 0xe6, 0x83, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, - 0x95, 0x94, 0x84, 0xf2, 0x47, 0x0a, 0x00, 0x00, + // 820 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcb, 0x6e, 0x13, 0x49, + 0x14, 0x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 0xbd, 0x22, 0x1d, + 0xa7, 0x19, 0x14, 0x49, 0xcf, 0x52, 0x84, 0xe3, 0x36, 0x28, 0xaa, 0x03, 0xe0, 0xd7, 0x14, 0x5b, + 0x44, 0xb7, 0x2d, 0x22, 0x01, 0x1b, 0xda, 0xbd, 0x99, 0xb4, 0xdc, 0x1e, 0xc0, 0xd9, 0xe0, 0x6a, + 0x49, 0xaf, 0x8d, 0x1a, 0xa9, 0x2a, 0xaf, 0x42, 0x26, 0x32, 0x59, 0xf4, 0x07, 0x24, 0x3c, 0x59, + 0xd8, 0xe5, 0x51, 0xbd, 0xa5, 0x37, 0xe3, 0xae, 0x66, 0x74, 0xb0, 0x14, 0xf7, 0x67, 0xcc, 0x82, + 0xb5, 0xf8, 0x8a, 0x20, 0xef, 0x43, 0x8a, 0xcf, 0x0a, 0x21, 0x48, 0x5a, 0x9a, 0x89, 0x39, 0x8e, + 0xad, 0x91, 0x02, 0x29, 0xdb, 0xa1, 0x8c, 0x7a, 0xfc, 0x07, 0x93, 0x0b, 0x92, 0xe4, 0x43, 0xf8, + 0x7d, 0x88, 0xee, 0x18, 0x36, 0xff, 0x45, 0xd9, 0x4c, 0x2a, 0x19, 0x72, 0x2c, 0xdd, 0x82, 0x3f, + 0x77, 0x31, 0x1d, 0x08, 0xa2, 0xe2, 0x57, 0x1d, 0x4c, 0xe8, 0x24, 0x8b, 0x94, 0x4e, 0x20, 0x7b, + 0x39, 0x9d, 0x38, 0xb6, 0x45, 0x30, 0x3a, 0x80, 0xf4, 0x40, 0x62, 0x06, 0xcb, 0x54, 0xff, 0x9f, + 0x65, 0x10, 0x5c, 0xf8, 0xb0, 0x48, 0x69, 0x09, 0xfe, 0xda, 0xd3, 0x49, 0xd8, 0x8a, 0x04, 0xd4, + 0x24, 0x48, 0x1d, 0xeb, 0x06, 0xc5, 0x2e, 0x91, 0x84, 0x62, 0xa2, 0x9c, 0x56, 0x83, 0xb0, 0x64, + 0x40, 0x6e, 0x18, 0xc2, 0xe9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x08, 0x4c, 0x72, 0xdc, 0x73, + 0x10, 0x7d, 0x7f, 0x4c, 0x45, 0x60, 0xbc, 0x95, 0xe4, 0xdc, 0x88, 0xf3, 0xb7, 0xbd, 0x2f, 0xc1, + 0xda, 0x8b, 0xb3, 0x8b, 0x7c, 0xec, 0xf3, 0x45, 0x3e, 0xf6, 0xb6, 0x9f, 0x17, 0xce, 0xfa, 0x79, + 0xe1, 0x53, 0x3f, 0x2f, 0x7c, 0xed, 0xe7, 0x85, 0x67, 0x3b, 0xd7, 0xf8, 0xb8, 0x5d, 0x0f, 0xa3, + 0xa7, 0xb1, 0xba, 0xc8, 0x7a, 0xde, 0xfe, 0x1e, 0x00, 0x00, 0xff, 0xff, 0xd0, 0xae, 0xca, 0xcb, + 0x2f, 0x0b, 0x00, 0x00, } diff --git a/vendor/github.com/containerd/containerd/api/services/containers/v1/containers.proto b/vendor/github.com/containerd/containerd/api/services/containers/v1/containers.proto index b7b32d949..d491f46cf 100644 --- a/vendor/github.com/containerd/containerd/api/services/containers/v1/containers.proto +++ b/vendor/github.com/containerd/containerd/api/services/containers/v1/containers.proto @@ -29,6 +29,7 @@ option go_package = "github.com/containerd/containerd/api/services/containers/v1 service Containers { rpc Get(GetContainerRequest) returns (GetContainerResponse); rpc List(ListContainersRequest) returns (ListContainersResponse); + rpc ListStream(ListContainersRequest) returns (stream ListContainerMessage); rpc Create(CreateContainerRequest) returns (CreateContainerResponse); rpc Update(UpdateContainerRequest) returns (UpdateContainerResponse); rpc Delete(DeleteContainerRequest) returns (google.protobuf.Empty); @@ -156,3 +157,7 @@ message UpdateContainerResponse { message DeleteContainerRequest { string id = 1; } + +message ListContainerMessage { + Container container = 1; +} diff --git a/vendor/github.com/containerd/containerd/api/services/leases/v1/leases.pb.go b/vendor/github.com/containerd/containerd/api/services/leases/v1/leases.pb.go index 3472b1ff9..1222c1aec 100644 --- a/vendor/github.com/containerd/containerd/api/services/leases/v1/leases.pb.go +++ b/vendor/github.com/containerd/containerd/api/services/leases/v1/leases.pb.go @@ -82,6 +82,11 @@ func (*CreateResponse) Descriptor() ([]byte, []int) { return fileDescriptorLease type DeleteRequest struct { ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // Sync indicates that the delete and cleanup should be done + // synchronously before returning to the caller + // + // Default is false + Sync bool `protobuf:"varint,2,opt,name=sync,proto3" json:"sync,omitempty"` } func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } @@ -404,6 +409,16 @@ func (m *DeleteRequest) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintLeases(dAtA, i, uint64(len(m.ID))) i += copy(dAtA[i:], m.ID) } + if m.Sync { + dAtA[i] = 0x10 + i++ + if m.Sync { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } return i, nil } @@ -534,6 +549,9 @@ func (m *DeleteRequest) Size() (n int) { if l > 0 { n += 1 + l + sovLeases(uint64(l)) } + if m.Sync { + n += 2 + } return n } @@ -633,6 +651,7 @@ func (this *DeleteRequest) String() string { } s := strings.Join([]string{`&DeleteRequest{`, `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `Sync:` + fmt.Sprintf("%v", this.Sync) + `,`, `}`, }, "") return s @@ -1230,6 +1249,26 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { } m.ID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Sync", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLeases + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Sync = bool(v != 0) default: iNdEx = preIndex skippy, err := skipLeases(dAtA[iNdEx:]) @@ -1521,37 +1560,38 @@ func init() { } var fileDescriptorLeases = []byte{ - // 504 bytes of a gzipped FileDescriptorProto + // 515 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0xdf, 0x8a, 0xd3, 0x40, - 0x14, 0xc6, 0x3b, 0xa9, 0x8d, 0xf6, 0xc4, 0x15, 0x19, 0x96, 0x25, 0x44, 0x4c, 0x4b, 0x10, 0xb6, - 0xf8, 0x67, 0xe2, 0xd6, 0x9b, 0x75, 0x15, 0xc1, 0x6e, 0x17, 0x14, 0x82, 0x48, 0xf0, 0x62, 0xf1, - 0x66, 0x49, 0xdb, 0xb3, 0x31, 0x98, 0x36, 0x31, 0x33, 0x2d, 0xf4, 0xce, 0x47, 0xf0, 0x11, 0x7c, - 0x08, 0x1f, 0xa2, 0x97, 0x5e, 0x7a, 0xb5, 0xba, 0xb9, 0xf3, 0x2d, 0x24, 0x33, 0x09, 0xbb, 0x5b, - 0xd1, 0x56, 0xd9, 0xbb, 0x33, 0x99, 0xef, 0x3b, 0xe7, 0x77, 0x3e, 0x98, 0x40, 0x3f, 0x8c, 0xc4, - 0xbb, 0xe9, 0x80, 0x0d, 0x93, 0xb1, 0x3b, 0x4c, 0x26, 0x22, 0x88, 0x26, 0x98, 0x8d, 0xce, 0x97, - 0x41, 0x1a, 0xb9, 0x1c, 0xb3, 0x59, 0x34, 0x44, 0xee, 0xc6, 0x18, 0x70, 0xe4, 0xee, 0x6c, 0xa7, - 0xac, 0x58, 0x9a, 0x25, 0x22, 0xa1, 0xb7, 0xcf, 0xf4, 0xac, 0xd2, 0xb2, 0x52, 0x31, 0xdb, 0xb1, - 0x36, 0xc3, 0x24, 0x4c, 0xa4, 0xd2, 0x2d, 0x2a, 0x65, 0xb2, 0x6e, 0x85, 0x49, 0x12, 0xc6, 0xe8, - 0xca, 0xd3, 0x60, 0x7a, 0xec, 0xe2, 0x38, 0x15, 0xf3, 0xf2, 0xb2, 0xb5, 0x7c, 0x29, 0xa2, 0x31, - 0x72, 0x11, 0x8c, 0x53, 0x25, 0x70, 0x7e, 0x12, 0x68, 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c4, 0x78, 0xb8, 0xa2, 0xba, 0xe4, 0x7d, 0x05, + 0xba, 0x4a, 0x69, 0xe9, 0x35, 0x17, 0xc2, 0x34, 0xb6, 0x7e, 0x7b, 0x18, 0x07, 0xc5, 0x6b, 0xa4, + 0x47, 0xb0, 0x56, 0xe4, 0x41, 0xef, 0x2d, 0x9b, 0xfb, 0x2c, 0x5d, 0xe3, 0xfe, 0x4a, 0x5a, 0x05, + 0x3c, 0x38, 0x5c, 0x9c, 0x9a, 0xb5, 0x6f, 0xa7, 0x66, 0xed, 0x63, 0x6e, 0x92, 0x45, 0x6e, 0x92, + 0xaf, 0xb9, 0x49, 0x7e, 0xe4, 0x26, 0x79, 0xfb, 0xec, 0x3f, 0x7f, 0x4d, 0x7b, 0xaa, 0x3a, 0xac, + 0x8d, 0x74, 0x39, 0xcc, 0xe3, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x14, 0x74, 0xdd, 0x12, 0xe5, + 0x04, 0x00, 0x00, } diff --git a/vendor/github.com/containerd/containerd/api/services/leases/v1/leases.proto b/vendor/github.com/containerd/containerd/api/services/leases/v1/leases.proto index 1002a2d6e..2df4b0623 100644 --- a/vendor/github.com/containerd/containerd/api/services/leases/v1/leases.proto +++ b/vendor/github.com/containerd/containerd/api/services/leases/v1/leases.proto @@ -47,6 +47,12 @@ message CreateResponse { message DeleteRequest { string id = 1; + + // Sync indicates that the delete and cleanup should be done + // synchronously before returning to the caller + // + // Default is false + bool sync = 2; } message ListRequest { diff --git a/vendor/github.com/containerd/containerd/archive/compression/compression.go b/vendor/github.com/containerd/containerd/archive/compression/compression.go index de85438b9..bd50f083b 100644 --- a/vendor/github.com/containerd/containerd/archive/compression/compression.go +++ b/vendor/github.com/containerd/containerd/archive/compression/compression.go @@ -43,9 +43,17 @@ var ( } ) +// DecompressReadCloser include the stream after decompress and the compress method detected. +type DecompressReadCloser interface { + io.ReadCloser + // GetCompression returns the compress method which is used before decompressing + GetCompression() Compression +} + type readCloserWrapper struct { io.Reader - closer func() error + compression Compression + closer func() error } func (r *readCloserWrapper) Close() error { @@ -55,6 +63,10 @@ func (r *readCloserWrapper) Close() error { return nil } +func (r *readCloserWrapper) GetCompression() Compression { + return r.compression +} + type writeCloserWrapper struct { io.Writer closer func() error @@ -84,7 +96,7 @@ func DetectCompression(source []byte) Compression { } // DecompressStream decompresses the archive and returns a ReaderCloser with the decompressed archive. -func DecompressStream(archive io.Reader) (io.ReadCloser, error) { +func DecompressStream(archive io.Reader) (DecompressReadCloser, error) { buf := bufioReader32KPool.Get().(*bufio.Reader) buf.Reset(archive) bs, err := buf.Peek(10) @@ -105,14 +117,14 @@ func DecompressStream(archive io.Reader) (io.ReadCloser, error) { } switch compression := DetectCompression(bs); compression { case Uncompressed: - readBufWrapper := &readCloserWrapper{buf, closer} + readBufWrapper := &readCloserWrapper{buf, compression, closer} return readBufWrapper, nil case Gzip: gzReader, err := gzip.NewReader(buf) if err != nil { return nil, err } - readBufWrapper := &readCloserWrapper{gzReader, closer} + readBufWrapper := &readCloserWrapper{gzReader, compression, closer} return readBufWrapper, nil default: return nil, fmt.Errorf("unsupported compression format %s", (&compression).Extension()) diff --git a/vendor/github.com/containerd/containerd/archive/tar.go b/vendor/github.com/containerd/containerd/archive/tar.go index 7d7702bee..ac04e3e02 100644 --- a/vendor/github.com/containerd/containerd/archive/tar.go +++ b/vendor/github.com/containerd/containerd/archive/tar.go @@ -114,6 +114,9 @@ func Apply(ctx context.Context, root string, r io.Reader, opts ...ApplyOpt) (int return 0, errors.Wrap(err, "failed to apply option") } } + if options.Filter == nil { + options.Filter = all + } return apply(ctx, root, tar.NewReader(r), options) } @@ -155,6 +158,14 @@ func applyNaive(ctx context.Context, root string, tr *tar.Reader, options ApplyO // Normalize name, for safety and for a simple is-root check hdr.Name = filepath.Clean(hdr.Name) + accept, err := options.Filter(hdr) + if err != nil { + return 0, err + } + if !accept { + continue + } + if skipFile(hdr) { log.G(ctx).Warnf("file %q ignored: archive may not be supported on system", hdr.Name) continue @@ -366,10 +377,11 @@ func createTarFile(ctx context.Context, path, extractDir string, hdr *tar.Header } case tar.TypeLink: - targetPath, err := fs.RootPath(extractDir, hdr.Linkname) + targetPath, err := hardlinkRootPath(extractDir, hdr.Linkname) if err != nil { return err } + if err := os.Link(targetPath, path); err != nil { return err } @@ -648,3 +660,27 @@ func copyBuffered(ctx context.Context, dst io.Writer, src io.Reader) (written in return written, err } + +// hardlinkRootPath returns target linkname, evaluating and bounding any +// symlink to the parent directory. +// +// NOTE: Allow hardlink to the softlink, not the real one. For example, +// +// touch /tmp/zzz +// ln -s /tmp/zzz /tmp/xxx +// ln /tmp/xxx /tmp/yyy +// +// /tmp/yyy should be softlink which be same of /tmp/xxx, not /tmp/zzz. +func hardlinkRootPath(root, linkname string) (string, error) { + ppath, base := filepath.Split(linkname) + ppath, err := fs.RootPath(root, ppath) + if err != nil { + return "", err + } + + targetPath := filepath.Join(ppath, base) + if !strings.HasPrefix(targetPath, root) { + targetPath = root + } + return targetPath, nil +} diff --git a/vendor/github.com/containerd/containerd/archive/tar_opts.go b/vendor/github.com/containerd/containerd/archive/tar_opts.go index b0f86abdf..a08bc102a 100644 --- a/vendor/github.com/containerd/containerd/archive/tar_opts.go +++ b/vendor/github.com/containerd/containerd/archive/tar_opts.go @@ -16,5 +16,23 @@ package archive +import "archive/tar" + // ApplyOpt allows setting mutable archive apply properties on creation type ApplyOpt func(options *ApplyOptions) error + +// Filter specific files from the archive +type Filter func(*tar.Header) (bool, error) + +// all allows all files +func all(_ *tar.Header) (bool, error) { + return true, nil +} + +// WithFilter uses the filter to select which files are to be extracted. +func WithFilter(f Filter) ApplyOpt { + return func(options *ApplyOptions) error { + options.Filter = f + return nil + } +} diff --git a/vendor/github.com/containerd/containerd/archive/tar_opts_unix.go b/vendor/github.com/containerd/containerd/archive/tar_opts_unix.go index e19afddd2..173826967 100644 --- a/vendor/github.com/containerd/containerd/archive/tar_opts_unix.go +++ b/vendor/github.com/containerd/containerd/archive/tar_opts_unix.go @@ -20,4 +20,5 @@ package archive // ApplyOptions provides additional options for an Apply operation type ApplyOptions struct { + Filter Filter // Filter tar headers } diff --git a/vendor/github.com/containerd/containerd/archive/tar_opts_windows.go b/vendor/github.com/containerd/containerd/archive/tar_opts_windows.go index 0991ab094..e4b15a163 100644 --- a/vendor/github.com/containerd/containerd/archive/tar_opts_windows.go +++ b/vendor/github.com/containerd/containerd/archive/tar_opts_windows.go @@ -22,6 +22,7 @@ package archive type ApplyOptions struct { ParentLayerPaths []string // Parent layer paths used for Windows layer apply IsWindowsContainerLayer bool // True if the tar stream to be applied is a Windows Container Layer + Filter Filter // Filter tar headers } // WithParentLayers adds parent layers to the apply process this is required diff --git a/vendor/github.com/containerd/containerd/cio/io_windows.go b/vendor/github.com/containerd/containerd/cio/io_windows.go index fa9532a3b..a751f7d7a 100644 --- a/vendor/github.com/containerd/containerd/cio/io_windows.go +++ b/vendor/github.com/containerd/containerd/cio/io_windows.go @@ -20,7 +20,6 @@ import ( "fmt" "io" "net" - "sync" winio "github.com/Microsoft/go-winio" "github.com/containerd/containerd/log" @@ -41,7 +40,6 @@ func NewFIFOSetInDir(_, id string, terminal bool) (*FIFOSet, error) { func copyIO(fifos *FIFOSet, ioset *Streams) (*cio, error) { var ( - wg sync.WaitGroup set []io.Closer ) @@ -85,9 +83,7 @@ func copyIO(fifos *FIFOSet, ioset *Streams) (*cio, error) { }(l) set = append(set, l) - wg.Add(1) go func() { - defer wg.Done() c, err := l.Accept() if err != nil { log.L.WithError(err).Errorf("failed to accept stdout connection on %s", fifos.Stdout) @@ -115,9 +111,7 @@ func copyIO(fifos *FIFOSet, ioset *Streams) (*cio, error) { }(l) set = append(set, l) - wg.Add(1) go func() { - defer wg.Done() c, err := l.Accept() if err != nil { log.L.WithError(err).Errorf("failed to accept stderr connection on %s", fifos.Stderr) diff --git a/vendor/github.com/containerd/containerd/client.go b/vendor/github.com/containerd/containerd/client.go index 55c1a36fd..788a381d6 100644 --- a/vendor/github.com/containerd/containerd/client.go +++ b/vendor/github.com/containerd/containerd/client.go @@ -43,8 +43,11 @@ import ( "github.com/containerd/containerd/errdefs" "github.com/containerd/containerd/events" "github.com/containerd/containerd/images" + "github.com/containerd/containerd/leases" + leasesproxy "github.com/containerd/containerd/leases/proxy" "github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/pkg/dialer" + "github.com/containerd/containerd/platforms" "github.com/containerd/containerd/plugin" "github.com/containerd/containerd/remotes" "github.com/containerd/containerd/remotes/docker" @@ -79,8 +82,12 @@ func New(address string, opts ...ClientOpt) (*Client, error) { return nil, err } } + rt := fmt.Sprintf("%s.%s", plugin.RuntimePlugin, runtime.GOOS) + if copts.defaultRuntime != "" { + rt = copts.defaultRuntime + } c := &Client{ - runtime: fmt.Sprintf("%s.%s", plugin.RuntimePlugin, runtime.GOOS), + runtime: rt, } if copts.services != nil { c.services = *copts.services @@ -284,7 +291,31 @@ func defaultRemoteContext() *RemoteContext { } } +// Fetch downloads the provided content into containerd's content store +// and returns a non-platform specific image reference +func (c *Client) Fetch(ctx context.Context, ref string, opts ...RemoteOpt) (images.Image, error) { + fetchCtx := defaultRemoteContext() + for _, o := range opts { + if err := o(c, fetchCtx); err != nil { + return images.Image{}, err + } + } + + if fetchCtx.Unpack { + return images.Image{}, errors.New("unpack on fetch not supported, try pull") + } + + ctx, done, err := c.WithLease(ctx) + if err != nil { + return images.Image{}, err + } + defer done(ctx) + + return c.fetch(ctx, fetchCtx, ref) +} + // Pull downloads the provided content into containerd's content store +// and returns a platform specific image object func (c *Client) Pull(ctx context.Context, ref string, opts ...RemoteOpt) (Image, error) { pullCtx := defaultRemoteContext() for _, o := range opts { @@ -292,7 +323,12 @@ func (c *Client) Pull(ctx context.Context, ref string, opts ...RemoteOpt) (Image return nil, err } } - store := c.ContentStore() + + if len(pullCtx.Platforms) > 1 { + return nil, errors.New("cannot pull multiplatform image locally, try Fetch") + } else if len(pullCtx.Platforms) == 0 { + pullCtx.Platforms = []string{platforms.Default()} + } ctx, done, err := c.WithLease(ctx) if err != nil { @@ -300,82 +336,92 @@ func (c *Client) Pull(ctx context.Context, ref string, opts ...RemoteOpt) (Image } defer done(ctx) - name, desc, err := pullCtx.Resolver.Resolve(ctx, ref) + img, err := c.fetch(ctx, pullCtx, ref) if err != nil { - return nil, errors.Wrapf(err, "failed to resolve reference %q", ref) + return nil, err } - fetcher, err := pullCtx.Resolver.Fetcher(ctx, name) + i := NewImageWithPlatform(c, img, pullCtx.Platforms[0]) + + if pullCtx.Unpack { + if err := i.Unpack(ctx, pullCtx.Snapshotter); err != nil { + return nil, errors.Wrapf(err, "failed to unpack image on snapshotter %s", pullCtx.Snapshotter) + } + } + + return i, nil +} + +func (c *Client) fetch(ctx context.Context, rCtx *RemoteContext, ref string) (images.Image, error) { + store := c.ContentStore() + name, desc, err := rCtx.Resolver.Resolve(ctx, ref) if err != nil { - return nil, errors.Wrapf(err, "failed to get fetcher for %q", name) + return images.Image{}, errors.Wrapf(err, "failed to resolve reference %q", ref) + } + + fetcher, err := rCtx.Resolver.Fetcher(ctx, name) + if err != nil { + return images.Image{}, errors.Wrapf(err, "failed to get fetcher for %q", name) } var ( schema1Converter *schema1.Converter handler images.Handler ) - if desc.MediaType == images.MediaTypeDockerSchema1Manifest && pullCtx.ConvertSchema1 { + if desc.MediaType == images.MediaTypeDockerSchema1Manifest && rCtx.ConvertSchema1 { schema1Converter = schema1.NewConverter(store, fetcher) - handler = images.Handlers(append(pullCtx.BaseHandlers, schema1Converter)...) + handler = images.Handlers(append(rCtx.BaseHandlers, schema1Converter)...) } else { // Get all the children for a descriptor childrenHandler := images.ChildrenHandler(store) // Set any children labels for that content childrenHandler = images.SetChildrenLabels(store, childrenHandler) // Filter children by platforms - childrenHandler = images.FilterPlatforms(childrenHandler, pullCtx.Platforms...) + childrenHandler = images.FilterPlatforms(childrenHandler, rCtx.Platforms...) - handler = images.Handlers(append(pullCtx.BaseHandlers, + handler = images.Handlers(append(rCtx.BaseHandlers, remotes.FetchHandler(store, fetcher), childrenHandler, )...) } if err := images.Dispatch(ctx, handler, desc); err != nil { - return nil, err + return images.Image{}, err } if schema1Converter != nil { desc, err = schema1Converter.Convert(ctx) if err != nil { - return nil, err + return images.Image{}, err } } - img := &image{ - client: c, - i: images.Image{ - Name: name, - Target: desc, - Labels: pullCtx.Labels, - }, - } - - if pullCtx.Unpack { - if err := img.Unpack(ctx, pullCtx.Snapshotter); err != nil { - return nil, errors.Wrapf(err, "failed to unpack image on snapshotter %s", pullCtx.Snapshotter) - } + img := images.Image{ + Name: name, + Target: desc, + Labels: rCtx.Labels, } is := c.ImageService() for { - if created, err := is.Create(ctx, img.i); err != nil { + if created, err := is.Create(ctx, img); err != nil { if !errdefs.IsAlreadyExists(err) { - return nil, err + return images.Image{}, err } - updated, err := is.Update(ctx, img.i) + updated, err := is.Update(ctx, img) if err != nil { // if image was removed, try create again if errdefs.IsNotFound(err) { continue } - return nil, err + return images.Image{}, err } - img.i = updated + img = updated } else { - img.i = created + img = created } + return img, nil } } @@ -403,10 +449,7 @@ func (c *Client) GetImage(ctx context.Context, ref string) (Image, error) { if err != nil { return nil, err } - return &image{ - client: c, - i: i, - }, nil + return NewImage(c, i), nil } // ListImages returns all existing images @@ -417,10 +460,7 @@ func (c *Client) ListImages(ctx context.Context, filters ...string) ([]Image, er } images := make([]Image, len(imgs)) for i, img := range imgs { - images[i] = &image{ - client: c, - i: img, - } + images[i] = NewImage(c, img) } return images, nil } @@ -451,6 +491,8 @@ func (c *Client) NamespaceService() namespaces.Store { if c.namespaceStore != nil { return c.namespaceStore } + c.connMu.Lock() + defer c.connMu.Unlock() return NewNamespaceStoreFromClient(namespacesapi.NewNamespacesClient(c.conn)) } @@ -459,6 +501,8 @@ func (c *Client) ContainerService() containers.Store { if c.containerStore != nil { return c.containerStore } + c.connMu.Lock() + defer c.connMu.Unlock() return NewRemoteContainerStore(containersapi.NewContainersClient(c.conn)) } @@ -467,6 +511,8 @@ func (c *Client) ContentStore() content.Store { if c.contentStore != nil { return c.contentStore } + c.connMu.Lock() + defer c.connMu.Unlock() return contentproxy.NewContentStore(contentapi.NewContentClient(c.conn)) } @@ -475,6 +521,8 @@ func (c *Client) SnapshotService(snapshotterName string) snapshots.Snapshotter { if c.snapshotters != nil { return c.snapshotters[snapshotterName] } + c.connMu.Lock() + defer c.connMu.Unlock() return snproxy.NewSnapshotter(snapshotsapi.NewSnapshotsClient(c.conn), snapshotterName) } @@ -483,6 +531,8 @@ func (c *Client) TaskService() tasks.TasksClient { if c.taskService != nil { return c.taskService } + c.connMu.Lock() + defer c.connMu.Unlock() return tasks.NewTasksClient(c.conn) } @@ -491,6 +541,8 @@ func (c *Client) ImageService() images.Store { if c.imageStore != nil { return c.imageStore } + c.connMu.Lock() + defer c.connMu.Unlock() return NewImageStoreFromClient(imagesapi.NewImagesClient(c.conn)) } @@ -499,24 +551,32 @@ func (c *Client) DiffService() DiffService { if c.diffService != nil { return c.diffService } + c.connMu.Lock() + defer c.connMu.Unlock() return NewDiffServiceFromClient(diffapi.NewDiffClient(c.conn)) } // IntrospectionService returns the underlying Introspection Client func (c *Client) IntrospectionService() introspectionapi.IntrospectionClient { + c.connMu.Lock() + defer c.connMu.Unlock() return introspectionapi.NewIntrospectionClient(c.conn) } // LeasesService returns the underlying Leases Client -func (c *Client) LeasesService() leasesapi.LeasesClient { +func (c *Client) LeasesService() leases.Manager { if c.leasesService != nil { return c.leasesService } - return leasesapi.NewLeasesClient(c.conn) + c.connMu.Lock() + defer c.connMu.Unlock() + return leasesproxy.NewLeaseManager(leasesapi.NewLeasesClient(c.conn)) } // HealthService returns the underlying GRPC HealthClient func (c *Client) HealthService() grpc_health_v1.HealthClient { + c.connMu.Lock() + defer c.connMu.Unlock() return grpc_health_v1.NewHealthClient(c.conn) } @@ -525,11 +585,15 @@ func (c *Client) EventService() EventService { if c.eventService != nil { return c.eventService } + c.connMu.Lock() + defer c.connMu.Unlock() return NewEventServiceFromClient(eventsapi.NewEventsClient(c.conn)) } // VersionService returns the underlying VersionClient func (c *Client) VersionService() versionservice.VersionClient { + c.connMu.Lock() + defer c.connMu.Unlock() return versionservice.NewVersionClient(c.conn) } diff --git a/vendor/github.com/containerd/containerd/client_opts.go b/vendor/github.com/containerd/containerd/client_opts.go index 52f670d75..6e6198739 100644 --- a/vendor/github.com/containerd/containerd/client_opts.go +++ b/vendor/github.com/containerd/containerd/client_opts.go @@ -18,14 +18,16 @@ package containerd import ( "github.com/containerd/containerd/images" + "github.com/containerd/containerd/platforms" "github.com/containerd/containerd/remotes" "google.golang.org/grpc" ) type clientOpts struct { - defaultns string - services *services - dialOptions []grpc.DialOption + defaultns string + defaultRuntime string + services *services + dialOptions []grpc.DialOption } // ClientOpt allows callers to set options on the containerd client @@ -42,6 +44,14 @@ func WithDefaultNamespace(ns string) ClientOpt { } } +// WithDefaultRuntime sets the default runtime on the client +func WithDefaultRuntime(rt string) ClientOpt { + return func(c *clientOpts) error { + c.defaultRuntime = rt + return nil + } +} + // WithDialOpts allows grpc.DialOptions to be set on the connection func WithDialOpts(opts []grpc.DialOption) ClientOpt { return func(c *clientOpts) error { @@ -67,6 +77,9 @@ type RemoteOpt func(*Client, *RemoteContext) error // WithPlatform allows the caller to specify a platform to retrieve // content for func WithPlatform(platform string) RemoteOpt { + if platform == "" { + platform = platforms.Default() + } return func(_ *Client, c *RemoteContext) error { for _, p := range c.Platforms { if p == platform { diff --git a/vendor/github.com/containerd/containerd/cmd/containerd/command/config.go b/vendor/github.com/containerd/containerd/cmd/containerd/command/config.go index eebe2ba5b..d6133f9a1 100644 --- a/vendor/github.com/containerd/containerd/cmd/containerd/command/config.go +++ b/vendor/github.com/containerd/containerd/cmd/containerd/command/config.go @@ -17,6 +17,7 @@ package command import ( + gocontext "context" "io" "os" @@ -48,7 +49,7 @@ var configCommand = cli.Command{ config := &Config{ Config: defaultConfig(), } - plugins, err := server.LoadPlugins(config.Config) + plugins, err := server.LoadPlugins(gocontext.Background(), config.Config) if err != nil { return err } diff --git a/vendor/github.com/containerd/containerd/cmd/containerd/command/main.go b/vendor/github.com/containerd/containerd/cmd/containerd/command/main.go index 31a21f6c6..55e6393e7 100644 --- a/vendor/github.com/containerd/containerd/cmd/containerd/command/main.go +++ b/vendor/github.com/containerd/containerd/cmd/containerd/command/main.go @@ -48,6 +48,11 @@ high performance container runtime ` func init() { + logrus.SetFormatter(&logrus.TextFormatter{ + TimestampFormat: log.RFC3339NanoFixed, + FullTimestamp: true, + }) + // Discard grpc logs so that they don't mess with our stdio grpclog.SetLoggerV2(grpclog.NewLoggerV2(ioutil.Discard, ioutil.Discard, ioutil.Discard)) @@ -116,8 +121,12 @@ func App() *cli.App { return errors.Wrap(err, "creating temp mount location") } // unmount all temp mounts on boot for the server - if err := mount.CleanupTempMounts(0); err != nil { - return errors.Wrap(err, "unmounting temp mounts") + warnings, err := mount.CleanupTempMounts(0) + if err != nil { + log.G(ctx).WithError(err).Error("unmounting temp mounts") + } + for _, w := range warnings { + log.G(ctx).WithError(w).Warn("cleanup temp mount") } address := config.GRPC.Address if address == "" { diff --git a/vendor/github.com/containerd/containerd/cmd/containerd/command/oci-hook.go b/vendor/github.com/containerd/containerd/cmd/containerd/command/oci-hook.go index 1ddc2c7c0..f47f8e3ac 100644 --- a/vendor/github.com/containerd/containerd/cmd/containerd/command/oci-hook.go +++ b/vendor/github.com/containerd/containerd/cmd/containerd/command/oci-hook.go @@ -37,8 +37,12 @@ var ociHook = cli.Command{ if err != nil { return err } + spec, err := loadSpec(state.Bundle) + if err != nil { + return err + } var ( - ctx = newTemplateContext(state) + ctx = newTemplateContext(state, spec) args = []string(context.Args()) env = os.Environ() ) @@ -52,6 +56,25 @@ var ociHook = cli.Command{ }, } +type hookSpec struct { + Root struct { + Path string `json:"path"` + } `json:"root"` +} + +func loadSpec(bundle string) (*hookSpec, error) { + f, err := os.Open(filepath.Join(bundle, "config.json")) + if err != nil { + return nil, err + } + defer f.Close() + var s hookSpec + if err := json.NewDecoder(f).Decode(&s); err != nil { + return nil, err + } + return &s, nil +} + func loadHookState(r io.Reader) (*specs.State, error) { var s specs.State if err := json.NewDecoder(r).Decode(&s); err != nil { @@ -60,9 +83,10 @@ func loadHookState(r io.Reader) (*specs.State, error) { return &s, nil } -func newTemplateContext(state *specs.State) *templateContext { +func newTemplateContext(state *specs.State, spec *hookSpec) *templateContext { t := &templateContext{ state: state, + root: spec.Root.Path, } t.funcs = template.FuncMap{ "id": t.id, @@ -77,6 +101,7 @@ func newTemplateContext(state *specs.State) *templateContext { type templateContext struct { state *specs.State + root string funcs template.FuncMap } @@ -89,7 +114,10 @@ func (t *templateContext) bundle() string { } func (t *templateContext) rootfs() string { - return filepath.Join(t.state.Bundle, "rootfs") + if filepath.IsAbs(t.root) { + return t.root + } + return filepath.Join(t.state.Bundle, t.root) } func (t *templateContext) pid() int { diff --git a/vendor/github.com/containerd/containerd/cmd/ctr/app/main.go b/vendor/github.com/containerd/containerd/cmd/ctr/app/main.go index ac91d038c..9c33216b3 100644 --- a/vendor/github.com/containerd/containerd/cmd/ctr/app/main.go +++ b/vendor/github.com/containerd/containerd/cmd/ctr/app/main.go @@ -24,6 +24,8 @@ import ( "github.com/containerd/containerd/cmd/ctr/commands/content" "github.com/containerd/containerd/cmd/ctr/commands/events" "github.com/containerd/containerd/cmd/ctr/commands/images" + "github.com/containerd/containerd/cmd/ctr/commands/install" + "github.com/containerd/containerd/cmd/ctr/commands/leases" namespacesCmd "github.com/containerd/containerd/cmd/ctr/commands/namespaces" "github.com/containerd/containerd/cmd/ctr/commands/plugins" "github.com/containerd/containerd/cmd/ctr/commands/pprof" @@ -96,11 +98,13 @@ containerd CLI content.Command, events.Command, images.Command, + leases.Command, namespacesCmd.Command, pprof.Command, run.Command, snapshots.Command, tasks.Command, + install.Command, }, extraCmds...) app.Before = func(context *cli.Context) error { if context.GlobalBool("debug") { diff --git a/vendor/github.com/containerd/containerd/cmd/ctr/commands/client.go b/vendor/github.com/containerd/containerd/cmd/ctr/commands/client.go index e940aea66..b436186b2 100644 --- a/vendor/github.com/containerd/containerd/cmd/ctr/commands/client.go +++ b/vendor/github.com/containerd/containerd/cmd/ctr/commands/client.go @@ -46,8 +46,8 @@ func AppContext(context *cli.Context) (gocontext.Context, gocontext.CancelFunc) } // NewClient returns a new containerd client -func NewClient(context *cli.Context) (*containerd.Client, gocontext.Context, gocontext.CancelFunc, error) { - client, err := containerd.New(context.GlobalString("address")) +func NewClient(context *cli.Context, opts ...containerd.ClientOpt) (*containerd.Client, gocontext.Context, gocontext.CancelFunc, error) { + client, err := containerd.New(context.GlobalString("address"), opts...) if err != nil { return nil, nil, nil, err } diff --git a/vendor/github.com/containerd/containerd/cmd/ctr/commands/commands.go b/vendor/github.com/containerd/containerd/cmd/ctr/commands/commands.go index 1784e6a04..527516094 100644 --- a/vendor/github.com/containerd/containerd/cmd/ctr/commands/commands.go +++ b/vendor/github.com/containerd/containerd/cmd/ctr/commands/commands.go @@ -105,7 +105,7 @@ var ( }, cli.StringFlag{ Name: "runtime", - Usage: "runtime name (io.containerd.runtime.v1.linux, io.containerd.runtime.v1.windows, io.containerd.runtime.v1.com.vmware.linux)", + Usage: "runtime name", Value: fmt.Sprintf("io.containerd.runtime.v1.%s", runtime.GOOS), }, cli.BoolFlag{ diff --git a/vendor/github.com/containerd/containerd/cmd/ctr/commands/content/fetch.go b/vendor/github.com/containerd/containerd/cmd/ctr/commands/content/fetch.go index 514010dd8..4169bd620 100644 --- a/vendor/github.com/containerd/containerd/cmd/ctr/commands/content/fetch.go +++ b/vendor/github.com/containerd/containerd/cmd/ctr/commands/content/fetch.go @@ -32,6 +32,7 @@ import ( "github.com/containerd/containerd/images" "github.com/containerd/containerd/log" "github.com/containerd/containerd/pkg/progress" + "github.com/containerd/containerd/platforms" "github.com/containerd/containerd/remotes" digest "github.com/opencontainers/go-digest" ocispec "github.com/opencontainers/image-spec/specs-go/v1" @@ -56,7 +57,16 @@ not use this implementation as a guide. The end goal should be having metadata, content and snapshots ready for a direct use via the 'ctr run'. Most of this is experimental and there are few leaps to make this work.`, - Flags: append(commands.RegistryFlags, commands.LabelFlag), + Flags: append(commands.RegistryFlags, commands.LabelFlag, + cli.StringSliceFlag{ + Name: "platform", + Usage: "Pull content from a specific platform", + }, + cli.BoolFlag{ + Name: "all-platforms", + Usage: "pull content from all platforms", + }, + ), Action: func(clicontext *cli.Context) error { var ( ref = clicontext.Args().First() @@ -73,10 +83,10 @@ Most of this is experimental and there are few leaps to make this work.`, } // Fetch loads all resources into the content store and returns the image -func Fetch(ctx context.Context, client *containerd.Client, ref string, cliContext *cli.Context) (containerd.Image, error) { +func Fetch(ctx context.Context, client *containerd.Client, ref string, cliContext *cli.Context) (images.Image, error) { resolver, err := commands.GetResolver(ctx, cliContext) if err != nil { - return nil, err + return images.Image{}, err } ongoing := newJobs(ref) @@ -109,15 +119,19 @@ func Fetch(ctx context.Context, client *containerd.Client, ref string, cliContex } if !cliContext.Bool("all-platforms") { - for _, platform := range cliContext.StringSlice("platform") { + p := cliContext.StringSlice("platform") + if len(p) == 0 { + p = append(p, platforms.Default()) + } + for _, platform := range p { opts = append(opts, containerd.WithPlatform(platform)) } } - img, err := client.Pull(pctx, ref, opts...) + img, err := client.Fetch(pctx, ref, opts...) stopProgress() if err != nil { - return nil, err + return images.Image{}, err } <-progress diff --git a/vendor/github.com/containerd/containerd/cmd/ctr/commands/images/pull.go b/vendor/github.com/containerd/containerd/cmd/ctr/commands/images/pull.go index 10e4f1d52..de99ae4a6 100644 --- a/vendor/github.com/containerd/containerd/cmd/ctr/commands/images/pull.go +++ b/vendor/github.com/containerd/containerd/cmd/ctr/commands/images/pull.go @@ -19,10 +19,13 @@ package images import ( "fmt" + "github.com/containerd/containerd" "github.com/containerd/containerd/cmd/ctr/commands" "github.com/containerd/containerd/cmd/ctr/commands/content" + "github.com/containerd/containerd/images" "github.com/containerd/containerd/log" "github.com/containerd/containerd/platforms" + "github.com/pkg/errors" "github.com/urfave/cli" ) @@ -43,7 +46,7 @@ command. As part of this process, we do the following: cli.StringSliceFlag{ Name: "platform", Usage: "Pull content from a specific platform", - Value: &cli.StringSlice{platforms.Default()}, + Value: &cli.StringSlice{}, }, cli.BoolFlag{ Name: "all-platforms", @@ -78,11 +81,34 @@ command. As part of this process, we do the following: log.G(ctx).WithField("image", ref).Debug("unpacking") // TODO: Show unpack status - fmt.Printf("unpacking %s...\n", img.Target().Digest) - err = img.Unpack(ctx, context.String("snapshotter")) - if err == nil { - fmt.Println("done") + + var p []string + if context.Bool("all-platforms") { + all, err := images.Platforms(ctx, client.ContentStore(), img.Target) + if err != nil { + return errors.Wrap(err, "unable to resolve image platforms") + } + p = make([]string, len(all)) + for i := range all { + p[i] = platforms.Format(all[i]) + } + } else { + p = context.StringSlice("platform") } - return err + if len(p) == 0 { + p = append(p, platforms.Default()) + } + + for _, platform := range p { + fmt.Printf("unpacking %s %s...\n", platform, img.Target.Digest) + i := containerd.NewImageWithPlatform(client, img, platform) + err = i.Unpack(ctx, context.String("snapshotter")) + if err != nil { + return err + } + } + + fmt.Println("done") + return nil }, } diff --git a/vendor/github.com/containerd/containerd/cmd/ctr/commands/install/install.go b/vendor/github.com/containerd/containerd/cmd/ctr/commands/install/install.go new file mode 100644 index 000000000..4113418fb --- /dev/null +++ b/vendor/github.com/containerd/containerd/cmd/ctr/commands/install/install.go @@ -0,0 +1,61 @@ +/* + 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 install + +import ( + "github.com/containerd/containerd" + "github.com/containerd/containerd/cmd/ctr/commands" + "github.com/urfave/cli" +) + +// Command to install binary packages +var Command = cli.Command{ + Name: "install", + Usage: "install a new package", + ArgsUsage: "", + Description: "install a new package", + Flags: []cli.Flag{ + cli.BoolFlag{ + Name: "libs,l", + Usage: "install libs from the image", + }, + cli.BoolFlag{ + Name: "replace,r", + Usage: "replace any binaries or libs in the opt directory", + }, + }, + Action: func(context *cli.Context) error { + client, ctx, cancel, err := commands.NewClient(context) + if err != nil { + return err + } + defer cancel() + ref := context.Args().First() + image, err := client.GetImage(ctx, ref) + if err != nil { + return err + } + var opts []containerd.InstallOpts + if context.Bool("libs") { + opts = append(opts, containerd.WithInstallLibs) + } + if context.Bool("replace") { + opts = append(opts, containerd.WithInstallReplace) + } + return client.Install(ctx, image, opts...) + }, +} diff --git a/vendor/github.com/containerd/containerd/cmd/ctr/commands/leases/leases.go b/vendor/github.com/containerd/containerd/cmd/ctr/commands/leases/leases.go new file mode 100644 index 000000000..d0b107dbf --- /dev/null +++ b/vendor/github.com/containerd/containerd/cmd/ctr/commands/leases/leases.go @@ -0,0 +1,202 @@ +/* + 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 leases + +import ( + "fmt" + "os" + "sort" + "strings" + "text/tabwriter" + "time" + + "github.com/containerd/containerd/cmd/ctr/commands" + "github.com/containerd/containerd/leases" + "github.com/pkg/errors" + "github.com/urfave/cli" +) + +// Command is the cli command for managing content +var Command = cli.Command{ + Name: "leases", + Usage: "manage leases", + Subcommands: cli.Commands{ + listCommand, + createCommand, + deleteCommand, + }, +} + +var listCommand = cli.Command{ + + Name: "list", + Aliases: []string{"ls"}, + Usage: "list all active leases", + ArgsUsage: "[flags] ", + Description: "list active leases by containerd", + Flags: []cli.Flag{ + cli.BoolFlag{ + Name: "quiet, q", + Usage: "print only the blob digest", + }, + }, + Action: func(context *cli.Context) error { + var ( + filters = context.Args() + quiet = context.Bool("quiet") + ) + client, ctx, cancel, err := commands.NewClient(context) + if err != nil { + return err + } + defer cancel() + + ls := client.LeasesService() + + leaseList, err := ls.List(ctx, filters...) + if err != nil { + return errors.Wrap(err, "failed to list leases") + } + if quiet { + for _, l := range leaseList { + fmt.Println(l.ID) + } + return nil + } + tw := tabwriter.NewWriter(os.Stdout, 1, 8, 1, ' ', 0) + fmt.Fprintln(tw, "ID\tCREATED AT\tLABELS\t") + for _, l := range leaseList { + labels := "-" + if len(l.Labels) > 0 { + var pairs []string + for k, v := range l.Labels { + pairs = append(pairs, fmt.Sprintf("%v=%v", k, v)) + } + sort.Strings(pairs) + labels = strings.Join(pairs, ",") + } + + fmt.Fprintf(tw, "%v\t%v\t%s\t\n", + l.ID, + l.CreatedAt.Local().Format(time.RFC3339), + labels) + } + + return tw.Flush() + }, +} + +var createCommand = cli.Command{ + Name: "create", + Usage: "create lease", + ArgsUsage: "[flags]