mirror of
https://github.com/moby/moby.git
synced 2026-01-14 17:36:01 +00:00
Compare commits
67 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9dbdbd4b6d | ||
|
|
6030355735 | ||
|
|
e1c053637b | ||
|
|
e73310d8c9 | ||
|
|
3f0402cb68 | ||
|
|
edadebe177 | ||
|
|
14661fc010 | ||
|
|
e00f6efb20 | ||
|
|
bd4620f6ee | ||
|
|
d06cf03729 | ||
|
|
cf7742ea7c | ||
|
|
382e9ebbf6 | ||
|
|
e0843f264d | ||
|
|
24fd7c5eb8 | ||
|
|
94fcd2d2ef | ||
|
|
c5197fe6c5 | ||
|
|
70dbd2c870 | ||
|
|
94d3ad69cc | ||
|
|
933a9f83b7 | ||
|
|
fe0a414613 | ||
|
|
1b1230eaaf | ||
|
|
1b263035af | ||
|
|
682542fd08 | ||
|
|
40ec0eb9fe | ||
|
|
9af6762d34 | ||
|
|
0b6449a477 | ||
|
|
227d3f39a3 | ||
|
|
6f83b8c3f4 | ||
|
|
c82be35412 | ||
|
|
ccccb7a170 | ||
|
|
8a6bec6e16 | ||
|
|
844fd50c67 | ||
|
|
8cec683574 | ||
|
|
7ff53c3c78 | ||
|
|
4d57ee692d | ||
|
|
838d5ea058 | ||
|
|
61d084593c | ||
|
|
8fdca288c5 | ||
|
|
28b694d32d | ||
|
|
cbce331930 | ||
|
|
5f684cb072 | ||
|
|
3731ce10d4 | ||
|
|
23774ada04 | ||
|
|
90e8a0bbf5 | ||
|
|
9277e64444 | ||
|
|
cdb6200887 | ||
|
|
09fbbd5677 | ||
|
|
4ca4705bf7 | ||
|
|
d3e52936c3 | ||
|
|
347bce43e9 | ||
|
|
a0a597cbbe | ||
|
|
c9f6343c24 | ||
|
|
0ce1e22243 | ||
|
|
3648a4915c | ||
|
|
aaa102b30f | ||
|
|
15d6037c1e | ||
|
|
59118bff50 | ||
|
|
063d3a6f1a | ||
|
|
389e18081d | ||
|
|
348544e6e8 | ||
|
|
3923e302a4 | ||
|
|
f3946c14fe | ||
|
|
b87f7f18b8 | ||
|
|
98cbcb8003 | ||
|
|
5c5fac2374 | ||
|
|
c492a22287 | ||
|
|
018edb0284 |
2
.github/workflows/.windows.yml
vendored
2
.github/workflows/.windows.yml
vendored
@@ -15,7 +15,7 @@ on:
|
||||
default: false
|
||||
|
||||
env:
|
||||
GO_VERSION: 1.19.7
|
||||
GO_VERSION: 1.19.9
|
||||
GOTESTLIST_VERSION: v0.3.1
|
||||
TESTSTAT_VERSION: v0.1.3
|
||||
WINDOWS_BASE_IMAGE: mcr.microsoft.com/windows/servercore
|
||||
|
||||
3
.github/workflows/test.yml
vendored
3
.github/workflows/test.yml
vendored
@@ -15,7 +15,7 @@ on:
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
GO_VERSION: 1.19.7
|
||||
GO_VERSION: 1.19.9
|
||||
GOTESTLIST_VERSION: v0.3.1
|
||||
TESTSTAT_VERSION: v0.1.3
|
||||
ITG_CLI_MATRIX_SIZE: 6
|
||||
@@ -82,6 +82,7 @@ jobs:
|
||||
|
||||
validate:
|
||||
runs-on: ubuntu-20.04
|
||||
timeout-minutes: 120
|
||||
needs:
|
||||
- validate-prepare
|
||||
- build-dev
|
||||
|
||||
10
Dockerfile
10
Dockerfile
@@ -1,9 +1,9 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
ARG GO_VERSION=1.19.7
|
||||
ARG GO_VERSION=1.19.9
|
||||
ARG BASE_DEBIAN_DISTRO="bullseye"
|
||||
ARG GOLANG_IMAGE="golang:${GO_VERSION}-${BASE_DEBIAN_DISTRO}"
|
||||
ARG XX_VERSION=1.1.2
|
||||
ARG XX_VERSION=1.2.1
|
||||
|
||||
ARG VPNKIT_VERSION=0.5.0
|
||||
ARG DOCKERCLI_VERSION=v17.06.2-ce
|
||||
@@ -135,7 +135,7 @@ RUN git init . && git remote add origin "https://github.com/go-delve/delve.git"
|
||||
# from the https://github.com/go-delve/delve repository.
|
||||
# It can be used to run Docker with a possibility of
|
||||
# attaching debugger to it.
|
||||
ARG DELVE_VERSION=v1.9.1
|
||||
ARG DELVE_VERSION=v1.20.1
|
||||
RUN git fetch -q --depth 1 origin "${DELVE_VERSION}" +refs/tags/*:refs/tags/* && git checkout -q FETCH_HEAD
|
||||
|
||||
FROM base AS delve-build
|
||||
@@ -192,7 +192,7 @@ RUN git init . && git remote add origin "https://github.com/containerd/container
|
||||
# When updating the binary version you may also need to update the vendor
|
||||
# version to pick up bug fixes or new APIs, however, usually the Go packages
|
||||
# are built from a commit from the master branch.
|
||||
ARG CONTAINERD_VERSION=v1.6.19
|
||||
ARG CONTAINERD_VERSION=v1.6.21
|
||||
RUN git fetch -q --depth 1 origin "${CONTAINERD_VERSION}" +refs/tags/*:refs/tags/* && git checkout -q FETCH_HEAD
|
||||
|
||||
FROM base AS containerd-build
|
||||
@@ -280,7 +280,7 @@ RUN git init . && git remote add origin "https://github.com/opencontainers/runc.
|
||||
# that is used. If you need to update runc, open a pull request in the containerd
|
||||
# project first, and update both after that is merged. When updating RUNC_VERSION,
|
||||
# consider updating runc in vendor.mod accordingly.
|
||||
ARG RUNC_VERSION=v1.1.4
|
||||
ARG RUNC_VERSION=v1.1.7
|
||||
RUN git fetch -q --depth 1 origin "${RUNC_VERSION}" +refs/tags/*:refs/tags/* && git checkout -q FETCH_HEAD
|
||||
|
||||
FROM base AS runc-build
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
ARG GO_VERSION=1.19.7
|
||||
ARG GO_VERSION=1.19.9
|
||||
|
||||
FROM golang:${GO_VERSION}-alpine AS base
|
||||
ENV GO111MODULE=off
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
# This represents the bare minimum required to build and test Docker.
|
||||
|
||||
ARG GO_VERSION=1.19.7
|
||||
ARG GO_VERSION=1.19.9
|
||||
|
||||
ARG BASE_DEBIAN_DISTRO="bullseye"
|
||||
ARG GOLANG_IMAGE="golang:${GO_VERSION}-${BASE_DEBIAN_DISTRO}"
|
||||
|
||||
@@ -165,10 +165,10 @@ FROM microsoft/windowsservercore
|
||||
# Use PowerShell as the default shell
|
||||
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
|
||||
|
||||
ARG GO_VERSION=1.19.7
|
||||
ARG GO_VERSION=1.19.9
|
||||
ARG GOTESTSUM_VERSION=v1.8.2
|
||||
ARG GOWINRES_VERSION=v0.3.0
|
||||
ARG CONTAINERD_VERSION=v1.6.19
|
||||
ARG CONTAINERD_VERSION=v1.6.21
|
||||
|
||||
# Environment variable notes:
|
||||
# - GO_VERSION must be consistent with 'Dockerfile' used by Linux.
|
||||
|
||||
@@ -92,7 +92,7 @@ func (b *Backend) Build(ctx context.Context, config backend.BuildConfig) (string
|
||||
stdout := config.ProgressWriter.StdoutFormatter
|
||||
fmt.Fprintf(stdout, "Successfully built %s\n", stringid.TruncateID(imageID))
|
||||
}
|
||||
if imageID != "" {
|
||||
if imageID != "" && !useBuildKit {
|
||||
err = tagger.TagImages(image.ID(imageID))
|
||||
}
|
||||
return imageID, err
|
||||
|
||||
@@ -33,7 +33,7 @@ func TestJsonContentType(t *testing.T) {
|
||||
|
||||
func TestReadJSON(t *testing.T) {
|
||||
t.Run("nil body", func(t *testing.T) {
|
||||
req, err := http.NewRequest("POST", "https://example.com/some/path", nil)
|
||||
req, err := http.NewRequest(http.MethodPost, "https://example.com/some/path", nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
@@ -45,7 +45,7 @@ func TestReadJSON(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("empty body", func(t *testing.T) {
|
||||
req, err := http.NewRequest("POST", "https://example.com/some/path", strings.NewReader(""))
|
||||
req, err := http.NewRequest(http.MethodPost, "https://example.com/some/path", strings.NewReader(""))
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
@@ -60,7 +60,7 @@ func TestReadJSON(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("with valid request", func(t *testing.T) {
|
||||
req, err := http.NewRequest("POST", "https://example.com/some/path", strings.NewReader(`{"SomeField":"some value"}`))
|
||||
req, err := http.NewRequest(http.MethodPost, "https://example.com/some/path", strings.NewReader(`{"SomeField":"some value"}`))
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
@@ -75,7 +75,7 @@ func TestReadJSON(t *testing.T) {
|
||||
}
|
||||
})
|
||||
t.Run("with whitespace", func(t *testing.T) {
|
||||
req, err := http.NewRequest("POST", "https://example.com/some/path", strings.NewReader(`
|
||||
req, err := http.NewRequest(http.MethodPost, "https://example.com/some/path", strings.NewReader(`
|
||||
|
||||
{"SomeField":"some value"}
|
||||
|
||||
@@ -95,7 +95,7 @@ func TestReadJSON(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("with extra content", func(t *testing.T) {
|
||||
req, err := http.NewRequest("POST", "https://example.com/some/path", strings.NewReader(`{"SomeField":"some value"} and more content`))
|
||||
req, err := http.NewRequest(http.MethodPost, "https://example.com/some/path", strings.NewReader(`{"SomeField":"some value"} and more content`))
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
@@ -112,7 +112,7 @@ func TestReadJSON(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("invalid JSON", func(t *testing.T) {
|
||||
req, err := http.NewRequest("POST", "https://example.com/some/path", strings.NewReader(`{invalid json`))
|
||||
req, err := http.NewRequest(http.MethodPost, "https://example.com/some/path", strings.NewReader(`{invalid json`))
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/backend"
|
||||
"github.com/docker/docker/builder"
|
||||
containerimageexp "github.com/docker/docker/builder/builder-next/exporter"
|
||||
"github.com/docker/docker/daemon/config"
|
||||
"github.com/docker/docker/daemon/images"
|
||||
"github.com/docker/docker/libnetwork"
|
||||
@@ -70,6 +71,7 @@ type Opt struct {
|
||||
Root string
|
||||
Dist images.DistributionServices
|
||||
NetworkController libnetwork.NetworkController
|
||||
ImageTagger containerimageexp.ImageTagger
|
||||
DefaultCgroupParent string
|
||||
RegistryHosts docker.RegistryHosts
|
||||
BuilderConfig config.BuilderConfig
|
||||
|
||||
@@ -159,9 +159,9 @@ func newController(rt http.RoundTripper, opt Opt) (*control.Controller, error) {
|
||||
}
|
||||
|
||||
exp, err := containerimageexp.New(containerimageexp.Opt{
|
||||
ImageStore: dist.ImageStore,
|
||||
ReferenceStore: dist.ReferenceStore,
|
||||
Differ: differ,
|
||||
ImageStore: dist.ImageStore,
|
||||
Differ: differ,
|
||||
ImageTagger: opt.ImageTagger,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -7,10 +7,10 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/distribution/reference"
|
||||
distref "github.com/docker/distribution/reference"
|
||||
"github.com/docker/docker/image"
|
||||
"github.com/docker/docker/layer"
|
||||
"github.com/docker/docker/reference"
|
||||
"github.com/moby/buildkit/exporter"
|
||||
"github.com/moby/buildkit/exporter/containerimage/exptypes"
|
||||
"github.com/moby/buildkit/util/compression"
|
||||
@@ -29,11 +29,15 @@ type Differ interface {
|
||||
EnsureLayer(ctx context.Context, key string) ([]layer.DiffID, error)
|
||||
}
|
||||
|
||||
type ImageTagger interface {
|
||||
TagImageWithReference(imageID image.ID, newTag reference.Named) error
|
||||
}
|
||||
|
||||
// Opt defines a struct for creating new exporter
|
||||
type Opt struct {
|
||||
ImageStore image.Store
|
||||
ReferenceStore reference.Store
|
||||
Differ Differ
|
||||
ImageStore image.Store
|
||||
Differ Differ
|
||||
ImageTagger ImageTagger
|
||||
}
|
||||
|
||||
type imageExporter struct {
|
||||
@@ -206,10 +210,10 @@ func (e *imageExporterInstance) Export(ctx context.Context, inp exporter.Source,
|
||||
}
|
||||
_ = configDone(nil)
|
||||
|
||||
if e.opt.ReferenceStore != nil {
|
||||
if e.opt.ImageTagger != nil {
|
||||
for _, targetName := range e.targetNames {
|
||||
tagDone := oneOffProgress(ctx, "naming to "+targetName.String())
|
||||
if err := e.opt.ReferenceStore.AddTag(targetName, digest.Digest(id), true); err != nil {
|
||||
if err := e.opt.ImageTagger.TagImageWithReference(image.ID(digest.Digest(id)), targetName); err != nil {
|
||||
return nil, tagDone(err)
|
||||
}
|
||||
_ = tagDone(nil)
|
||||
|
||||
@@ -6,9 +6,10 @@ https://docs.docker.com/engine/api/
|
||||
|
||||
# Usage
|
||||
|
||||
You use the library by creating a client object and calling methods on it. The
|
||||
client can be created either from environment variables with NewClientWithOpts(client.FromEnv),
|
||||
or configured manually with NewClient().
|
||||
You use the library by constructing a client object using [NewClientWithOpts]
|
||||
and calling methods on it. The client can be configured from environment
|
||||
variables by passing the [FromEnv] option, or configured manually by passing any
|
||||
of the other available [Opts].
|
||||
|
||||
For example, to list running containers (the equivalent of "docker ps"):
|
||||
|
||||
|
||||
@@ -9,7 +9,11 @@ import "net/http"
|
||||
// It won't send any version information if the version number is empty. It is
|
||||
// highly recommended that you set a version or your client may break if the
|
||||
// server is upgraded.
|
||||
// Deprecated: use NewClientWithOpts
|
||||
//
|
||||
// Deprecated: use [NewClientWithOpts] passing the [WithHost], [WithVersion],
|
||||
// [WithHTTPClient] and [WithHTTPHeaders] options. We recommend enabling API
|
||||
// version negotiation by passing the [WithAPIVersionNegotiation] option instead
|
||||
// of WithVersion.
|
||||
func NewClient(host string, version string, client *http.Client, httpHeaders map[string]string) (*Client, error) {
|
||||
return NewClientWithOpts(WithHost(host), WithVersion(version), WithHTTPClient(client), WithHTTPHeaders(httpHeaders))
|
||||
}
|
||||
@@ -17,7 +21,7 @@ func NewClient(host string, version string, client *http.Client, httpHeaders map
|
||||
// NewEnvClient initializes a new API client based on environment variables.
|
||||
// See FromEnv for a list of support environment variables.
|
||||
//
|
||||
// Deprecated: use NewClientWithOpts(FromEnv)
|
||||
// Deprecated: use [NewClientWithOpts] passing the [FromEnv] option.
|
||||
func NewEnvClient() (*Client, error) {
|
||||
return NewClientWithOpts(FromEnv)
|
||||
}
|
||||
|
||||
@@ -295,6 +295,7 @@ func newRouterOptions(config *config.Config, d *daemon.Daemon) (routerOptions, e
|
||||
SessionManager: sm,
|
||||
Root: filepath.Join(config.Root, "buildkit"),
|
||||
Dist: d.DistributionServices(),
|
||||
ImageTagger: d.ImageService(),
|
||||
NetworkController: d.NetworkController(),
|
||||
DefaultCgroupParent: cgroupParent,
|
||||
RegistryHosts: d.RegistryHosts(),
|
||||
|
||||
@@ -88,6 +88,7 @@ func main() {
|
||||
_, stdout, stderr := term.StdStreams()
|
||||
|
||||
initLogging(stdout, stderr)
|
||||
configureGRPCLog()
|
||||
|
||||
onError := func(err error) {
|
||||
fmt.Fprintf(stderr, "%s\n", err)
|
||||
|
||||
17
cmd/dockerd/grpclog.go
Normal file
17
cmd/dockerd/grpclog.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/sirupsen/logrus"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
)
|
||||
|
||||
// grpc's default logger is *very* noisy and uses "info" and even "warn" level logging for mostly useless messages.
|
||||
// This function configures the grpc logger to step down the severity of all messages.
|
||||
//
|
||||
// info => trace
|
||||
// warn => debug
|
||||
// error => warn
|
||||
func configureGRPCLog() {
|
||||
l := logrus.WithField("library", "grpc")
|
||||
grpclog.SetLoggerV2(grpclog.NewLoggerV2(l.WriterLevel(logrus.TraceLevel), l.WriterLevel(logrus.DebugLevel), l.WriterLevel(logrus.WarnLevel)))
|
||||
}
|
||||
@@ -390,18 +390,18 @@ cmd_entrypoint_install() {
|
||||
cli_ctx_create "${CLI_CONTEXT}" "unix://${XDG_RUNTIME_DIR}/docker.sock" "Rootless mode"
|
||||
fi
|
||||
|
||||
INFO "Use CLI context \"${CLI_CONTEXT}\""
|
||||
INFO "Using CLI context \"${CLI_CONTEXT}\""
|
||||
cli_ctx_use "${CLI_CONTEXT}"
|
||||
|
||||
echo
|
||||
INFO "Make sure the following environment variables are set (or add them to ~/.bashrc):"
|
||||
echo
|
||||
INFO "Make sure the following environment variable(s) are set (or add them to ~/.bashrc):"
|
||||
if [ -n "$XDG_RUNTIME_DIR_CREATED" ]; then
|
||||
echo "# WARNING: systemd not found. You have to remove XDG_RUNTIME_DIR manually on every logout."
|
||||
echo "export XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR}"
|
||||
fi
|
||||
echo "export PATH=${BIN}:\$PATH"
|
||||
echo "Some applications may require the following environment variable too:"
|
||||
echo
|
||||
INFO "Some applications may require the following environment variable too:"
|
||||
echo "export DOCKER_HOST=unix://${XDG_RUNTIME_DIR}/docker.sock"
|
||||
echo
|
||||
|
||||
@@ -433,7 +433,7 @@ cmd_entrypoint_uninstall() {
|
||||
unset DOCKER_HOST
|
||||
unset DOCKER_CONTEXT
|
||||
cli_ctx_use "default"
|
||||
INFO 'Configured CLI use the "default" context.'
|
||||
INFO 'Configured CLI to use the "default" context.'
|
||||
INFO
|
||||
INFO 'Make sure to unset or update the environment PATH, DOCKER_HOST, and DOCKER_CONTEXT environment variables if you have added them to `~/.bashrc`.'
|
||||
INFO "This uninstallation tool does NOT remove Docker binaries and data."
|
||||
|
||||
@@ -107,7 +107,7 @@ if [ -z "$_DOCKERD_ROOTLESS_CHILD" ]; then
|
||||
--copy-up=/etc --copy-up=/run \
|
||||
--propagation=rslave \
|
||||
$DOCKERD_ROOTLESS_ROOTLESSKIT_FLAGS \
|
||||
$0 $@
|
||||
"$0" "$@"
|
||||
else
|
||||
[ "$_DOCKERD_ROOTLESS_CHILD" = 1 ]
|
||||
# remove the symlinks for the existing files in the parent namespace if any,
|
||||
@@ -130,6 +130,5 @@ else
|
||||
mount --rbind ${realpath_etc_ssl} /etc/ssl
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
exec $dockerd "$@"
|
||||
exec "$dockerd" "$@"
|
||||
fi
|
||||
|
||||
@@ -4,16 +4,19 @@ import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"os"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/docker/daemon/config"
|
||||
"github.com/docker/docker/libnetwork/ns"
|
||||
"github.com/docker/docker/libnetwork/resolvconf"
|
||||
"github.com/moby/sys/mount"
|
||||
"github.com/moby/sys/mountinfo"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/vishvananda/netlink"
|
||||
)
|
||||
|
||||
// On Linux, plugins use a static path for storing execution state,
|
||||
@@ -141,3 +144,41 @@ func setupResolvConf(config *config.Config) {
|
||||
}
|
||||
config.ResolvConf = resolvconf.Path()
|
||||
}
|
||||
|
||||
// ifaceAddrs returns the IPv4 and IPv6 addresses assigned to the network
|
||||
// interface with name linkName.
|
||||
//
|
||||
// No error is returned if the named interface does not exist.
|
||||
func ifaceAddrs(linkName string) (v4, v6 []*net.IPNet, err error) {
|
||||
nl := ns.NlHandle()
|
||||
link, err := nl.LinkByName(linkName)
|
||||
if err != nil {
|
||||
if !errors.As(err, new(netlink.LinkNotFoundError)) {
|
||||
return nil, nil, err
|
||||
}
|
||||
return nil, nil, nil
|
||||
}
|
||||
|
||||
get := func(family int) ([]*net.IPNet, error) {
|
||||
addrs, err := nl.AddrList(link, family)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ipnets := make([]*net.IPNet, len(addrs))
|
||||
for i := range addrs {
|
||||
ipnets[i] = addrs[i].IPNet
|
||||
}
|
||||
return ipnets, nil
|
||||
}
|
||||
|
||||
v4, err = get(netlink.FAMILY_V4)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
v6, err = get(netlink.FAMILY_V6)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
return v4, v6, nil
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
package daemon // import "github.com/docker/docker/daemon"
|
||||
|
||||
import (
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -11,8 +12,12 @@ import (
|
||||
|
||||
containertypes "github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/daemon/config"
|
||||
"github.com/docker/docker/libnetwork/testutils"
|
||||
"github.com/docker/docker/libnetwork/types"
|
||||
"github.com/google/go-cmp/cmp/cmpopts"
|
||||
"github.com/moby/sys/mount"
|
||||
"github.com/moby/sys/mountinfo"
|
||||
"github.com/vishvananda/netlink"
|
||||
"gotest.tools/v3/assert"
|
||||
is "gotest.tools/v3/assert/cmp"
|
||||
)
|
||||
@@ -343,3 +348,66 @@ func TestRootMountCleanup(t *testing.T) {
|
||||
assert.Assert(t, d.cleanupMounts())
|
||||
})
|
||||
}
|
||||
|
||||
func TestIfaceAddrs(t *testing.T) {
|
||||
CIDR := func(cidr string) *net.IPNet {
|
||||
t.Helper()
|
||||
nw, err := types.ParseCIDR(cidr)
|
||||
assert.NilError(t, err)
|
||||
return nw
|
||||
}
|
||||
|
||||
for _, tt := range []struct {
|
||||
name string
|
||||
nws []*net.IPNet
|
||||
}{
|
||||
{
|
||||
name: "Single",
|
||||
nws: []*net.IPNet{CIDR("172.101.202.254/16")},
|
||||
},
|
||||
{
|
||||
name: "Multiple",
|
||||
nws: []*net.IPNet{
|
||||
CIDR("172.101.202.254/16"),
|
||||
CIDR("172.102.202.254/16"),
|
||||
},
|
||||
},
|
||||
} {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
defer testutils.SetupTestOSContext(t)()
|
||||
|
||||
createBridge(t, "test", tt.nws...)
|
||||
|
||||
ipv4Nw, ipv6Nw, err := ifaceAddrs("test")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
assert.Check(t, is.DeepEqual(tt.nws, ipv4Nw,
|
||||
cmpopts.SortSlices(func(a, b *net.IPNet) bool { return a.String() < b.String() })))
|
||||
// IPv6 link-local address
|
||||
assert.Check(t, is.Len(ipv6Nw, 1))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func createBridge(t *testing.T, name string, bips ...*net.IPNet) {
|
||||
t.Helper()
|
||||
|
||||
link := &netlink.Bridge{
|
||||
LinkAttrs: netlink.LinkAttrs{
|
||||
Name: name,
|
||||
},
|
||||
}
|
||||
if err := netlink.LinkAdd(link); err != nil {
|
||||
t.Fatalf("Failed to create interface via netlink: %v", err)
|
||||
}
|
||||
for _, bip := range bips {
|
||||
if err := netlink.AddrAdd(link, &netlink.Addr{IPNet: bip}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
if err := netlink.LinkSetUp(link); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ import (
|
||||
nwconfig "github.com/docker/docker/libnetwork/config"
|
||||
"github.com/docker/docker/libnetwork/drivers/bridge"
|
||||
"github.com/docker/docker/libnetwork/netlabel"
|
||||
"github.com/docker/docker/libnetwork/netutils"
|
||||
"github.com/docker/docker/libnetwork/options"
|
||||
lntypes "github.com/docker/docker/libnetwork/types"
|
||||
"github.com/docker/docker/opts"
|
||||
@@ -950,30 +949,37 @@ func initBridgeDriver(controller libnetwork.NetworkController, config *config.Co
|
||||
|
||||
ipamV4Conf := &libnetwork.IpamConf{AuxAddresses: make(map[string]string)}
|
||||
|
||||
nwList, nw6List, err := netutils.ElectInterfaceAddresses(bridgeName)
|
||||
// By default, libnetwork will request an arbitrary available address
|
||||
// pool for the network from the configured IPAM allocator.
|
||||
// Configure it to use the IPv4 network ranges of the existing bridge
|
||||
// interface if one exists with IPv4 addresses assigned to it.
|
||||
|
||||
nwList, nw6List, err := ifaceAddrs(bridgeName)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "list bridge addresses failed")
|
||||
}
|
||||
|
||||
nw := nwList[0]
|
||||
if len(nwList) > 1 && config.BridgeConfig.FixedCIDR != "" {
|
||||
_, fCIDR, err := net.ParseCIDR(config.BridgeConfig.FixedCIDR)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "parse CIDR failed")
|
||||
}
|
||||
// Iterate through in case there are multiple addresses for the bridge
|
||||
for _, entry := range nwList {
|
||||
if fCIDR.Contains(entry.IP) {
|
||||
nw = entry
|
||||
break
|
||||
if len(nwList) > 0 {
|
||||
nw := nwList[0]
|
||||
if len(nwList) > 1 && config.BridgeConfig.FixedCIDR != "" {
|
||||
_, fCIDR, err := net.ParseCIDR(config.BridgeConfig.FixedCIDR)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "parse CIDR failed")
|
||||
}
|
||||
// Iterate through in case there are multiple addresses for the bridge
|
||||
for _, entry := range nwList {
|
||||
if fCIDR.Contains(entry.IP) {
|
||||
nw = entry
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ipamV4Conf.PreferredPool = lntypes.GetIPNetCanonical(nw).String()
|
||||
hip, _ := lntypes.GetHostPartIP(nw.IP, nw.Mask)
|
||||
if hip.IsGlobalUnicast() {
|
||||
ipamV4Conf.Gateway = nw.IP.String()
|
||||
ipamV4Conf.PreferredPool = lntypes.GetIPNetCanonical(nw).String()
|
||||
hip, _ := lntypes.GetHostPartIP(nw.IP, nw.Mask)
|
||||
if hip.IsGlobalUnicast() {
|
||||
ipamV4Conf.Gateway = nw.IP.String()
|
||||
}
|
||||
}
|
||||
|
||||
if config.BridgeConfig.IP != "" {
|
||||
@@ -994,6 +1000,9 @@ func initBridgeDriver(controller libnetwork.NetworkController, config *config.Co
|
||||
}
|
||||
|
||||
ipamV4Conf.SubPool = fCIDR.String()
|
||||
if ipamV4Conf.PreferredPool == "" {
|
||||
ipamV4Conf.PreferredPool = fCIDR.String()
|
||||
}
|
||||
}
|
||||
|
||||
if config.BridgeConfig.DefaultGatewayIPv4 != nil {
|
||||
|
||||
@@ -5,6 +5,7 @@ package copy // import "github.com/docker/docker/daemon/graphdriver/copy"
|
||||
|
||||
import (
|
||||
"container/list"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
@@ -90,6 +91,11 @@ func legacyCopy(srcFile io.Reader, dstFile io.Writer) error {
|
||||
func copyXattr(srcPath, dstPath, attr string) error {
|
||||
data, err := system.Lgetxattr(srcPath, attr)
|
||||
if err != nil {
|
||||
if errors.Is(err, syscall.EOPNOTSUPP) {
|
||||
// Task failed successfully: there is no xattr to copy
|
||||
// if the source filesystem doesn't support xattrs.
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
if data != nil {
|
||||
|
||||
@@ -78,7 +78,6 @@ type logStream struct {
|
||||
logGroupName string
|
||||
logCreateGroup bool
|
||||
logCreateStream bool
|
||||
logNonBlocking bool
|
||||
forceFlushInterval time.Duration
|
||||
multilinePattern *regexp.Regexp
|
||||
client api
|
||||
@@ -93,7 +92,6 @@ type logStreamConfig struct {
|
||||
logGroupName string
|
||||
logCreateGroup bool
|
||||
logCreateStream bool
|
||||
logNonBlocking bool
|
||||
forceFlushInterval time.Duration
|
||||
maxBufferedEvents int
|
||||
multilinePattern *regexp.Regexp
|
||||
@@ -155,12 +153,13 @@ func New(info logger.Info) (logger.Logger, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
logNonBlocking := info.Config["mode"] == "non-blocking"
|
||||
|
||||
containerStream := &logStream{
|
||||
logStreamName: containerStreamConfig.logStreamName,
|
||||
logGroupName: containerStreamConfig.logGroupName,
|
||||
logCreateGroup: containerStreamConfig.logCreateGroup,
|
||||
logCreateStream: containerStreamConfig.logCreateStream,
|
||||
logNonBlocking: containerStreamConfig.logNonBlocking,
|
||||
forceFlushInterval: containerStreamConfig.forceFlushInterval,
|
||||
multilinePattern: containerStreamConfig.multilinePattern,
|
||||
client: client,
|
||||
@@ -168,7 +167,7 @@ func New(info logger.Info) (logger.Logger, error) {
|
||||
}
|
||||
|
||||
creationDone := make(chan bool)
|
||||
if containerStream.logNonBlocking {
|
||||
if logNonBlocking {
|
||||
go func() {
|
||||
backoff := 1
|
||||
maxBackoff := 32
|
||||
@@ -224,8 +223,6 @@ func newStreamConfig(info logger.Info) (*logStreamConfig, error) {
|
||||
}
|
||||
}
|
||||
|
||||
logNonBlocking := info.Config["mode"] == "non-blocking"
|
||||
|
||||
forceFlushInterval := defaultForceFlushInterval
|
||||
if info.Config[forceFlushIntervalKey] != "" {
|
||||
forceFlushIntervalAsInt, err := strconv.Atoi(info.Config[forceFlushIntervalKey])
|
||||
@@ -264,7 +261,6 @@ func newStreamConfig(info logger.Info) (*logStreamConfig, error) {
|
||||
logGroupName: logGroupName,
|
||||
logCreateGroup: logCreateGroup,
|
||||
logCreateStream: logCreateStream,
|
||||
logNonBlocking: logNonBlocking,
|
||||
forceFlushInterval: forceFlushInterval,
|
||||
maxBufferedEvents: maxBufferedEvents,
|
||||
multilinePattern: multilinePattern,
|
||||
@@ -439,14 +435,6 @@ func (l *logStream) Log(msg *logger.Message) error {
|
||||
if l.closed {
|
||||
return errors.New("awslogs is closed")
|
||||
}
|
||||
if l.logNonBlocking {
|
||||
select {
|
||||
case l.messages <- msg:
|
||||
return nil
|
||||
default:
|
||||
return errors.New("awslogs buffer is full")
|
||||
}
|
||||
}
|
||||
l.messages <- msg
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -390,40 +390,16 @@ func TestLogBlocking(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestLogNonBlockingBufferEmpty(t *testing.T) {
|
||||
func TestLogBufferEmpty(t *testing.T) {
|
||||
mockClient := &mockClient{}
|
||||
stream := &logStream{
|
||||
client: mockClient,
|
||||
messages: make(chan *logger.Message, 1),
|
||||
logNonBlocking: true,
|
||||
client: mockClient,
|
||||
messages: make(chan *logger.Message, 1),
|
||||
}
|
||||
err := stream.Log(&logger.Message{})
|
||||
assert.NilError(t, err)
|
||||
}
|
||||
|
||||
func TestLogNonBlockingBufferFull(t *testing.T) {
|
||||
mockClient := &mockClient{}
|
||||
stream := &logStream{
|
||||
client: mockClient,
|
||||
messages: make(chan *logger.Message, 1),
|
||||
logNonBlocking: true,
|
||||
}
|
||||
stream.messages <- &logger.Message{}
|
||||
errorCh := make(chan error, 1)
|
||||
started := make(chan bool)
|
||||
go func() {
|
||||
started <- true
|
||||
err := stream.Log(&logger.Message{})
|
||||
errorCh <- err
|
||||
}()
|
||||
<-started
|
||||
select {
|
||||
case err := <-errorCh:
|
||||
assert.Check(t, err != nil)
|
||||
case <-time.After(30 * time.Second):
|
||||
t.Fatal("Expected Log call to not block")
|
||||
}
|
||||
}
|
||||
func TestPublishBatchSuccess(t *testing.T) {
|
||||
mockClient := &mockClient{}
|
||||
stream := &logStream{
|
||||
|
||||
@@ -15,7 +15,7 @@ set -e
|
||||
# the binary version you may also need to update the vendor version to pick up
|
||||
# bug fixes or new APIs, however, usually the Go packages are built from a
|
||||
# commit from the master branch.
|
||||
: "${CONTAINERD_VERSION:=v1.6.19}"
|
||||
: "${CONTAINERD_VERSION:=v1.6.21}"
|
||||
|
||||
install_containerd() (
|
||||
echo "Install containerd version $CONTAINERD_VERSION"
|
||||
|
||||
@@ -9,7 +9,7 @@ set -e
|
||||
# the containerd project first, and update both after that is merged.
|
||||
#
|
||||
# When updating RUNC_VERSION, consider updating runc in vendor.mod accordingly
|
||||
: "${RUNC_VERSION:=v1.1.4}"
|
||||
: "${RUNC_VERSION:=v1.1.7}"
|
||||
|
||||
install_runc() {
|
||||
RUNC_BUILDTAGS="${RUNC_BUILDTAGS:-"seccomp"}"
|
||||
|
||||
@@ -509,16 +509,18 @@ func (s *DockerCLIExecSuite) TestExecUlimits(c *testing.T) {
|
||||
|
||||
// #15750
|
||||
func (s *DockerCLIExecSuite) TestExecStartFails(c *testing.T) {
|
||||
// TODO Windows CI. This test should be portable. Figure out why it fails
|
||||
// currently.
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "exec-15750"
|
||||
runSleepingContainer(c, "-d", "--name", name)
|
||||
assert.NilError(c, waitRun(name))
|
||||
|
||||
out, _, err := dockerCmdWithError("exec", name, "no-such-cmd")
|
||||
assert.ErrorContains(c, err, "", out)
|
||||
assert.Assert(c, strings.Contains(out, "executable file not found"))
|
||||
|
||||
expectedMsg := "executable file not found"
|
||||
if DaemonIsWindows() {
|
||||
expectedMsg = "The system cannot find the file specified"
|
||||
}
|
||||
assert.Assert(c, is.Contains(out, expectedMsg))
|
||||
}
|
||||
|
||||
// Fix regression in https://github.com/docker/docker/pull/26461#issuecomment-250287297
|
||||
|
||||
@@ -124,6 +124,12 @@ func testLogs(t *testing.T, logDriver string) {
|
||||
},
|
||||
}
|
||||
|
||||
pollTimeout := time.Second * 10
|
||||
if testEnv.OSType == "windows" {
|
||||
// hcs can take longer than 10s to stop a container.
|
||||
pollTimeout = time.Second * 75
|
||||
}
|
||||
|
||||
for _, tC := range testCases {
|
||||
tC := tC
|
||||
t.Run(tC.desc, func(t *testing.T) {
|
||||
@@ -136,7 +142,9 @@ func testLogs(t *testing.T, logDriver string) {
|
||||
)
|
||||
defer client.ContainerRemove(ctx, id, types.ContainerRemoveOptions{Force: true})
|
||||
|
||||
poll.WaitOn(t, container.IsStopped(ctx, client, id), poll.WithDelay(time.Millisecond*100))
|
||||
poll.WaitOn(t, container.IsStopped(ctx, client, id),
|
||||
poll.WithDelay(time.Millisecond*100),
|
||||
poll.WithTimeout(pollTimeout))
|
||||
|
||||
logs, err := client.ContainerLogs(ctx, id, tC.logOps)
|
||||
assert.NilError(t, err)
|
||||
|
||||
@@ -21,6 +21,7 @@ import (
|
||||
"github.com/docker/docker/testutil/daemon"
|
||||
"gotest.tools/v3/assert"
|
||||
is "gotest.tools/v3/assert/cmp"
|
||||
"gotest.tools/v3/icmd"
|
||||
"gotest.tools/v3/skip"
|
||||
)
|
||||
|
||||
@@ -416,3 +417,30 @@ func testLiveRestoreVolumeReferences(t *testing.T) {
|
||||
runTest(t, "no")
|
||||
})
|
||||
}
|
||||
|
||||
func TestDaemonDefaultBridgeWithFixedCidrButNoBip(t *testing.T) {
|
||||
skip.If(t, runtime.GOOS == "windows")
|
||||
|
||||
bridgeName := "ext-bridge1"
|
||||
d := daemon.New(t, daemon.WithEnvVars("DOCKER_TEST_CREATE_DEFAULT_BRIDGE="+bridgeName))
|
||||
defer func() {
|
||||
d.Stop(t)
|
||||
d.Cleanup(t)
|
||||
}()
|
||||
|
||||
defer func() {
|
||||
// No need to clean up when running this test in rootless mode, as the
|
||||
// interface is deleted when the daemon is stopped and the netns
|
||||
// reclaimed by the kernel.
|
||||
if !testEnv.IsRootless() {
|
||||
deleteInterface(t, bridgeName)
|
||||
}
|
||||
}()
|
||||
d.StartWithBusybox(t, "--bridge", bridgeName, "--fixed-cidr", "192.168.130.0/24")
|
||||
}
|
||||
|
||||
func deleteInterface(t *testing.T, ifName string) {
|
||||
icmd.RunCommand("ip", "link", "delete", ifName).Assert(t, icmd.Success)
|
||||
icmd.RunCommand("iptables", "-t", "nat", "--flush").Assert(t, icmd.Success)
|
||||
icmd.RunCommand("iptables", "--flush").Assert(t, icmd.Success)
|
||||
}
|
||||
|
||||
@@ -16,8 +16,14 @@ import (
|
||||
// SetupDevice create a new bridge interface/
|
||||
func setupDevice(config *networkConfiguration, i *bridgeInterface) error {
|
||||
// We only attempt to create the bridge when the requested device name is
|
||||
// the default one.
|
||||
if config.BridgeName != DefaultBridgeName && config.DefaultBridge {
|
||||
// the default one. The default bridge name can be overridden with the
|
||||
// DOCKER_TEST_CREATE_DEFAULT_BRIDGE env var. It should be used only for
|
||||
// test purpose.
|
||||
var defaultBridgeName string
|
||||
if defaultBridgeName = os.Getenv("DOCKER_TEST_CREATE_DEFAULT_BRIDGE"); defaultBridgeName == "" {
|
||||
defaultBridgeName = DefaultBridgeName
|
||||
}
|
||||
if config.BridgeName != defaultBridgeName && config.DefaultBridge {
|
||||
return NonDefaultBridgeExistError(config.BridgeName)
|
||||
}
|
||||
|
||||
|
||||
47
libnetwork/drivers/overlay/bpf.go
Normal file
47
libnetwork/drivers/overlay/bpf.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package overlay
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/net/bpf"
|
||||
)
|
||||
|
||||
// vniMatchBPF returns a BPF program suitable for passing to the iptables bpf
|
||||
// match which matches on the VXAN Network ID of encapsulated packets. The
|
||||
// program assumes that it will be used in a rule which only matches UDP
|
||||
// datagrams.
|
||||
func vniMatchBPF(vni uint32) []bpf.RawInstruction {
|
||||
asm, err := bpf.Assemble([]bpf.Instruction{
|
||||
bpf.LoadMemShift{Off: 0}, // ldx 4*([0] & 0xf) ; Load length of IPv4 header into X
|
||||
bpf.LoadIndirect{Off: 12, Size: 4}, // ld [x + 12] ; Load VXLAN ID (UDP header + 4 bytes) into A
|
||||
bpf.ALUOpConstant{Op: bpf.ALUOpAnd, Val: 0xffffff00}, // and #0xffffff00 ; VXLAN ID is in top 24 bits
|
||||
bpf.JumpIf{Cond: bpf.JumpEqual, Val: vni << 8, SkipTrue: 1}, // jeq ($vni << 8), match
|
||||
bpf.RetConstant{Val: 0}, // ret #0
|
||||
bpf.RetConstant{Val: ^uint32(0)}, // match: ret #-1
|
||||
})
|
||||
// bpf.Assemble() only errors if an instruction is invalid. As the only variable
|
||||
// part of the program is an instruction value for which the entire range is
|
||||
// valid, whether the program can be successfully assembled is independent of
|
||||
// the input. Given that the only recourse is to fix this function and
|
||||
// recompile, there's little value in bubbling the error up to the caller.
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return asm
|
||||
}
|
||||
|
||||
// marshalXTBPF marshals a BPF program into the "decimal" byte code format
|
||||
// which is suitable for passing to the [iptables bpf match].
|
||||
//
|
||||
// iptables -m bpf --bytecode
|
||||
//
|
||||
// [iptables bpf match]: https://ipset.netfilter.org/iptables-extensions.man.html#lbAH
|
||||
func marshalXTBPF(prog []bpf.RawInstruction) string { //nolint:unused
|
||||
var b strings.Builder
|
||||
fmt.Fprintf(&b, "%d", len(prog))
|
||||
for _, ins := range prog {
|
||||
fmt.Fprintf(&b, ",%d %d %d %d", ins.Op, ins.Jt, ins.Jf, ins.K)
|
||||
}
|
||||
return b.String()
|
||||
}
|
||||
14
libnetwork/drivers/overlay/bpf_test.go
Normal file
14
libnetwork/drivers/overlay/bpf_test.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package overlay
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func FuzzVNIMatchBPFDoesNotPanic(f *testing.F) {
|
||||
for _, seed := range []uint32{0, 1, 42, 0xfffffe, 0xffffff, 0xfffffffe, 0xffffffff} {
|
||||
f.Add(seed)
|
||||
}
|
||||
f.Fuzz(func(t *testing.T, vni uint32) {
|
||||
_ = vniMatchBPF(vni)
|
||||
})
|
||||
}
|
||||
@@ -18,12 +18,41 @@ import (
|
||||
"github.com/docker/docker/libnetwork/iptables"
|
||||
"github.com/docker/docker/libnetwork/ns"
|
||||
"github.com/docker/docker/libnetwork/types"
|
||||
"github.com/hashicorp/go-multierror"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/vishvananda/netlink"
|
||||
)
|
||||
|
||||
/*
|
||||
Encrypted overlay networks use IPsec in transport mode to encrypt and
|
||||
authenticate the VXLAN UDP datagrams. This driver implements a bespoke control
|
||||
plane which negotiates the security parameters for each peer-to-peer tunnel.
|
||||
|
||||
IPsec Terminology
|
||||
|
||||
- ESP: IPSec Encapsulating Security Payload
|
||||
- SPI: Security Parameter Index
|
||||
- ICV: Integrity Check Value
|
||||
- SA: Security Association https://en.wikipedia.org/wiki/IPsec#Security_association
|
||||
|
||||
|
||||
Developer documentation for Linux IPsec is rather sparse online. The following
|
||||
slide deck provides a decent overview.
|
||||
https://libreswan.org/wiki/images/e/e0/Netdev-0x12-ipsec-flow.pdf
|
||||
|
||||
The Linux IPsec stack is part of XFRM, the netlink packet transformation
|
||||
interface.
|
||||
https://man7.org/linux/man-pages/man8/ip-xfrm.8.html
|
||||
*/
|
||||
|
||||
const (
|
||||
r = 0xD0C4E3
|
||||
// Value used to mark outgoing packets which should have our IPsec
|
||||
// processing applied. It is also used as a label to identify XFRM
|
||||
// states (Security Associations) and policies (Security Policies)
|
||||
// programmed by us so we know which ones we can clean up without
|
||||
// disrupting other VPN connections on the system.
|
||||
mark = 0xD0C4E3
|
||||
|
||||
pktExpansion = 26 // SPI(4) + SeqN(4) + IV(8) + PadLength(1) + NextHeader(1) + ICV(8)
|
||||
)
|
||||
|
||||
@@ -33,7 +62,9 @@ const (
|
||||
bidir
|
||||
)
|
||||
|
||||
var spMark = netlink.XfrmMark{Value: uint32(r), Mask: 0xffffffff}
|
||||
// Mark value for matching packets which should have our IPsec security policy
|
||||
// applied.
|
||||
var spMark = netlink.XfrmMark{Value: mark, Mask: 0xffffffff}
|
||||
|
||||
type key struct {
|
||||
value []byte
|
||||
@@ -47,6 +78,9 @@ func (k *key) String() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// Security Parameter Indices for the IPsec flows between local node and a
|
||||
// remote peer, which identify the Security Associations (XFRM states) to be
|
||||
// applied when encrypting and decrypting packets.
|
||||
type spi struct {
|
||||
forward int
|
||||
reverse int
|
||||
@@ -79,8 +113,8 @@ func (e *encrMap) String() string {
|
||||
return b.String()
|
||||
}
|
||||
|
||||
func (d *driver) checkEncryption(nid string, rIP net.IP, vxlanID uint32, isLocal, add bool) error {
|
||||
logrus.Debugf("checkEncryption(%.7s, %v, %d, %t)", nid, rIP, vxlanID, isLocal)
|
||||
func (d *driver) checkEncryption(nid string, rIP net.IP, isLocal, add bool) error {
|
||||
logrus.Debugf("checkEncryption(%.7s, %v, %t)", nid, rIP, isLocal)
|
||||
|
||||
n := d.network(nid)
|
||||
if n == nil || !n.secure {
|
||||
@@ -115,7 +149,7 @@ func (d *driver) checkEncryption(nid string, rIP net.IP, vxlanID uint32, isLocal
|
||||
|
||||
if add {
|
||||
for _, rIP := range nodes {
|
||||
if err := setupEncryption(lIP, aIP, rIP, vxlanID, d.secMap, d.keys); err != nil {
|
||||
if err := setupEncryption(lIP, aIP, rIP, d.secMap, d.keys); err != nil {
|
||||
logrus.Warnf("Failed to program network encryption between %s and %s: %v", lIP, rIP, err)
|
||||
}
|
||||
}
|
||||
@@ -130,22 +164,14 @@ func (d *driver) checkEncryption(nid string, rIP net.IP, vxlanID uint32, isLocal
|
||||
return nil
|
||||
}
|
||||
|
||||
func setupEncryption(localIP, advIP, remoteIP net.IP, vni uint32, em *encrMap, keys []*key) error {
|
||||
logrus.Debugf("Programming encryption for vxlan %d between %s and %s", vni, localIP, remoteIP)
|
||||
// setupEncryption programs the encryption parameters for secure communication
|
||||
// between the local node and a remote node.
|
||||
func setupEncryption(localIP, advIP, remoteIP net.IP, em *encrMap, keys []*key) error {
|
||||
logrus.Debugf("Programming encryption between %s and %s", localIP, remoteIP)
|
||||
rIPs := remoteIP.String()
|
||||
|
||||
indices := make([]*spi, 0, len(keys))
|
||||
|
||||
err := programMangle(vni, true)
|
||||
if err != nil {
|
||||
logrus.Warn(err)
|
||||
}
|
||||
|
||||
err = programInput(vni, true)
|
||||
if err != nil {
|
||||
logrus.Warn(err)
|
||||
}
|
||||
|
||||
for i, k := range keys {
|
||||
spis := &spi{buildSPI(advIP, remoteIP, k.tag), buildSPI(remoteIP, advIP, k.tag)}
|
||||
dir := reverse
|
||||
@@ -200,67 +226,96 @@ func removeEncryption(localIP, remoteIP net.IP, em *encrMap) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func programMangle(vni uint32, add bool) (err error) {
|
||||
type matchVXLANFunc func(port, vni uint32) []string
|
||||
|
||||
// programVXLANRuleFunc returns a function which tries calling programWithMatch
|
||||
// with the u32 match, falling back to the BPF match if installing u32 variant
|
||||
// of the rules fails.
|
||||
func programVXLANRuleFunc(programWithMatch func(matchVXLAN matchVXLANFunc, vni uint32, add bool) error) func(vni uint32, add bool) error {
|
||||
return func(vni uint32, add bool) error {
|
||||
if add {
|
||||
if err := programWithMatch(matchVXLANWithU32, vni, add); err != nil {
|
||||
// That didn't work. Maybe the xt_u32 module isn't available? Try again with xt_bpf.
|
||||
err2 := programWithMatch(matchVXLANWithBPF, vni, add)
|
||||
if err2 != nil {
|
||||
return multierror.Append(err, err2)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
} else {
|
||||
// Delete both flavours.
|
||||
err := programWithMatch(matchVXLANWithU32, vni, add)
|
||||
return multierror.Append(err, programWithMatch(matchVXLANWithBPF, vni, add)).ErrorOrNil()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var programMangle = programVXLANRuleFunc(func(matchVXLAN matchVXLANFunc, vni uint32, add bool) error {
|
||||
var (
|
||||
p = strconv.FormatUint(uint64(overlayutils.VXLANUDPPort()), 10)
|
||||
c = fmt.Sprintf("0>>22&0x3C@12&0xFFFFFF00=%d", int(vni)<<8)
|
||||
m = strconv.FormatUint(uint64(r), 10)
|
||||
m = strconv.FormatUint(mark, 10)
|
||||
chain = "OUTPUT"
|
||||
rule = []string{"-p", "udp", "--dport", p, "-m", "u32", "--u32", c, "-j", "MARK", "--set-mark", m}
|
||||
a = "-A"
|
||||
rule = append(matchVXLAN(overlayutils.VXLANUDPPort(), vni), "-j", "MARK", "--set-mark", m)
|
||||
a = iptables.Append
|
||||
action = "install"
|
||||
)
|
||||
|
||||
// TODO IPv6 support
|
||||
iptable := iptables.GetIptable(iptables.IPv4)
|
||||
|
||||
if add == iptable.Exists(iptables.Mangle, chain, rule...) {
|
||||
return
|
||||
}
|
||||
|
||||
if !add {
|
||||
a = "-D"
|
||||
a = iptables.Delete
|
||||
action = "remove"
|
||||
}
|
||||
|
||||
if err = iptable.RawCombinedOutput(append([]string{"-t", string(iptables.Mangle), a, chain}, rule...)...); err != nil {
|
||||
logrus.Warnf("could not %s mangle rule: %v", action, err)
|
||||
if err := iptable.ProgramRule(iptables.Mangle, chain, a, rule); err != nil {
|
||||
return fmt.Errorf("could not %s mangle rule: %w", action, err)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
func programInput(vni uint32, add bool) (err error) {
|
||||
var programInput = programVXLANRuleFunc(func(matchVXLAN matchVXLANFunc, vni uint32, add bool) error {
|
||||
var (
|
||||
port = strconv.FormatUint(uint64(overlayutils.VXLANUDPPort()), 10)
|
||||
vniMatch = fmt.Sprintf("0>>22&0x3C@12&0xFFFFFF00=%d", int(vni)<<8)
|
||||
plainVxlan = []string{"-p", "udp", "--dport", port, "-m", "u32", "--u32", vniMatch, "-j"}
|
||||
ipsecVxlan = append([]string{"-m", "policy", "--dir", "in", "--pol", "ipsec"}, plainVxlan...)
|
||||
block = append(plainVxlan, "DROP")
|
||||
accept = append(ipsecVxlan, "ACCEPT")
|
||||
plainVxlan = matchVXLAN(overlayutils.VXLANUDPPort(), vni)
|
||||
chain = "INPUT"
|
||||
action = iptables.Append
|
||||
msg = "add"
|
||||
)
|
||||
|
||||
rule := func(policy, jump string) []string {
|
||||
args := append([]string{"-m", "policy", "--dir", "in", "--pol", policy}, plainVxlan...)
|
||||
return append(args, "-j", jump)
|
||||
}
|
||||
|
||||
// TODO IPv6 support
|
||||
iptable := iptables.GetIptable(iptables.IPv4)
|
||||
|
||||
if !add {
|
||||
action = iptables.Delete
|
||||
msg = "remove"
|
||||
}
|
||||
|
||||
if err := iptable.ProgramRule(iptables.Filter, chain, action, accept); err != nil {
|
||||
logrus.Errorf("could not %s input rule: %v. Please do it manually.", msg, err)
|
||||
action := func(a iptables.Action) iptables.Action {
|
||||
if !add {
|
||||
return iptables.Delete
|
||||
}
|
||||
return a
|
||||
}
|
||||
|
||||
if err := iptable.ProgramRule(iptables.Filter, chain, action, block); err != nil {
|
||||
logrus.Errorf("could not %s input rule: %v. Please do it manually.", msg, err)
|
||||
// Accept incoming VXLAN datagrams for the VNI which were subjected to IPSec processing.
|
||||
// Append to the bottom of the chain to give administrator-configured rules precedence.
|
||||
if err := iptable.ProgramRule(iptables.Filter, chain, action(iptables.Append), rule("ipsec", "ACCEPT")); err != nil {
|
||||
return fmt.Errorf("could not %s input accept rule: %w", msg, err)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
// Drop incoming VXLAN datagrams for the VNI which were received in cleartext.
|
||||
// Insert at the top of the chain so the packets are dropped even if an
|
||||
// administrator-configured rule exists which would otherwise unconditionally
|
||||
// accept incoming VXLAN traffic.
|
||||
if err := iptable.ProgramRule(iptables.Filter, chain, action(iptables.Insert), rule("none", "DROP")); err != nil {
|
||||
return fmt.Errorf("could not %s input drop rule: %w", msg, err)
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
func programSA(localIP, remoteIP net.IP, spi *spi, k *key, dir int, add bool) (fSA *netlink.XfrmState, rSA *netlink.XfrmState, err error) {
|
||||
var (
|
||||
@@ -280,7 +335,7 @@ func programSA(localIP, remoteIP net.IP, spi *spi, k *key, dir int, add bool) (f
|
||||
Proto: netlink.XFRM_PROTO_ESP,
|
||||
Spi: spi.reverse,
|
||||
Mode: netlink.XFRM_MODE_TRANSPORT,
|
||||
Reqid: r,
|
||||
Reqid: mark,
|
||||
}
|
||||
if add {
|
||||
rSA.Aead = buildAeadAlgo(k, spi.reverse)
|
||||
@@ -306,7 +361,7 @@ func programSA(localIP, remoteIP net.IP, spi *spi, k *key, dir int, add bool) (f
|
||||
Proto: netlink.XFRM_PROTO_ESP,
|
||||
Spi: spi.forward,
|
||||
Mode: netlink.XFRM_MODE_TRANSPORT,
|
||||
Reqid: r,
|
||||
Reqid: mark,
|
||||
}
|
||||
if add {
|
||||
fSA.Aead = buildAeadAlgo(k, spi.forward)
|
||||
@@ -355,7 +410,7 @@ func programSP(fSA *netlink.XfrmState, rSA *netlink.XfrmState, add bool) error {
|
||||
Proto: netlink.XFRM_PROTO_ESP,
|
||||
Mode: netlink.XFRM_MODE_TRANSPORT,
|
||||
Spi: fSA.Spi,
|
||||
Reqid: r,
|
||||
Reqid: mark,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -569,7 +624,7 @@ func updateNodeKey(lIP, aIP, rIP net.IP, idxs []*spi, curKeys []*key, newIdx, pr
|
||||
Proto: netlink.XFRM_PROTO_ESP,
|
||||
Mode: netlink.XFRM_MODE_TRANSPORT,
|
||||
Spi: fSA2.Spi,
|
||||
Reqid: r,
|
||||
Reqid: mark,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -638,7 +693,7 @@ func clearEncryptionStates() {
|
||||
}
|
||||
for _, sa := range saList {
|
||||
sa := sa
|
||||
if sa.Reqid == r {
|
||||
if sa.Reqid == mark {
|
||||
if err := nlh.XfrmStateDel(&sa); err != nil {
|
||||
logrus.Warnf("Failed to delete stale SA %s: %v", sa, err)
|
||||
continue
|
||||
|
||||
17
libnetwork/drivers/overlay/encryption_bpf.go
Normal file
17
libnetwork/drivers/overlay/encryption_bpf.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package overlay
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// matchVXLANWithBPF returns an iptables rule fragment which matches VXLAN
|
||||
// datagrams with the given destination port and VXLAN Network ID utilizing the
|
||||
// xt_bpf netfilter kernel module. The returned slice's backing array is
|
||||
// guaranteed not to alias any other slice's.
|
||||
func matchVXLANWithBPF(port, vni uint32) []string {
|
||||
dport := strconv.FormatUint(uint64(port), 10)
|
||||
vniMatch := marshalXTBPF(vniMatchBPF(vni))
|
||||
|
||||
// https://ipset.netfilter.org/iptables-extensions.man.html#lbAH
|
||||
return []string{"-p", "udp", "--dport", dport, "-m", "bpf", "--bytecode", vniMatch}
|
||||
}
|
||||
30
libnetwork/drivers/overlay/encryption_u32.go
Normal file
30
libnetwork/drivers/overlay/encryption_u32.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package overlay
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// matchVXLANWithU32 returns an iptables rule fragment which matches VXLAN
|
||||
// datagrams with the given destination port and VXLAN Network ID utilizing the
|
||||
// xt_u32 netfilter kernel module. The returned slice's backing array is
|
||||
// guaranteed not to alias any other slice's.
|
||||
func matchVXLANWithU32(port, vni uint32) []string {
|
||||
dport := strconv.FormatUint(uint64(port), 10)
|
||||
|
||||
// The u32 expression language is documented in iptables-extensions(8).
|
||||
// https://ipset.netfilter.org/iptables-extensions.man.html#lbCK
|
||||
//
|
||||
// 0>>22&0x3C ; Compute number of octets in IPv4 header
|
||||
// @ ; Make this the new offset into the packet
|
||||
// ; (jump to start of UDP header)
|
||||
// 12&0xFFFFFF00 ; Read 32-bit value at offset 12 and mask off the bottom octet
|
||||
// = ; Test whether the value is equal to a constant
|
||||
//
|
||||
// A UDP header is eight octets long so offset 12 from the start of the
|
||||
// UDP header is four octets into the payload: the VNI field of the
|
||||
// VXLAN header.
|
||||
vniMatch := fmt.Sprintf("0>>22&0x3C@12&0xFFFFFF00=%d", int(vni)<<8)
|
||||
|
||||
return []string{"-p", "udp", "--dport", dport, "-m", "u32", "--u32", vniMatch}
|
||||
}
|
||||
@@ -117,7 +117,7 @@ func (d *driver) Join(nid, eid string, sboxKey string, jinfo driverapi.JoinInfo,
|
||||
|
||||
d.peerAdd(nid, eid, ep.addr.IP, ep.addr.Mask, ep.mac, net.ParseIP(d.advertiseAddress), false, false, true)
|
||||
|
||||
if err = d.checkEncryption(nid, nil, n.vxlanID(s), true, true); err != nil {
|
||||
if err = d.checkEncryption(nid, nil, true, true); err != nil {
|
||||
logrus.Warn(err)
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import (
|
||||
"github.com/docker/docker/libnetwork/resolvconf"
|
||||
"github.com/docker/docker/libnetwork/types"
|
||||
"github.com/docker/docker/pkg/reexec"
|
||||
"github.com/hashicorp/go-multierror"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/vishvananda/netlink"
|
||||
"github.com/vishvananda/netlink/nl"
|
||||
@@ -666,6 +667,18 @@ func (n *network) initSubnetSandbox(s *subnet, restore bool) error {
|
||||
brName := n.generateBridgeName(s)
|
||||
vxlanName := n.generateVxlanName(s)
|
||||
|
||||
// Program iptables rules for mandatory encryption of the secure
|
||||
// network, or clean up leftover rules for a stale secure network which
|
||||
// was previously assigned the same VNI.
|
||||
if err := programMangle(s.vni, n.secure); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := programInput(s.vni, n.secure); err != nil {
|
||||
if n.secure {
|
||||
return multierror.Append(err, programMangle(s.vni, false))
|
||||
}
|
||||
}
|
||||
|
||||
if restore {
|
||||
if err := n.restoreSubnetSandbox(s, brName, vxlanName); err != nil {
|
||||
return err
|
||||
|
||||
@@ -387,7 +387,7 @@ func (d *driver) peerAddOp(nid, eid string, peerIP net.IP, peerIPMask net.IPMask
|
||||
return fmt.Errorf("subnet sandbox join failed for %q: %v", s.subnetIP.String(), err)
|
||||
}
|
||||
|
||||
if err := d.checkEncryption(nid, vtep, n.vxlanID(s), false, true); err != nil {
|
||||
if err := d.checkEncryption(nid, vtep, false, true); err != nil {
|
||||
logrus.Warn(err)
|
||||
}
|
||||
|
||||
@@ -447,7 +447,7 @@ func (d *driver) peerDeleteOp(nid, eid string, peerIP net.IP, peerIPMask net.IPM
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := d.checkEncryption(nid, vtep, 0, localPeer, false); err != nil {
|
||||
if err := d.checkEncryption(nid, vtep, localPeer, false); err != nil {
|
||||
logrus.Warn(err)
|
||||
}
|
||||
|
||||
|
||||
@@ -681,8 +681,8 @@ func (d *driver) CreateEndpoint(nid, eid string, ifInfo driverapi.InterfaceInfo,
|
||||
}
|
||||
|
||||
if n.driver.name == "nat" && !epOption.DisableDNS {
|
||||
logrus.Debugf("endpointStruct.EnableInternalDNS =[%v]", endpointStruct.EnableInternalDNS)
|
||||
endpointStruct.EnableInternalDNS = true
|
||||
logrus.Debugf("endpointStruct.EnableInternalDNS =[%v]", endpointStruct.EnableInternalDNS)
|
||||
}
|
||||
|
||||
endpointStruct.DisableICC = epOption.DisableICC
|
||||
|
||||
@@ -1061,9 +1061,6 @@ func (n *network) delete(force bool, rmLBEndpoint bool) error {
|
||||
}
|
||||
|
||||
n.ipamRelease()
|
||||
if err = c.updateToStore(n); err != nil {
|
||||
logrus.Warnf("Failed to update store after ipam release for network %s (%s): %v", n.Name(), n.ID(), err)
|
||||
}
|
||||
|
||||
// We are about to delete the network. Leave the gossip
|
||||
// cluster for the network to stop all incoming network
|
||||
|
||||
18
vendor.mod
18
vendor.mod
@@ -12,14 +12,14 @@ require (
|
||||
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1
|
||||
github.com/Graylog2/go-gelf v0.0.0-20191017102106-1550ee647df0
|
||||
github.com/Microsoft/go-winio v0.5.2
|
||||
github.com/Microsoft/hcsshim v0.9.7
|
||||
github.com/Microsoft/hcsshim v0.9.8
|
||||
github.com/RackSec/srslog v0.0.0-20180709174129-a4725f04ec91
|
||||
github.com/armon/go-radix v1.0.1-0.20221118154546-54df44f2176c
|
||||
github.com/aws/aws-sdk-go v1.37.0
|
||||
github.com/bsphere/le_go v0.0.0-20200109081728-fc06dab2caa8
|
||||
github.com/cloudflare/cfssl v0.0.0-20180323000720-5d63dbd981b5
|
||||
github.com/containerd/cgroups v1.0.4
|
||||
github.com/containerd/containerd v1.6.19
|
||||
github.com/containerd/containerd v1.6.21
|
||||
github.com/containerd/continuity v0.3.0
|
||||
github.com/containerd/fifo v1.1.0
|
||||
github.com/containerd/typeurl v1.0.2
|
||||
@@ -42,19 +42,20 @@ require (
|
||||
github.com/gorilla/mux v1.8.0
|
||||
github.com/hashicorp/go-immutable-radix v1.3.1
|
||||
github.com/hashicorp/go-memdb v1.3.2
|
||||
github.com/hashicorp/go-multierror v1.1.1
|
||||
github.com/hashicorp/memberlist v0.4.0
|
||||
github.com/hashicorp/serf v0.8.5
|
||||
github.com/imdario/mergo v0.3.12
|
||||
github.com/ishidawataru/sctp v0.0.0-20210707070123-9a39160e9062
|
||||
github.com/ishidawataru/sctp v0.0.0-20230406120618-7ff4192f6ff2
|
||||
github.com/klauspost/compress v1.15.12
|
||||
github.com/miekg/dns v1.1.43
|
||||
github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible
|
||||
github.com/moby/buildkit v0.10.7-0.20230306143919-70f2ad56d3e5
|
||||
github.com/moby/buildkit v0.10.7-0.20230412161310-d52b2d584242
|
||||
github.com/moby/ipvs v1.1.0
|
||||
github.com/moby/locker v1.0.1
|
||||
github.com/moby/patternmatcher v0.5.0
|
||||
github.com/moby/pubsub v1.0.0
|
||||
github.com/moby/swarmkit/v2 v2.0.0-20230309194213-a745a8755ce3
|
||||
github.com/moby/swarmkit/v2 v2.0.0-20230315203717-e28e8ba9bc83
|
||||
github.com/moby/sys/mount v0.3.3
|
||||
github.com/moby/sys/mountinfo v0.6.2
|
||||
github.com/moby/sys/sequential v0.5.0
|
||||
@@ -63,8 +64,8 @@ require (
|
||||
github.com/moby/term v0.0.0-20221120202655-abb19827d345
|
||||
github.com/morikuni/aec v1.0.0
|
||||
github.com/opencontainers/go-digest v1.0.0
|
||||
github.com/opencontainers/image-spec v1.0.3-0.20220303224323-02efb9a75ee1
|
||||
github.com/opencontainers/runc v1.1.3
|
||||
github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b
|
||||
github.com/opencontainers/runc v1.1.5
|
||||
github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417
|
||||
github.com/opencontainers/selinux v1.10.2
|
||||
github.com/pelletier/go-toml v1.9.5
|
||||
@@ -104,7 +105,7 @@ require (
|
||||
github.com/containerd/console v1.0.3 // indirect
|
||||
github.com/containerd/go-runc v1.0.0 // indirect
|
||||
github.com/containerd/stargz-snapshotter/estargz v0.11.3 // indirect
|
||||
github.com/containerd/ttrpc v1.1.0 // indirect
|
||||
github.com/containerd/ttrpc v1.1.1 // indirect
|
||||
github.com/cyphar/filepath-securejoin v0.2.3 // indirect
|
||||
github.com/dustin/go-humanize v1.0.0 // indirect
|
||||
github.com/felixge/httpsnoop v1.0.2 // indirect
|
||||
@@ -125,7 +126,6 @@ require (
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-msgpack v0.5.5 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
|
||||
github.com/hashicorp/golang-lru v0.5.4 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.0.1 // indirect
|
||||
|
||||
33
vendor.sum
33
vendor.sum
@@ -100,8 +100,8 @@ github.com/Microsoft/hcsshim v0.8.14/go.mod h1:NtVKoYxQuTLx6gEq0L96c9Ju4JbRJ4nY2
|
||||
github.com/Microsoft/hcsshim v0.8.15/go.mod h1:x38A4YbHbdxJtc0sF6oIz+RG0npwSCAvn69iY6URG00=
|
||||
github.com/Microsoft/hcsshim v0.8.16/go.mod h1:o5/SZqmR7x9JNKsW3pu+nqHm0MF8vbA+VxGOoXdC600=
|
||||
github.com/Microsoft/hcsshim v0.8.21/go.mod h1:+w2gRZ5ReXQhFOrvSQeNfhrYB/dg3oDwTOcER2fw4I4=
|
||||
github.com/Microsoft/hcsshim v0.9.7 h1:mKNHW/Xvv1aFH87Jb6ERDzXTJTLPlmzfZ28VBFD/bfg=
|
||||
github.com/Microsoft/hcsshim v0.9.7/go.mod h1:7pLA8lDk46WKDWlVsENo92gC0XFa8rbKfyFRBqxEbCc=
|
||||
github.com/Microsoft/hcsshim v0.9.8 h1:lf7xxK2+Ikbj9sVf2QZsouGjRjEp2STj1yDHgoVtU5k=
|
||||
github.com/Microsoft/hcsshim v0.9.8/go.mod h1:7pLA8lDk46WKDWlVsENo92gC0XFa8rbKfyFRBqxEbCc=
|
||||
github.com/Microsoft/hcsshim/test v0.0.0-20201218223536-d3e5debf77da/go.mod h1:5hlzMzRKMLyo42nCZ9oml8AdTlq/0cvIaBv6tK1RehU=
|
||||
github.com/Microsoft/hcsshim/test v0.0.0-20210227013316-43a75bb4edd3/go.mod h1:mw7qgWloBUl75W/gVH3cQszUg1+gUITj7D6NY7ywVnY=
|
||||
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
|
||||
@@ -243,8 +243,8 @@ github.com/containerd/containerd v1.5.0-beta.4/go.mod h1:GmdgZd2zA2GYIBZ0w09Zvgq
|
||||
github.com/containerd/containerd v1.5.0-rc.0/go.mod h1:V/IXoMqNGgBlabz3tHD2TWDoTJseu1FGOKuoA4nNb2s=
|
||||
github.com/containerd/containerd v1.5.1/go.mod h1:0DOxVqwDy2iZvrZp2JUx/E+hS0UNTVn7dJnIOwtYR4g=
|
||||
github.com/containerd/containerd v1.5.7/go.mod h1:gyvv6+ugqY25TiXxcZC3L5yOeYgEw0QMhscqVp1AR9c=
|
||||
github.com/containerd/containerd v1.6.19 h1:F0qgQPrG0P2JPgwpxWxYavrVeXAG0ezUIB9Z/4FTUAU=
|
||||
github.com/containerd/containerd v1.6.19/go.mod h1:HZCDMn4v/Xl2579/MvtOC2M206i+JJ6VxFWU/NetrGY=
|
||||
github.com/containerd/containerd v1.6.21 h1:eSTAmnvDKRPWan+MpSSfNyrtleXd86ogK9X8fMWpe/Q=
|
||||
github.com/containerd/containerd v1.6.21/go.mod h1:apei1/i5Ux2FzrK6+DM/suEsGuK/MeVOfy8tR2q7Wnw=
|
||||
github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y=
|
||||
github.com/containerd/continuity v0.0.0-20190815185530-f2a389ac0a02/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y=
|
||||
github.com/containerd/continuity v0.0.0-20191127005431-f65d91d395eb/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y=
|
||||
@@ -285,8 +285,9 @@ github.com/containerd/ttrpc v0.0.0-20190828172938-92c8520ef9f8/go.mod h1:PvCDdDG
|
||||
github.com/containerd/ttrpc v0.0.0-20191028202541-4f1b8fe65a5c/go.mod h1:LPm1u0xBw8r8NOKoOdNMeVHSawSsltak+Ihv+etqsE8=
|
||||
github.com/containerd/ttrpc v1.0.1/go.mod h1:UAxOpgT9ziI0gJrmKvgcZivgxOp8iFPSk8httJEt98Y=
|
||||
github.com/containerd/ttrpc v1.0.2/go.mod h1:UAxOpgT9ziI0gJrmKvgcZivgxOp8iFPSk8httJEt98Y=
|
||||
github.com/containerd/ttrpc v1.1.0 h1:GbtyLRxb0gOLR0TYQWt3O6B0NvT8tMdorEHqIQo/lWI=
|
||||
github.com/containerd/ttrpc v1.1.0/go.mod h1:XX4ZTnoOId4HklF4edwc4DcqskFZuvXB1Evzy5KFQpQ=
|
||||
github.com/containerd/ttrpc v1.1.1 h1:NoRHS/z8UiHhpY1w0xcOqoJDGf2DHyzXrF0H4l5AE8c=
|
||||
github.com/containerd/ttrpc v1.1.1/go.mod h1:XX4ZTnoOId4HklF4edwc4DcqskFZuvXB1Evzy5KFQpQ=
|
||||
github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd/go.mod h1:Cm3kwCdlkCfMSHURc+r6fwoGH6/F1hH3S4sg0rLFWPc=
|
||||
github.com/containerd/typeurl v0.0.0-20190911142611-5eb25027c9fd/go.mod h1:GeKYzf2pQcqv7tJ0AoCuuhtnqhva5LNU3U+OyKxxJpk=
|
||||
github.com/containerd/typeurl v1.0.1/go.mod h1:TB1hUtrpaiO88KEK56ijojHS1+NeF0izUACaJW2mdXg=
|
||||
@@ -644,8 +645,8 @@ github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH
|
||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc=
|
||||
github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||
github.com/ishidawataru/sctp v0.0.0-20210707070123-9a39160e9062 h1:G1+wBT0dwjIrBdLy0MIG0i+E4CQxEnedHXdauJEIH6g=
|
||||
github.com/ishidawataru/sctp v0.0.0-20210707070123-9a39160e9062/go.mod h1:co9pwDoBCm1kGxawmb4sPq0cSIOOWNPT4KnHotMP1Zg=
|
||||
github.com/ishidawataru/sctp v0.0.0-20230406120618-7ff4192f6ff2 h1:i2fYnDurfLlJH8AyyMOnkLHnHeP8Ff/DDpuZA/D3bPo=
|
||||
github.com/ishidawataru/sctp v0.0.0-20230406120618-7ff4192f6ff2/go.mod h1:co9pwDoBCm1kGxawmb4sPq0cSIOOWNPT4KnHotMP1Zg=
|
||||
github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56/go.mod h1:ymszkNOg6tORTn+6F6j+Jc8TOr5osrynvN6ivFWZ2GA=
|
||||
github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
|
||||
github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
|
||||
@@ -728,8 +729,8 @@ github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0Qu
|
||||
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A=
|
||||
github.com/moby/buildkit v0.10.7-0.20230306143919-70f2ad56d3e5 h1:1CEKLCfx4WEWbP4A+cI61IR6pC5h6cAN+20CXsU7NRU=
|
||||
github.com/moby/buildkit v0.10.7-0.20230306143919-70f2ad56d3e5/go.mod h1:tQuuyTWtOb9D+RE425cwOCUkX0/oZ+5iBZ+uWpWQ9bU=
|
||||
github.com/moby/buildkit v0.10.7-0.20230412161310-d52b2d584242 h1:YEWromfSEDvSx13xK7jZwoNTNnYEgpguSpedsXpZ6PA=
|
||||
github.com/moby/buildkit v0.10.7-0.20230412161310-d52b2d584242/go.mod h1:tQuuyTWtOb9D+RE425cwOCUkX0/oZ+5iBZ+uWpWQ9bU=
|
||||
github.com/moby/ipvs v1.1.0 h1:ONN4pGaZQgAx+1Scz5RvWV4Q7Gb+mvfRh3NsPS+1XQQ=
|
||||
github.com/moby/ipvs v1.1.0/go.mod h1:4VJMWuf098bsUMmZEiD4Tjk/O7mOn3l1PTD3s4OoYAs=
|
||||
github.com/moby/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg=
|
||||
@@ -738,8 +739,8 @@ github.com/moby/patternmatcher v0.5.0 h1:YCZgJOeULcxLw1Q+sVR636pmS7sPEn1Qo2iAN6M
|
||||
github.com/moby/patternmatcher v0.5.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc=
|
||||
github.com/moby/pubsub v1.0.0 h1:jkp/imWsmJz2f6LyFsk7EkVeN2HxR/HTTOY8kHrsxfA=
|
||||
github.com/moby/pubsub v1.0.0/go.mod h1:bXSO+3h5MNXXCaEG+6/NlAIk7MMZbySZlnB+cUQhKKc=
|
||||
github.com/moby/swarmkit/v2 v2.0.0-20230309194213-a745a8755ce3 h1:05e6sB9az9OINsgqSy1PiSC9i0ffkpfQd0oJGAigo6k=
|
||||
github.com/moby/swarmkit/v2 v2.0.0-20230309194213-a745a8755ce3/go.mod h1:GvjR7mC8YuUd9Mq44lrrIZPaXyKPAGEUMBpAQzaj3dI=
|
||||
github.com/moby/swarmkit/v2 v2.0.0-20230315203717-e28e8ba9bc83 h1:jUbNDiRMDXd2rYoa4bcI+g3nIb4A1R8HNCe9wdCdh8I=
|
||||
github.com/moby/swarmkit/v2 v2.0.0-20230315203717-e28e8ba9bc83/go.mod h1:GvjR7mC8YuUd9Mq44lrrIZPaXyKPAGEUMBpAQzaj3dI=
|
||||
github.com/moby/sys/mount v0.3.3 h1:fX1SVkXFJ47XWDoeFW4Sq7PdQJnV2QIDZAqjNqgEjUs=
|
||||
github.com/moby/sys/mount v0.3.3/go.mod h1:PBaEorSNTLG5t/+4EgukEQVlAvVEc6ZjTySwKdqp5K0=
|
||||
github.com/moby/sys/mountinfo v0.4.0/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A=
|
||||
@@ -802,16 +803,16 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8
|
||||
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
|
||||
github.com/opencontainers/image-spec v1.0.0/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
|
||||
github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
|
||||
github.com/opencontainers/image-spec v1.0.3-0.20220303224323-02efb9a75ee1 h1:9iFHD5Kt9hkOfeawBNiEeEaV7bmC4/Z5wJp8E9BptMs=
|
||||
github.com/opencontainers/image-spec v1.0.3-0.20220303224323-02efb9a75ee1/go.mod h1:K/JAU0m27RFhDRX4PcFdIKntROP6y5Ed6O91aZYDQfs=
|
||||
github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b h1:YWuSjZCQAPM8UUBLkYUk1e+rZcvWHJmFb6i6rM44Xs8=
|
||||
github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b/go.mod h1:3OVijpioIKYWTqjiG0zfF6wvoJ4fAXGbjdZuI2NgsRQ=
|
||||
github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
|
||||
github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
|
||||
github.com/opencontainers/runc v1.0.0-rc8.0.20190926000215-3e425f80a8c9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
|
||||
github.com/opencontainers/runc v1.0.0-rc9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
|
||||
github.com/opencontainers/runc v1.0.0-rc93/go.mod h1:3NOsor4w32B2tC0Zbl8Knk4Wg84SM2ImC1fxBuqJ/H0=
|
||||
github.com/opencontainers/runc v1.0.2/go.mod h1:aTaHFFwQXuA71CiyxOdFFIorAoemI04suvGRQFzWTD0=
|
||||
github.com/opencontainers/runc v1.1.3 h1:vIXrkId+0/J2Ymu2m7VjGvbSlAId9XNRPhn2p4b+d8w=
|
||||
github.com/opencontainers/runc v1.1.3/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJHLXuG2PsnNg=
|
||||
github.com/opencontainers/runc v1.1.5 h1:L44KXEpKmfWDcS02aeGm8QNTFXTo2D+8MYGDIJ/GDEs=
|
||||
github.com/opencontainers/runc v1.1.5/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJHLXuG2PsnNg=
|
||||
github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
|
||||
github.com/opencontainers/runtime-spec v1.0.1/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
|
||||
github.com/opencontainers/runtime-spec v1.0.2-0.20190207185410-29686dbc5559/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
|
||||
@@ -899,7 +900,6 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L
|
||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/rootless-containers/rootlesskit v1.1.0 h1:cRaRIYxY8oce4eE/zeAUZhgKu/4tU1p9YHN4+suwV7M=
|
||||
github.com/rootless-containers/rootlesskit v1.1.0/go.mod h1:H+o9ndNe7tS91WqU0/+vpvc+VaCd7TCIWaJjnV0ujUo=
|
||||
github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY=
|
||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||
@@ -1001,7 +1001,6 @@ github.com/willf/bitset v1.1.11/go.mod h1:83CECat5yLh5zVOf4P1ErAgKA5UDvKtgyUABdr
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
|
||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
|
||||
github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs=
|
||||
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
|
||||
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
|
||||
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
|
||||
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
|
||||
42
vendor/github.com/containerd/containerd/.golangci.yml
generated
vendored
42
vendor/github.com/containerd/containerd/.golangci.yml
generated
vendored
@@ -1,27 +1,55 @@
|
||||
linters:
|
||||
enable:
|
||||
- structcheck
|
||||
- varcheck
|
||||
- staticcheck
|
||||
- unconvert
|
||||
- exportloopref # Checks for pointers to enclosing loop variables
|
||||
- gofmt
|
||||
- goimports
|
||||
- revive
|
||||
- gosec
|
||||
- ineffassign
|
||||
- vet
|
||||
- unused
|
||||
- misspell
|
||||
- nolintlint
|
||||
- revive
|
||||
- staticcheck
|
||||
- tenv # Detects using os.Setenv instead of t.Setenv since Go 1.17
|
||||
- unconvert
|
||||
- unused
|
||||
- vet
|
||||
- dupword # Checks for duplicate words in the source code
|
||||
disable:
|
||||
- errcheck
|
||||
|
||||
issues:
|
||||
include:
|
||||
- EXC0002
|
||||
max-issues-per-linter: 0
|
||||
max-same-issues: 0
|
||||
|
||||
# Only using / doesn't work due to https://github.com/golangci/golangci-lint/issues/1398.
|
||||
exclude-rules:
|
||||
- path: 'archive[\\/]tarheader[\\/]'
|
||||
# conversion is necessary on Linux, unnecessary on macOS
|
||||
text: "unnecessary conversion"
|
||||
|
||||
linters-settings:
|
||||
gosec:
|
||||
# The following issues surfaced when `gosec` linter
|
||||
# was enabled. They are temporarily excluded to unblock
|
||||
# the existing workflow, but still to be addressed by
|
||||
# future works.
|
||||
excludes:
|
||||
- G204
|
||||
- G305
|
||||
- G306
|
||||
- G402
|
||||
- G404
|
||||
|
||||
run:
|
||||
timeout: 8m
|
||||
skip-dirs:
|
||||
- api
|
||||
- cluster
|
||||
- design
|
||||
- docs
|
||||
- docs/man
|
||||
- releases
|
||||
- reports
|
||||
- test # e2e scripts
|
||||
|
||||
2
vendor/github.com/containerd/containerd/Vagrantfile
generated
vendored
2
vendor/github.com/containerd/containerd/Vagrantfile
generated
vendored
@@ -93,7 +93,7 @@ EOF
|
||||
config.vm.provision "install-golang", type: "shell", run: "once" do |sh|
|
||||
sh.upload_path = "/tmp/vagrant-install-golang"
|
||||
sh.env = {
|
||||
'GO_VERSION': ENV['GO_VERSION'] || "1.19.6",
|
||||
'GO_VERSION': ENV['GO_VERSION'] || "1.19.9",
|
||||
}
|
||||
sh.inline = <<~SHELL
|
||||
#!/usr/bin/env bash
|
||||
|
||||
2
vendor/github.com/containerd/containerd/api/services/containers/v1/containers.pb.go
generated
vendored
2
vendor/github.com/containerd/containerd/api/services/containers/v1/containers.pb.go
generated
vendored
@@ -246,7 +246,7 @@ type ListContainersRequest struct {
|
||||
// filters. Expanded, containers that match the following will be
|
||||
// returned:
|
||||
//
|
||||
// filters[0] or filters[1] or ... or filters[n-1] or filters[n]
|
||||
// filters[0] or filters[1] or ... or filters[n-1] or filters[n]
|
||||
//
|
||||
// If filters is zero-length or nil, all items will be returned.
|
||||
Filters []string `protobuf:"bytes,1,rep,name=filters,proto3" json:"filters,omitempty"`
|
||||
|
||||
2
vendor/github.com/containerd/containerd/api/services/containers/v1/containers.proto
generated
vendored
2
vendor/github.com/containerd/containerd/api/services/containers/v1/containers.proto
generated
vendored
@@ -132,7 +132,7 @@ message ListContainersRequest {
|
||||
// filters. Expanded, containers that match the following will be
|
||||
// returned:
|
||||
//
|
||||
// filters[0] or filters[1] or ... or filters[n-1] or filters[n]
|
||||
// filters[0] or filters[1] or ... or filters[n-1] or filters[n]
|
||||
//
|
||||
// If filters is zero-length or nil, all items will be returned.
|
||||
repeated string filters = 1;
|
||||
|
||||
2
vendor/github.com/containerd/containerd/api/services/content/v1/content.proto
generated
vendored
2
vendor/github.com/containerd/containerd/api/services/content/v1/content.proto
generated
vendored
@@ -141,7 +141,7 @@ message ListContentRequest {
|
||||
// filters. Expanded, containers that match the following will be
|
||||
// returned:
|
||||
//
|
||||
// filters[0] or filters[1] or ... or filters[n-1] or filters[n]
|
||||
// filters[0] or filters[1] or ... or filters[n-1] or filters[n]
|
||||
//
|
||||
// If filters is zero-length or nil, all items will be returned.
|
||||
repeated string filters = 1;
|
||||
|
||||
2
vendor/github.com/containerd/containerd/api/services/images/v1/images.pb.go
generated
vendored
2
vendor/github.com/containerd/containerd/api/services/images/v1/images.pb.go
generated
vendored
@@ -336,7 +336,7 @@ type ListImagesRequest struct {
|
||||
// filters. Expanded, images that match the following will be
|
||||
// returned:
|
||||
//
|
||||
// filters[0] or filters[1] or ... or filters[n-1] or filters[n]
|
||||
// filters[0] or filters[1] or ... or filters[n-1] or filters[n]
|
||||
//
|
||||
// If filters is zero-length or nil, all items will be returned.
|
||||
Filters []string `protobuf:"bytes,1,rep,name=filters,proto3" json:"filters,omitempty"`
|
||||
|
||||
2
vendor/github.com/containerd/containerd/api/services/images/v1/images.proto
generated
vendored
2
vendor/github.com/containerd/containerd/api/services/images/v1/images.proto
generated
vendored
@@ -119,7 +119,7 @@ message ListImagesRequest {
|
||||
// filters. Expanded, images that match the following will be
|
||||
// returned:
|
||||
//
|
||||
// filters[0] or filters[1] or ... or filters[n-1] or filters[n]
|
||||
// filters[0] or filters[1] or ... or filters[n-1] or filters[n]
|
||||
//
|
||||
// If filters is zero-length or nil, all items will be returned.
|
||||
repeated string filters = 1;
|
||||
|
||||
@@ -115,7 +115,7 @@ type PluginsRequest struct {
|
||||
// filters. Expanded, plugins that match the following will be
|
||||
// returned:
|
||||
//
|
||||
// filters[0] or filters[1] or ... or filters[n-1] or filters[n]
|
||||
// filters[0] or filters[1] or ... or filters[n-1] or filters[n]
|
||||
//
|
||||
// If filters is zero-length or nil, all items will be returned.
|
||||
Filters []string `protobuf:"bytes,1,rep,name=filters,proto3" json:"filters,omitempty"`
|
||||
|
||||
@@ -89,7 +89,7 @@ message PluginsRequest {
|
||||
// filters. Expanded, plugins that match the following will be
|
||||
// returned:
|
||||
//
|
||||
// filters[0] or filters[1] or ... or filters[n-1] or filters[n]
|
||||
// filters[0] or filters[1] or ... or filters[n-1] or filters[n]
|
||||
//
|
||||
// If filters is zero-length or nil, all items will be returned.
|
||||
repeated string filters = 1;
|
||||
|
||||
2
vendor/github.com/containerd/containerd/api/services/snapshots/v1/snapshots.pb.go
generated
vendored
2
vendor/github.com/containerd/containerd/api/services/snapshots/v1/snapshots.pb.go
generated
vendored
@@ -620,7 +620,7 @@ type ListSnapshotsRequest struct {
|
||||
// filters. Expanded, images that match the following will be
|
||||
// returned:
|
||||
//
|
||||
// filters[0] or filters[1] or ... or filters[n-1] or filters[n]
|
||||
// filters[0] or filters[1] or ... or filters[n-1] or filters[n]
|
||||
//
|
||||
// If filters is zero-length or nil, all items will be returned.
|
||||
Filters []string `protobuf:"bytes,2,rep,name=filters,proto3" json:"filters,omitempty"`
|
||||
|
||||
2
vendor/github.com/containerd/containerd/api/services/snapshots/v1/snapshots.proto
generated
vendored
2
vendor/github.com/containerd/containerd/api/services/snapshots/v1/snapshots.proto
generated
vendored
@@ -158,7 +158,7 @@ message ListSnapshotsRequest{
|
||||
// filters. Expanded, images that match the following will be
|
||||
// returned:
|
||||
//
|
||||
// filters[0] or filters[1] or ... or filters[n-1] or filters[n]
|
||||
// filters[0] or filters[1] or ... or filters[n-1] or filters[n]
|
||||
//
|
||||
// If filters is zero-length or nil, all items will be returned.
|
||||
repeated string filters = 2;
|
||||
|
||||
4
vendor/github.com/containerd/containerd/archive/tar.go
generated
vendored
4
vendor/github.com/containerd/containerd/archive/tar.go
generated
vendored
@@ -30,6 +30,7 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/containerd/containerd/archive/tarheader"
|
||||
"github.com/containerd/containerd/log"
|
||||
"github.com/containerd/containerd/pkg/userns"
|
||||
"github.com/containerd/continuity/fs"
|
||||
@@ -554,7 +555,8 @@ func (cw *ChangeWriter) HandleChange(k fs.ChangeKind, p string, f os.FileInfo, e
|
||||
}
|
||||
}
|
||||
|
||||
hdr, err := tar.FileInfoHeader(f, link)
|
||||
// Use FileInfoHeaderNoLookups to avoid propagating user names and group names from the host
|
||||
hdr, err := tarheader.FileInfoHeaderNoLookups(f, link)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
3
vendor/github.com/containerd/containerd/archive/tar_unix.go
generated
vendored
3
vendor/github.com/containerd/containerd/archive/tar_unix.go
generated
vendored
@@ -62,8 +62,7 @@ func setHeaderForSpecialDevice(hdr *tar.Header, name string, fi os.FileInfo) err
|
||||
return errors.New("unsupported stat type")
|
||||
}
|
||||
|
||||
// Rdev is int32 on darwin/bsd, int64 on linux/solaris
|
||||
rdev := uint64(s.Rdev) //nolint:unconvert
|
||||
rdev := uint64(s.Rdev) //nolint:nolintlint,unconvert // rdev is int32 on darwin/bsd, int64 on linux/solaris
|
||||
|
||||
// Currently go does not fill in the major/minors
|
||||
if s.Mode&syscall.S_IFBLK != 0 ||
|
||||
|
||||
82
vendor/github.com/containerd/containerd/archive/tarheader/tarheader.go
generated
vendored
Normal file
82
vendor/github.com/containerd/containerd/archive/tarheader/tarheader.go
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
/*
|
||||
Portions from https://github.com/moby/moby/blob/v23.0.1/pkg/archive/archive.go#L419-L464
|
||||
Copyright (C) Docker/Moby authors.
|
||||
Licensed under the Apache License, Version 2.0
|
||||
NOTICE: https://github.com/moby/moby/blob/v23.0.1/NOTICE
|
||||
*/
|
||||
|
||||
package tarheader
|
||||
|
||||
import (
|
||||
"archive/tar"
|
||||
"os"
|
||||
)
|
||||
|
||||
// nosysFileInfo hides the system-dependent info of the wrapped FileInfo to
|
||||
// prevent tar.FileInfoHeader from introspecting it and potentially calling into
|
||||
// glibc.
|
||||
//
|
||||
// From https://github.com/moby/moby/blob/v23.0.1/pkg/archive/archive.go#L419-L434 .
|
||||
type nosysFileInfo struct {
|
||||
os.FileInfo
|
||||
}
|
||||
|
||||
func (fi nosysFileInfo) Sys() interface{} {
|
||||
// A Sys value of type *tar.Header is safe as it is system-independent.
|
||||
// The tar.FileInfoHeader function copies the fields into the returned
|
||||
// header without performing any OS lookups.
|
||||
if sys, ok := fi.FileInfo.Sys().(*tar.Header); ok {
|
||||
return sys
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// sysStat, if non-nil, populates hdr from system-dependent fields of fi.
|
||||
//
|
||||
// From https://github.com/moby/moby/blob/v23.0.1/pkg/archive/archive.go#L436-L437 .
|
||||
var sysStat func(fi os.FileInfo, hdr *tar.Header) error
|
||||
|
||||
// FileInfoHeaderNoLookups creates a partially-populated tar.Header from fi.
|
||||
//
|
||||
// Compared to the archive/tar.FileInfoHeader function, this function is safe to
|
||||
// call from a chrooted process as it does not populate fields which would
|
||||
// require operating system lookups. It behaves identically to
|
||||
// tar.FileInfoHeader when fi is a FileInfo value returned from
|
||||
// tar.Header.FileInfo().
|
||||
//
|
||||
// When fi is a FileInfo for a native file, such as returned from os.Stat() and
|
||||
// os.Lstat(), the returned Header value differs from one returned from
|
||||
// tar.FileInfoHeader in the following ways. The Uname and Gname fields are not
|
||||
// set as OS lookups would be required to populate them. The AccessTime and
|
||||
// ChangeTime fields are not currently set (not yet implemented) although that
|
||||
// is subject to change. Callers which require the AccessTime or ChangeTime
|
||||
// fields to be zeroed should explicitly zero them out in the returned Header
|
||||
// value to avoid any compatibility issues in the future.
|
||||
//
|
||||
// From https://github.com/moby/moby/blob/v23.0.1/pkg/archive/archive.go#L439-L464 .
|
||||
func FileInfoHeaderNoLookups(fi os.FileInfo, link string) (*tar.Header, error) {
|
||||
hdr, err := tar.FileInfoHeader(nosysFileInfo{fi}, link)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if sysStat != nil {
|
||||
return hdr, sysStat(fi, hdr)
|
||||
}
|
||||
return hdr, nil
|
||||
}
|
||||
59
vendor/github.com/containerd/containerd/archive/tarheader/tarheader_unix.go
generated
vendored
Normal file
59
vendor/github.com/containerd/containerd/archive/tarheader/tarheader_unix.go
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
//go:build !windows
|
||||
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
/*
|
||||
Portions from https://github.com/moby/moby/blob/v23.0.1/pkg/archive/archive_unix.go#L52-L70
|
||||
Copyright (C) Docker/Moby authors.
|
||||
Licensed under the Apache License, Version 2.0
|
||||
NOTICE: https://github.com/moby/moby/blob/v23.0.1/NOTICE
|
||||
*/
|
||||
|
||||
package tarheader
|
||||
|
||||
import (
|
||||
"archive/tar"
|
||||
"os"
|
||||
"syscall"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
func init() {
|
||||
sysStat = statUnix
|
||||
}
|
||||
|
||||
// statUnix populates hdr from system-dependent fields of fi without performing
|
||||
// any OS lookups.
|
||||
// From https://github.com/moby/moby/blob/v23.0.1/pkg/archive/archive_unix.go#L52-L70
|
||||
func statUnix(fi os.FileInfo, hdr *tar.Header) error {
|
||||
s, ok := fi.Sys().(*syscall.Stat_t)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
|
||||
hdr.Uid = int(s.Uid)
|
||||
hdr.Gid = int(s.Gid)
|
||||
|
||||
if s.Mode&unix.S_IFBLK != 0 ||
|
||||
s.Mode&unix.S_IFCHR != 0 {
|
||||
hdr.Devmajor = int64(unix.Major(uint64(s.Rdev)))
|
||||
hdr.Devminor = int64(unix.Minor(uint64(s.Rdev)))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
1
vendor/github.com/containerd/containerd/container.go
generated
vendored
1
vendor/github.com/containerd/containerd/container.go
generated
vendored
@@ -279,6 +279,7 @@ func (c *container) NewTask(ctx context.Context, ioCreate cio.Creator, opts ...N
|
||||
})
|
||||
}
|
||||
}
|
||||
request.RuntimePath = info.RuntimePath
|
||||
if info.Options != nil {
|
||||
any, err := typeurl.MarshalAny(info.Options)
|
||||
if err != nil {
|
||||
|
||||
1
vendor/github.com/containerd/containerd/containerstore.go
generated
vendored
1
vendor/github.com/containerd/containerd/containerstore.go
generated
vendored
@@ -189,6 +189,7 @@ func containersFromProto(containerspb []containersapi.Container) []containers.Co
|
||||
var containers []containers.Container
|
||||
|
||||
for _, container := range containerspb {
|
||||
container := container
|
||||
containers = append(containers, containerFromProto(&container))
|
||||
}
|
||||
|
||||
|
||||
3
vendor/github.com/containerd/containerd/content/local/store.go
generated
vendored
3
vendor/github.com/containerd/containerd/content/local/store.go
generated
vendored
@@ -34,7 +34,7 @@ import (
|
||||
"github.com/containerd/containerd/log"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
"github.com/opencontainers/go-digest"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
)
|
||||
|
||||
@@ -505,6 +505,7 @@ func (s *store) resumeStatus(ref string, total int64, digester digest.Digester)
|
||||
return status, fmt.Errorf("provided total differs from status: %v != %v", total, status.Total)
|
||||
}
|
||||
|
||||
//nolint:dupword
|
||||
// TODO(stevvooe): slow slow slow!!, send to goroutine or use resumable hashes
|
||||
fp, err := os.Open(data)
|
||||
if err != nil {
|
||||
|
||||
2
vendor/github.com/containerd/containerd/diff/walking/differ.go
generated
vendored
2
vendor/github.com/containerd/containerd/diff/walking/differ.go
generated
vendored
@@ -87,7 +87,7 @@ func (s *walkingDiff) Compare(ctx context.Context, lower, upper []mount.Mount, o
|
||||
|
||||
var ocidesc ocispec.Descriptor
|
||||
if err := mount.WithTempMount(ctx, lower, func(lowerRoot string) error {
|
||||
return mount.WithTempMount(ctx, upper, func(upperRoot string) error {
|
||||
return mount.WithReadonlyTempMount(ctx, upper, func(upperRoot string) error {
|
||||
var newReference bool
|
||||
if config.Reference == "" {
|
||||
newReference = true
|
||||
|
||||
1
vendor/github.com/containerd/containerd/image_store.go
generated
vendored
1
vendor/github.com/containerd/containerd/image_store.go
generated
vendored
@@ -129,6 +129,7 @@ func imagesFromProto(imagespb []imagesapi.Image) []images.Image {
|
||||
var images []images.Image
|
||||
|
||||
for _, image := range imagespb {
|
||||
image := image
|
||||
images = append(images, imageFromProto(&image))
|
||||
}
|
||||
|
||||
|
||||
40
vendor/github.com/containerd/containerd/images/archive/exporter.go
generated
vendored
40
vendor/github.com/containerd/containerd/images/archive/exporter.go
generated
vendored
@@ -176,7 +176,7 @@ func Export(ctx context.Context, store content.Provider, writer io.Writer, opts
|
||||
}
|
||||
|
||||
name := desc.Annotations[images.AnnotationImageName]
|
||||
if name != "" && !eo.skipDockerManifest {
|
||||
if name != "" {
|
||||
mt.names = append(mt.names, name)
|
||||
}
|
||||
case images.MediaTypeDockerSchema2ManifestList, ocispec.MediaTypeImageIndex:
|
||||
@@ -215,26 +215,24 @@ func Export(ctx context.Context, store content.Provider, writer io.Writer, opts
|
||||
records = append(records, r...)
|
||||
}
|
||||
|
||||
if !eo.skipDockerManifest {
|
||||
if len(manifests) >= 1 {
|
||||
if len(manifests) > 1 {
|
||||
sort.SliceStable(manifests, func(i, j int) bool {
|
||||
if manifests[i].Platform == nil {
|
||||
return false
|
||||
}
|
||||
if manifests[j].Platform == nil {
|
||||
return true
|
||||
}
|
||||
return eo.platform.Less(*manifests[i].Platform, *manifests[j].Platform)
|
||||
})
|
||||
}
|
||||
d = manifests[0].Digest
|
||||
dManifests[d] = &exportManifest{
|
||||
manifest: manifests[0],
|
||||
}
|
||||
} else if eo.platform != nil {
|
||||
return fmt.Errorf("no manifest found for platform: %w", errdefs.ErrNotFound)
|
||||
if len(manifests) >= 1 {
|
||||
if len(manifests) > 1 {
|
||||
sort.SliceStable(manifests, func(i, j int) bool {
|
||||
if manifests[i].Platform == nil {
|
||||
return false
|
||||
}
|
||||
if manifests[j].Platform == nil {
|
||||
return true
|
||||
}
|
||||
return eo.platform.Less(*manifests[i].Platform, *manifests[j].Platform)
|
||||
})
|
||||
}
|
||||
d = manifests[0].Digest
|
||||
dManifests[d] = &exportManifest{
|
||||
manifest: manifests[0],
|
||||
}
|
||||
} else if eo.platform != nil {
|
||||
return fmt.Errorf("no manifest found for platform: %w", errdefs.ErrNotFound)
|
||||
}
|
||||
resolvedIndex[desc.Digest] = d
|
||||
}
|
||||
@@ -250,7 +248,7 @@ func Export(ctx context.Context, store content.Provider, writer io.Writer, opts
|
||||
}
|
||||
}
|
||||
|
||||
if len(dManifests) > 0 {
|
||||
if !eo.skipDockerManifest && len(dManifests) > 0 {
|
||||
tr, err := manifestsRecord(ctx, store, dManifests)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to create manifests file: %w", err)
|
||||
|
||||
2
vendor/github.com/containerd/containerd/images/converter/default.go
generated
vendored
2
vendor/github.com/containerd/containerd/images/converter/default.go
generated
vendored
@@ -132,7 +132,7 @@ func copyDesc(desc ocispec.Descriptor) *ocispec.Descriptor {
|
||||
return &descCopy
|
||||
}
|
||||
|
||||
// convertLayer converts image image layers if c.layerConvertFunc is set.
|
||||
// convertLayer converts image layers if c.layerConvertFunc is set.
|
||||
//
|
||||
// c.layerConvertFunc can be nil, e.g., for converting Docker media types to OCI ones.
|
||||
func (c *defaultConverter) convertLayer(ctx context.Context, cs content.Store, desc ocispec.Descriptor) (*ocispec.Descriptor, error) {
|
||||
|
||||
1
vendor/github.com/containerd/containerd/metadata/boltutil/helpers.go
generated
vendored
1
vendor/github.com/containerd/containerd/metadata/boltutil/helpers.go
generated
vendored
@@ -162,6 +162,7 @@ func WriteExtensions(bkt *bolt.Bucket, extensions map[string]types.Any) error {
|
||||
}
|
||||
|
||||
for name, ext := range extensions {
|
||||
ext := ext
|
||||
p, err := proto.Marshal(&ext)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
47
vendor/github.com/containerd/containerd/mount/mount.go
generated
vendored
47
vendor/github.com/containerd/containerd/mount/mount.go
generated
vendored
@@ -16,6 +16,10 @@
|
||||
|
||||
package mount
|
||||
|
||||
import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Mount is the lingua franca of containerd. A mount represents a
|
||||
// serialized mount syscall. Components either emit or consume mounts.
|
||||
type Mount struct {
|
||||
@@ -38,3 +42,46 @@ func All(mounts []Mount, target string) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// readonlyMounts modifies the received mount options
|
||||
// to make them readonly
|
||||
func readonlyMounts(mounts []Mount) []Mount {
|
||||
for i, m := range mounts {
|
||||
if m.Type == "overlay" {
|
||||
mounts[i].Options = readonlyOverlay(m.Options)
|
||||
continue
|
||||
}
|
||||
opts := make([]string, 0, len(m.Options))
|
||||
for _, opt := range m.Options {
|
||||
if opt != "rw" && opt != "ro" { // skip `ro` too so we don't append it twice
|
||||
opts = append(opts, opt)
|
||||
}
|
||||
}
|
||||
opts = append(opts, "ro")
|
||||
mounts[i].Options = opts
|
||||
}
|
||||
return mounts
|
||||
}
|
||||
|
||||
// readonlyOverlay takes mount options for overlay mounts and makes them readonly by
|
||||
// removing workdir and upperdir (and appending the upperdir layer to lowerdir) - see:
|
||||
// https://www.kernel.org/doc/html/latest/filesystems/overlayfs.html#multiple-lower-layers
|
||||
func readonlyOverlay(opt []string) []string {
|
||||
out := make([]string, 0, len(opt))
|
||||
upper := ""
|
||||
for _, o := range opt {
|
||||
if strings.HasPrefix(o, "upperdir=") {
|
||||
upper = strings.TrimPrefix(o, "upperdir=")
|
||||
} else if !strings.HasPrefix(o, "workdir=") {
|
||||
out = append(out, o)
|
||||
}
|
||||
}
|
||||
if upper != "" {
|
||||
for i, o := range out {
|
||||
if strings.HasPrefix(o, "lowerdir=") {
|
||||
out[i] = "lowerdir=" + upper + ":" + strings.TrimPrefix(o, "lowerdir=")
|
||||
}
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
7
vendor/github.com/containerd/containerd/mount/temp.go
generated
vendored
7
vendor/github.com/containerd/containerd/mount/temp.go
generated
vendored
@@ -67,6 +67,13 @@ func WithTempMount(ctx context.Context, mounts []Mount, f func(root string) erro
|
||||
return nil
|
||||
}
|
||||
|
||||
// WithReadonlyTempMount mounts the provided mounts to a temp dir as readonly,
|
||||
// and pass the temp dir to f. The mounts are valid during the call to the f.
|
||||
// Finally we will unmount and remove the temp dir regardless of the result of f.
|
||||
func WithReadonlyTempMount(ctx context.Context, mounts []Mount, f func(root string) error) (err error) {
|
||||
return WithTempMount(ctx, readonlyMounts(mounts), f)
|
||||
}
|
||||
|
||||
func getTempDir() string {
|
||||
if xdg := os.Getenv("XDG_RUNTIME_DIR"); xdg != "" {
|
||||
return xdg
|
||||
|
||||
113
vendor/github.com/containerd/containerd/oci/spec_opts.go
generated
vendored
113
vendor/github.com/containerd/containerd/oci/spec_opts.go
generated
vendored
@@ -76,7 +76,6 @@ func setLinux(s *Spec) {
|
||||
}
|
||||
}
|
||||
|
||||
// nolint
|
||||
func setResources(s *Spec) {
|
||||
if s.Linux != nil {
|
||||
if s.Linux.Resources == nil {
|
||||
@@ -90,7 +89,7 @@ func setResources(s *Spec) {
|
||||
}
|
||||
}
|
||||
|
||||
// nolint
|
||||
//nolint:nolintlint,unused // not used on all platforms
|
||||
func setCPU(s *Spec) {
|
||||
setResources(s)
|
||||
if s.Linux != nil {
|
||||
@@ -229,6 +228,7 @@ func WithProcessArgs(args ...string) SpecOpts {
|
||||
return func(_ context.Context, _ Client, _ *containers.Container, s *Spec) error {
|
||||
setProcess(s)
|
||||
s.Process.Args = args
|
||||
s.Process.CommandLine = ""
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -358,17 +358,19 @@ func WithImageConfigArgs(image Image, args []string) SpecOpts {
|
||||
return err
|
||||
}
|
||||
var (
|
||||
ociimage v1.Image
|
||||
config v1.ImageConfig
|
||||
imageConfigBytes []byte
|
||||
ociimage v1.Image
|
||||
config v1.ImageConfig
|
||||
)
|
||||
switch ic.MediaType {
|
||||
case v1.MediaTypeImageConfig, images.MediaTypeDockerSchema2Config:
|
||||
p, err := content.ReadBlob(ctx, image.ContentStore(), ic)
|
||||
var err error
|
||||
imageConfigBytes, err = content.ReadBlob(ctx, image.ContentStore(), ic)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := json.Unmarshal(p, &ociimage); err != nil {
|
||||
if err := json.Unmarshal(imageConfigBytes, &ociimage); err != nil {
|
||||
return err
|
||||
}
|
||||
config = ociimage.Config
|
||||
@@ -405,11 +407,55 @@ func WithImageConfigArgs(image Image, args []string) SpecOpts {
|
||||
return WithAdditionalGIDs("root")(ctx, client, c, s)
|
||||
} else if s.Windows != nil {
|
||||
s.Process.Env = replaceOrAppendEnvValues(config.Env, s.Process.Env)
|
||||
|
||||
// To support Docker ArgsEscaped on Windows we need to combine the
|
||||
// image Entrypoint & (Cmd Or User Args) while taking into account
|
||||
// if Docker has already escaped them in the image config. When
|
||||
// Docker sets `ArgsEscaped==true` in the config it has pre-escaped
|
||||
// either Entrypoint or Cmd or both. Cmd should always be treated as
|
||||
// arguments appended to Entrypoint unless:
|
||||
//
|
||||
// 1. Entrypoint does not exist, in which case Cmd[0] is the
|
||||
// executable.
|
||||
//
|
||||
// 2. The user overrides the Cmd with User Args when activating the
|
||||
// container in which case those args should be appended to the
|
||||
// Entrypoint if it exists.
|
||||
//
|
||||
// To effectively do this we need to know if the arguments came from
|
||||
// the user or if the arguments came from the image config when
|
||||
// ArgsEscaped==true. In this case we only want to escape the
|
||||
// additional user args when forming the complete CommandLine. This
|
||||
// is safe in both cases of Entrypoint or Cmd being set because
|
||||
// Docker will always escape them to an array of length one. Thus in
|
||||
// both cases it is the "executable" portion of the command.
|
||||
//
|
||||
// In the case ArgsEscaped==false, Entrypoint or Cmd will contain
|
||||
// any number of entries that are all unescaped and can simply be
|
||||
// combined (potentially overwriting Cmd with User Args if present)
|
||||
// and forwarded the container start as an Args array.
|
||||
cmd := config.Cmd
|
||||
cmdFromImage := true
|
||||
if len(args) > 0 {
|
||||
cmd = args
|
||||
cmdFromImage = false
|
||||
}
|
||||
|
||||
cmd = append(config.Entrypoint, cmd...)
|
||||
if len(cmd) == 0 {
|
||||
return errors.New("no arguments specified")
|
||||
}
|
||||
|
||||
if config.ArgsEscaped && (len(config.Entrypoint) > 0 || cmdFromImage) {
|
||||
s.Process.Args = nil
|
||||
s.Process.CommandLine = cmd[0]
|
||||
if len(cmd) > 1 {
|
||||
s.Process.CommandLine += " " + escapeAndCombineArgs(cmd[1:])
|
||||
}
|
||||
} else {
|
||||
s.Process.Args = cmd
|
||||
s.Process.CommandLine = ""
|
||||
}
|
||||
s.Process.Args = append(config.Entrypoint, cmd...)
|
||||
|
||||
s.Process.Cwd = config.WorkingDir
|
||||
s.Process.User = specs.User{
|
||||
@@ -617,8 +663,11 @@ func WithUser(userstr string) SpecOpts {
|
||||
return err
|
||||
}
|
||||
|
||||
mounts = tryReadonlyMounts(mounts)
|
||||
return mount.WithTempMount(ctx, mounts, f)
|
||||
// Use a read-only mount when trying to get user/group information
|
||||
// from the container's rootfs. Since the option does read operation
|
||||
// only, we append ReadOnly mount option to prevent the Linux kernel
|
||||
// from syncing whole filesystem in umount syscall.
|
||||
return mount.WithReadonlyTempMount(ctx, mounts, f)
|
||||
default:
|
||||
return fmt.Errorf("invalid USER value %s", userstr)
|
||||
}
|
||||
@@ -678,8 +727,11 @@ func WithUserID(uid uint32) SpecOpts {
|
||||
return err
|
||||
}
|
||||
|
||||
mounts = tryReadonlyMounts(mounts)
|
||||
return mount.WithTempMount(ctx, mounts, setUser)
|
||||
// Use a read-only mount when trying to get user/group information
|
||||
// from the container's rootfs. Since the option does read operation
|
||||
// only, we append ReadOnly mount option to prevent the Linux kernel
|
||||
// from syncing whole filesystem in umount syscall.
|
||||
return mount.WithReadonlyTempMount(ctx, mounts, setUser)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -723,8 +775,11 @@ func WithUsername(username string) SpecOpts {
|
||||
return err
|
||||
}
|
||||
|
||||
mounts = tryReadonlyMounts(mounts)
|
||||
return mount.WithTempMount(ctx, mounts, setUser)
|
||||
// Use a read-only mount when trying to get user/group information
|
||||
// from the container's rootfs. Since the option does read operation
|
||||
// only, we append ReadOnly mount option to prevent the Linux kernel
|
||||
// from syncing whole filesystem in umount syscall.
|
||||
return mount.WithReadonlyTempMount(ctx, mounts, setUser)
|
||||
} else if s.Windows != nil {
|
||||
s.Process.User.Username = username
|
||||
} else {
|
||||
@@ -802,8 +857,11 @@ func WithAdditionalGIDs(userstr string) SpecOpts {
|
||||
return err
|
||||
}
|
||||
|
||||
mounts = tryReadonlyMounts(mounts)
|
||||
return mount.WithTempMount(ctx, mounts, setAdditionalGids)
|
||||
// Use a read-only mount when trying to get user/group information
|
||||
// from the container's rootfs. Since the option does read operation
|
||||
// only, we append ReadOnly mount option to prevent the Linux kernel
|
||||
// from syncing whole filesystem in umount syscall.
|
||||
return mount.WithReadonlyTempMount(ctx, mounts, setAdditionalGids)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -864,8 +922,11 @@ func WithAppendAdditionalGroups(groups ...string) SpecOpts {
|
||||
return err
|
||||
}
|
||||
|
||||
mounts = tryReadonlyMounts(mounts)
|
||||
return mount.WithTempMount(ctx, mounts, setAdditionalGids)
|
||||
// Use a read-only mount when trying to get user/group information
|
||||
// from the container's rootfs. Since the option does read operation
|
||||
// only, we append ReadOnly mount option to prevent the Linux kernel
|
||||
// from syncing whole filesystem in umount syscall.
|
||||
return mount.WithReadonlyTempMount(ctx, mounts, setAdditionalGids)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1343,21 +1404,3 @@ func WithDevShmSize(kb int64) SpecOpts {
|
||||
return ErrNoShmMount
|
||||
}
|
||||
}
|
||||
|
||||
// tryReadonlyMounts is used by the options which are trying to get user/group
|
||||
// information from container's rootfs. Since the option does read operation
|
||||
// only, this helper will append ReadOnly mount option to prevent linux kernel
|
||||
// from syncing whole filesystem in umount syscall.
|
||||
//
|
||||
// TODO(fuweid):
|
||||
//
|
||||
// Currently, it only works for overlayfs. I think we can apply it to other
|
||||
// kinds of filesystem. Maybe we can return `ro` option by `snapshotter.Mount`
|
||||
// API, when the caller passes that experimental annotation
|
||||
// `containerd.io/snapshot/readonly.mount` something like that.
|
||||
func tryReadonlyMounts(mounts []mount.Mount) []mount.Mount {
|
||||
if len(mounts) == 1 && mounts[0].Type == "overlay" {
|
||||
mounts[0].Options = append(mounts[0].Options, "ro")
|
||||
}
|
||||
return mounts
|
||||
}
|
||||
|
||||
6
vendor/github.com/containerd/containerd/oci/spec_opts_linux.go
generated
vendored
6
vendor/github.com/containerd/containerd/oci/spec_opts_linux.go
generated
vendored
@@ -131,7 +131,7 @@ var WithAllCurrentCapabilities = func(ctx context.Context, client Client, c *con
|
||||
return WithCapabilities(caps)(ctx, client, c, s)
|
||||
}
|
||||
|
||||
// WithAllKnownCapabilities sets all the the known linux capabilities for the container process
|
||||
// WithAllKnownCapabilities sets all the known linux capabilities for the container process
|
||||
var WithAllKnownCapabilities = func(ctx context.Context, client Client, c *containers.Container, s *Spec) error {
|
||||
caps := cap.Known()
|
||||
return WithCapabilities(caps)(ctx, client, c, s)
|
||||
@@ -153,3 +153,7 @@ func WithRdt(closID, l3CacheSchema, memBwSchema string) SpecOpts {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func escapeAndCombineArgs(args []string) string {
|
||||
panic("not supported")
|
||||
}
|
||||
|
||||
8
vendor/github.com/containerd/containerd/oci/spec_opts_nonlinux.go
generated
vendored
8
vendor/github.com/containerd/containerd/oci/spec_opts_nonlinux.go
generated
vendored
@@ -28,22 +28,16 @@ import (
|
||||
|
||||
// WithAllCurrentCapabilities propagates the effective capabilities of the caller process to the container process.
|
||||
// The capability set may differ from WithAllKnownCapabilities when running in a container.
|
||||
//
|
||||
//nolint:deadcode,unused
|
||||
var WithAllCurrentCapabilities = func(ctx context.Context, client Client, c *containers.Container, s *Spec) error {
|
||||
return WithCapabilities(nil)(ctx, client, c, s)
|
||||
}
|
||||
|
||||
// WithAllKnownCapabilities sets all the the known linux capabilities for the container process
|
||||
//
|
||||
//nolint:deadcode,unused
|
||||
// WithAllKnownCapabilities sets all the known linux capabilities for the container process
|
||||
var WithAllKnownCapabilities = func(ctx context.Context, client Client, c *containers.Container, s *Spec) error {
|
||||
return WithCapabilities(nil)(ctx, client, c, s)
|
||||
}
|
||||
|
||||
// WithCPUShares sets the container's cpu shares
|
||||
//
|
||||
//nolint:deadcode,unused
|
||||
func WithCPUShares(shares uint64) SpecOpts {
|
||||
return func(ctx context.Context, _ Client, c *containers.Container, s *Spec) error {
|
||||
return nil
|
||||
|
||||
4
vendor/github.com/containerd/containerd/oci/spec_opts_unix.go
generated
vendored
4
vendor/github.com/containerd/containerd/oci/spec_opts_unix.go
generated
vendored
@@ -57,3 +57,7 @@ func WithCPUCFS(quota int64, period uint64) SpecOpts {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func escapeAndCombineArgs(args []string) string {
|
||||
panic("not supported")
|
||||
}
|
||||
|
||||
21
vendor/github.com/containerd/containerd/oci/spec_opts_windows.go
generated
vendored
21
vendor/github.com/containerd/containerd/oci/spec_opts_windows.go
generated
vendored
@@ -19,9 +19,12 @@ package oci
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
"github.com/containerd/containerd/containers"
|
||||
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
// WithWindowsCPUCount sets the `Windows.Resources.CPU.Count` section to the
|
||||
@@ -65,6 +68,16 @@ func WithWindowNetworksAllowUnqualifiedDNSQuery() SpecOpts {
|
||||
}
|
||||
}
|
||||
|
||||
// WithProcessCommandLine replaces the command line on the generated spec
|
||||
func WithProcessCommandLine(cmdLine string) SpecOpts {
|
||||
return func(_ context.Context, _ Client, _ *containers.Container, s *Spec) error {
|
||||
setProcess(s)
|
||||
s.Process.Args = nil
|
||||
s.Process.CommandLine = cmdLine
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// WithHostDevices adds all the hosts device nodes to the container's spec
|
||||
//
|
||||
// Not supported on windows
|
||||
@@ -89,3 +102,11 @@ func WithWindowsNetworkNamespace(ns string) SpecOpts {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func escapeAndCombineArgs(args []string) string {
|
||||
escaped := make([]string, len(args))
|
||||
for i, a := range args {
|
||||
escaped[i] = windows.EscapeArg(a)
|
||||
}
|
||||
return strings.Join(escaped, " ")
|
||||
}
|
||||
|
||||
4
vendor/github.com/containerd/containerd/oci/utils_unix.go
generated
vendored
4
vendor/github.com/containerd/containerd/oci/utils_unix.go
generated
vendored
@@ -127,7 +127,7 @@ func getDevices(path, containerPath string) ([]specs.LinuxDevice, error) {
|
||||
|
||||
// TODO consider adding these consts to the OCI runtime-spec.
|
||||
const (
|
||||
wildcardDevice = "a" //nolint // currently unused, but should be included when upstreaming to OCI runtime-spec.
|
||||
wildcardDevice = "a" //nolint:nolintlint,unused,varcheck // currently unused, but should be included when upstreaming to OCI runtime-spec.
|
||||
blockDevice = "b"
|
||||
charDevice = "c" // or "u"
|
||||
fifoDevice = "p"
|
||||
@@ -148,7 +148,7 @@ func DeviceFromPath(path string) (*specs.LinuxDevice, error) {
|
||||
}
|
||||
|
||||
var (
|
||||
devNumber = uint64(stat.Rdev) //nolint: unconvert // the type is 32bit on mips.
|
||||
devNumber = uint64(stat.Rdev) //nolint:nolintlint,unconvert // the type is 32bit on mips.
|
||||
major = unix.Major(devNumber)
|
||||
minor = unix.Minor(devNumber)
|
||||
)
|
||||
|
||||
2
vendor/github.com/containerd/containerd/reference/docker/reference.go
generated
vendored
2
vendor/github.com/containerd/containerd/reference/docker/reference.go
generated
vendored
@@ -683,7 +683,7 @@ func splitDockerDomain(name string) (domain, remainder string) {
|
||||
}
|
||||
|
||||
// familiarizeName returns a shortened version of the name familiar
|
||||
// to to the Docker UI. Familiar names have the default domain
|
||||
// to the Docker UI. Familiar names have the default domain
|
||||
// "docker.io" and "library/" repository prefix removed.
|
||||
// For example, "docker.io/library/redis" will have the familiar
|
||||
// name "redis" and "docker.io/dmcgowan/myapp" will be "dmcgowan/myapp".
|
||||
|
||||
18
vendor/github.com/containerd/containerd/runtime/v2/shim/shim.go
generated
vendored
18
vendor/github.com/containerd/containerd/runtime/v2/shim/shim.go
generated
vendored
@@ -52,6 +52,7 @@ type StartOpts struct {
|
||||
ContainerdBinary string
|
||||
Address string
|
||||
TTRPCAddress string
|
||||
Debug bool
|
||||
}
|
||||
|
||||
type StopStatus struct {
|
||||
@@ -175,7 +176,7 @@ func setLogger(ctx context.Context, id string) (context.Context, error) {
|
||||
l.Logger.SetLevel(logrus.DebugLevel)
|
||||
}
|
||||
f, err := openLog(ctx, id)
|
||||
if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return error
|
||||
if err != nil { //nolint:nolintlint,staticcheck // Ignore SA4023 as some platforms always return error
|
||||
return ctx, err
|
||||
}
|
||||
l.Logger.SetOutput(f)
|
||||
@@ -261,12 +262,12 @@ func run(ctx context.Context, manager Manager, initFunc Init, name string, confi
|
||||
setRuntime()
|
||||
|
||||
signals, err := setupSignals(config)
|
||||
if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return error
|
||||
if err != nil { //nolint:nolintlint,staticcheck // Ignore SA4023 as some platforms always return error
|
||||
return err
|
||||
}
|
||||
|
||||
if !config.NoSubreaper {
|
||||
if err := subreaper(); err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return error
|
||||
if err := subreaper(); err != nil { //nolint:nolintlint,staticcheck // Ignore SA4023 as some platforms always return error
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -333,6 +334,7 @@ func run(ctx context.Context, manager Manager, initFunc Init, name string, confi
|
||||
ContainerdBinary: containerdBinaryFlag,
|
||||
Address: addressFlag,
|
||||
TTRPCAddress: ttrpcAddress,
|
||||
Debug: debugFlag,
|
||||
}
|
||||
|
||||
address, err := manager.Start(ctx, id, opts)
|
||||
@@ -395,14 +397,14 @@ func run(ctx context.Context, manager Manager, initFunc Init, name string, confi
|
||||
initContext.TTRPCAddress = ttrpcAddress
|
||||
|
||||
// load the plugin specific configuration if it is provided
|
||||
//TODO: Read configuration passed into shim, or from state directory?
|
||||
//if p.Config != nil {
|
||||
// TODO: Read configuration passed into shim, or from state directory?
|
||||
// if p.Config != nil {
|
||||
// pc, err := config.Decode(p)
|
||||
// if err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
// initContext.Config = pc
|
||||
//}
|
||||
// }
|
||||
|
||||
result := p.Init(initContext)
|
||||
if err := initialized.Add(result); err != nil {
|
||||
@@ -445,7 +447,7 @@ func run(ctx context.Context, manager Manager, initFunc Init, name string, confi
|
||||
}
|
||||
}
|
||||
|
||||
if err := serve(ctx, server, signals, sd.Shutdown); err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return error
|
||||
if err := serve(ctx, server, signals, sd.Shutdown); err != nil { //nolint:nolintlint,staticcheck // Ignore SA4023 as some platforms always return error
|
||||
if err != shutdown.ErrShutdown {
|
||||
return err
|
||||
}
|
||||
@@ -477,7 +479,7 @@ func serve(ctx context.Context, server *ttrpc.Server, signals chan os.Signal, sh
|
||||
}
|
||||
|
||||
l, err := serveListener(socketFlag)
|
||||
if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return error
|
||||
if err != nil { //nolint:nolintlint,staticcheck // Ignore SA4023 as some platforms always return error
|
||||
return err
|
||||
}
|
||||
go func() {
|
||||
|
||||
5
vendor/github.com/containerd/containerd/task.go
generated
vendored
5
vendor/github.com/containerd/containerd/task.go
generated
vendored
@@ -139,6 +139,11 @@ type TaskInfo struct {
|
||||
RootFS []mount.Mount
|
||||
// Options hold runtime specific settings for task creation
|
||||
Options interface{}
|
||||
// RuntimePath is an absolute path that can be used to overwrite path
|
||||
// to a shim runtime binary.
|
||||
RuntimePath string
|
||||
|
||||
// runtime is the runtime name for the container, and cannot be changed.
|
||||
runtime string
|
||||
}
|
||||
|
||||
|
||||
2
vendor/github.com/containerd/containerd/task_opts.go
generated
vendored
2
vendor/github.com/containerd/containerd/task_opts.go
generated
vendored
@@ -49,7 +49,7 @@ func WithRootFS(mounts []mount.Mount) NewTaskOpts {
|
||||
// instead of resolving it from runtime name.
|
||||
func WithRuntimePath(absRuntimePath string) NewTaskOpts {
|
||||
return func(ctx context.Context, client *Client, info *TaskInfo) error {
|
||||
info.runtime = absRuntimePath
|
||||
info.RuntimePath = absRuntimePath
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
2
vendor/github.com/containerd/containerd/version/version.go
generated
vendored
2
vendor/github.com/containerd/containerd/version/version.go
generated
vendored
@@ -23,7 +23,7 @@ var (
|
||||
Package = "github.com/containerd/containerd"
|
||||
|
||||
// Version holds the complete version number. Filled in at linking time.
|
||||
Version = "1.6.19+unknown"
|
||||
Version = "1.6.21+unknown"
|
||||
|
||||
// Revision is filled with the VCS (e.g. git) revision being used to build
|
||||
// the program at linking time.
|
||||
|
||||
7
vendor/github.com/containerd/ttrpc/server.go
generated
vendored
7
vendor/github.com/containerd/ttrpc/server.go
generated
vendored
@@ -24,6 +24,7 @@ import (
|
||||
"net"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
@@ -467,14 +468,12 @@ func (c *serverConn) run(sctx context.Context) {
|
||||
// branch. Basically, it means that we are no longer receiving
|
||||
// requests due to a terminal error.
|
||||
recvErr = nil // connection is now "closing"
|
||||
if err == io.EOF || err == io.ErrUnexpectedEOF {
|
||||
if err == io.EOF || err == io.ErrUnexpectedEOF || errors.Is(err, syscall.ECONNRESET) {
|
||||
// The client went away and we should stop processing
|
||||
// requests, so that the client connection is closed
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
logrus.WithError(err).Error("error receiving message")
|
||||
}
|
||||
logrus.WithError(err).Error("error receiving message")
|
||||
case <-shutdown:
|
||||
return
|
||||
}
|
||||
|
||||
6
vendor/github.com/ishidawataru/sctp/sctp_linux.go
generated
vendored
6
vendor/github.com/ishidawataru/sctp/sctp_linux.go
generated
vendored
@@ -22,6 +22,7 @@ import (
|
||||
"sync/atomic"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
func setsockopt(fd int, optname, optval, optlen uintptr) (uintptr, uintptr, error) {
|
||||
@@ -40,6 +41,9 @@ func setsockopt(fd int, optname, optval, optlen uintptr) (uintptr, uintptr, erro
|
||||
}
|
||||
|
||||
func getsockopt(fd int, optname, optval, optlen uintptr) (uintptr, uintptr, error) {
|
||||
if runtime.GOARCH == "s390x" {
|
||||
optlen = uintptr(unsafe.Pointer(&optlen))
|
||||
}
|
||||
// FIXME: syscall.SYS_GETSOCKOPT is undefined on 386
|
||||
r0, r1, errno := syscall.Syscall6(syscall.SYS_GETSOCKOPT,
|
||||
uintptr(fd),
|
||||
@@ -292,7 +296,7 @@ func dialSCTPExtConfig(network string, laddr, raddr *SCTPAddr, options InitMsg,
|
||||
laddr.IPAddrs = append(laddr.IPAddrs, net.IPAddr{IP: net.IPv6zero})
|
||||
}
|
||||
}
|
||||
err := SCTPBind(sock, laddr, SCTP_BINDX_ADD_ADDR)
|
||||
err = SCTPBind(sock, laddr, SCTP_BINDX_ADD_ADDR)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
9
vendor/github.com/moby/buildkit/cache/manager.go
generated
vendored
9
vendor/github.com/moby/buildkit/cache/manager.go
generated
vendored
@@ -301,7 +301,14 @@ func (cm *cacheManager) GetByBlob(ctx context.Context, desc ocispecs.Descriptor,
|
||||
|
||||
cm.records[id] = rec
|
||||
|
||||
return rec.ref(true, descHandlers, nil), nil
|
||||
ref := rec.ref(true, descHandlers, nil)
|
||||
if s := unlazySessionOf(opts...); s != nil {
|
||||
if err := ref.unlazy(ctx, ref.descHandlers, ref.progress, s, true); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return ref, nil
|
||||
}
|
||||
|
||||
// init loads all snapshots from metadata state and tries to load the records
|
||||
|
||||
11
vendor/github.com/moby/buildkit/cache/opts.go
generated
vendored
11
vendor/github.com/moby/buildkit/cache/opts.go
generated
vendored
@@ -37,3 +37,14 @@ func (m NeedsRemoteProviderError) Error() string {
|
||||
}
|
||||
|
||||
type ProgressKey struct{}
|
||||
|
||||
type Unlazy session.Group
|
||||
|
||||
func unlazySessionOf(opts ...RefOption) session.Group {
|
||||
for _, opt := range opts {
|
||||
if opt, ok := opt.(session.Group); ok {
|
||||
return opt
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
11
vendor/github.com/moby/buildkit/cache/remotecache/local/local.go
generated
vendored
11
vendor/github.com/moby/buildkit/cache/remotecache/local/local.go
generated
vendored
@@ -98,7 +98,16 @@ func getContentStore(ctx context.Context, sm *session.Manager, g session.Group,
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return sessioncontent.NewCallerStore(caller, storeID), nil
|
||||
return &unlazyProvider{sessioncontent.NewCallerStore(caller, storeID), g}, nil
|
||||
}
|
||||
|
||||
type unlazyProvider struct {
|
||||
content.Store
|
||||
s session.Group
|
||||
}
|
||||
|
||||
func (p *unlazyProvider) UnlazySession(desc ocispecs.Descriptor) session.Group {
|
||||
return p.s
|
||||
}
|
||||
|
||||
func attrsToCompression(attrs map[string]string) (*compression.Config, error) {
|
||||
|
||||
13
vendor/github.com/moby/buildkit/executor/oci/user.go
generated
vendored
13
vendor/github.com/moby/buildkit/executor/oci/user.go
generated
vendored
@@ -91,6 +91,7 @@ func parseUID(str string) (uint32, error) {
|
||||
// once the PR in containerd is merged we should remove this function.
|
||||
func WithUIDGID(uid, gid uint32, sgids []uint32) containerdoci.SpecOpts {
|
||||
return func(_ context.Context, _ containerdoci.Client, _ *containers.Container, s *containerdoci.Spec) error {
|
||||
defer ensureAdditionalGids(s)
|
||||
setProcess(s)
|
||||
s.Process.User.UID = uid
|
||||
s.Process.User.GID = gid
|
||||
@@ -106,3 +107,15 @@ func setProcess(s *containerdoci.Spec) {
|
||||
s.Process = &specs.Process{}
|
||||
}
|
||||
}
|
||||
|
||||
// ensureAdditionalGids ensures that the primary GID is also included in the additional GID list.
|
||||
// From https://github.com/containerd/containerd/blob/v1.7.0-beta.4/oci/spec_opts.go#L124-L133
|
||||
func ensureAdditionalGids(s *containerdoci.Spec) {
|
||||
setProcess(s)
|
||||
for _, f := range s.Process.User.AdditionalGids {
|
||||
if f == s.Process.User.GID {
|
||||
return
|
||||
}
|
||||
}
|
||||
s.Process.User.AdditionalGids = append([]uint32{s.Process.User.GID}, s.Process.User.AdditionalGids...)
|
||||
}
|
||||
|
||||
21
vendor/github.com/moby/buildkit/util/contentutil/multiprovider.go
generated
vendored
21
vendor/github.com/moby/buildkit/util/contentutil/multiprovider.go
generated
vendored
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/moby/buildkit/session"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/pkg/errors"
|
||||
@@ -90,3 +91,23 @@ func (mp *MultiProvider) Add(dgst digest.Digest, p content.Provider) {
|
||||
defer mp.mu.Unlock()
|
||||
mp.sub[dgst] = p
|
||||
}
|
||||
|
||||
func (mp *MultiProvider) UnlazySession(desc ocispecs.Descriptor) session.Group {
|
||||
type unlazySession interface {
|
||||
UnlazySession(ocispecs.Descriptor) session.Group
|
||||
}
|
||||
|
||||
mp.mu.RLock()
|
||||
if p, ok := mp.sub[desc.Digest]; ok {
|
||||
mp.mu.RUnlock()
|
||||
if cd, ok := p.(unlazySession); ok {
|
||||
return cd.UnlazySession(desc)
|
||||
}
|
||||
} else {
|
||||
mp.mu.RUnlock()
|
||||
}
|
||||
if cd, ok := mp.base.(unlazySession); ok {
|
||||
return cd.UnlazySession(desc)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
8
vendor/github.com/moby/swarmkit/v2/manager/csi/plugin.go
generated
vendored
8
vendor/github.com/moby/swarmkit/v2/manager/csi/plugin.go
generated
vendored
@@ -6,11 +6,14 @@ import (
|
||||
"fmt"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||
"github.com/docker/docker/pkg/plugingetter"
|
||||
"github.com/moby/swarmkit/v2/api"
|
||||
"github.com/moby/swarmkit/v2/internal/csi/capability"
|
||||
"github.com/moby/swarmkit/v2/log"
|
||||
)
|
||||
|
||||
// Plugin is the interface for a CSI controller plugin.
|
||||
@@ -204,6 +207,11 @@ func (p *plugin) PublishVolume(ctx context.Context, v *api.Volume, nodeID string
|
||||
if !p.publisher {
|
||||
return nil, nil
|
||||
}
|
||||
csiNodeID := p.swarmToCSI[nodeID]
|
||||
if csiNodeID == "" {
|
||||
log.L.Errorf("CSI node ID not found for given Swarm node ID. Plugin: %s , Swarm node ID: %s", p.name, nodeID)
|
||||
return nil, status.Error(codes.FailedPrecondition, "CSI node ID not found for given Swarm node ID")
|
||||
}
|
||||
|
||||
req := p.makeControllerPublishVolumeRequest(v, nodeID)
|
||||
c, err := p.Client(ctx)
|
||||
|
||||
9
vendor/github.com/opencontainers/image-spec/specs-go/v1/annotations.go
generated
vendored
9
vendor/github.com/opencontainers/image-spec/specs-go/v1/annotations.go
generated
vendored
@@ -59,4 +59,13 @@ const (
|
||||
|
||||
// AnnotationBaseImageName is the annotation key for the image reference of the image's base image.
|
||||
AnnotationBaseImageName = "org.opencontainers.image.base.name"
|
||||
|
||||
// AnnotationArtifactCreated is the annotation key for the date and time on which the artifact was built, conforming to RFC 3339.
|
||||
AnnotationArtifactCreated = "org.opencontainers.artifact.created"
|
||||
|
||||
// AnnotationArtifactDescription is the annotation key for the human readable description for the artifact.
|
||||
AnnotationArtifactDescription = "org.opencontainers.artifact.description"
|
||||
|
||||
// AnnotationReferrersFiltersApplied is the annotation key for the comma separated list of filters applied by the registry in the referrers listing.
|
||||
AnnotationReferrersFiltersApplied = "org.opencontainers.referrers.filtersApplied"
|
||||
)
|
||||
|
||||
34
vendor/github.com/opencontainers/image-spec/specs-go/v1/artifact.go
generated
vendored
Normal file
34
vendor/github.com/opencontainers/image-spec/specs-go/v1/artifact.go
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
// Copyright 2022 The Linux Foundation
|
||||
//
|
||||
// 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 v1
|
||||
|
||||
// Artifact describes an artifact manifest.
|
||||
// This structure provides `application/vnd.oci.artifact.manifest.v1+json` mediatype when marshalled to JSON.
|
||||
type Artifact struct {
|
||||
// MediaType is the media type of the object this schema refers to.
|
||||
MediaType string `json:"mediaType"`
|
||||
|
||||
// ArtifactType is the IANA media type of the artifact this schema refers to.
|
||||
ArtifactType string `json:"artifactType"`
|
||||
|
||||
// Blobs is a collection of blobs referenced by this manifest.
|
||||
Blobs []Descriptor `json:"blobs,omitempty"`
|
||||
|
||||
// Subject (reference) is an optional link from the artifact to another manifest forming an association between the artifact and the other manifest.
|
||||
Subject *Descriptor `json:"subject,omitempty"`
|
||||
|
||||
// Annotations contains arbitrary metadata for the artifact manifest.
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
}
|
||||
9
vendor/github.com/opencontainers/image-spec/specs-go/v1/config.go
generated
vendored
9
vendor/github.com/opencontainers/image-spec/specs-go/v1/config.go
generated
vendored
@@ -48,6 +48,15 @@ type ImageConfig struct {
|
||||
|
||||
// StopSignal contains the system call signal that will be sent to the container to exit.
|
||||
StopSignal string `json:"StopSignal,omitempty"`
|
||||
|
||||
// ArgsEscaped `[Deprecated]` - This field is present only for legacy
|
||||
// compatibility with Docker and should not be used by new image builders.
|
||||
// It is used by Docker for Windows images to indicate that the `Entrypoint`
|
||||
// or `Cmd` or both, contains only a single element array, that is a
|
||||
// pre-escaped, and combined into a single string `CommandLine`. If `true`
|
||||
// the value in `Entrypoint` or `Cmd` should be used as-is to avoid double
|
||||
// escaping.
|
||||
ArgsEscaped bool `json:"ArgsEscaped,omitempty"`
|
||||
}
|
||||
|
||||
// RootFS describes a layer content addresses
|
||||
|
||||
5
vendor/github.com/opencontainers/image-spec/specs-go/v1/descriptor.go
generated
vendored
5
vendor/github.com/opencontainers/image-spec/specs-go/v1/descriptor.go
generated
vendored
@@ -1,4 +1,4 @@
|
||||
// Copyright 2016 The Linux Foundation
|
||||
// Copyright 2016-2022 The Linux Foundation
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
@@ -44,6 +44,9 @@ type Descriptor struct {
|
||||
//
|
||||
// This should only be used when referring to a manifest.
|
||||
Platform *Platform `json:"platform,omitempty"`
|
||||
|
||||
// ArtifactType is the IANA media type of this artifact.
|
||||
ArtifactType string `json:"artifactType,omitempty"`
|
||||
}
|
||||
|
||||
// Platform describes the platform which the image in the manifest runs on.
|
||||
|
||||
5
vendor/github.com/opencontainers/image-spec/specs-go/v1/manifest.go
generated
vendored
5
vendor/github.com/opencontainers/image-spec/specs-go/v1/manifest.go
generated
vendored
@@ -1,4 +1,4 @@
|
||||
// Copyright 2016 The Linux Foundation
|
||||
// Copyright 2016-2022 The Linux Foundation
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
@@ -30,6 +30,9 @@ type Manifest struct {
|
||||
// Layers is an indexed list of layers referenced by the manifest.
|
||||
Layers []Descriptor `json:"layers"`
|
||||
|
||||
// Subject is an optional link from the image manifest to another manifest forming an association between the image manifest and the other manifest.
|
||||
Subject *Descriptor `json:"subject,omitempty"`
|
||||
|
||||
// Annotations contains arbitrary metadata for the image manifest.
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
}
|
||||
|
||||
3
vendor/github.com/opencontainers/image-spec/specs-go/v1/mediatype.go
generated
vendored
3
vendor/github.com/opencontainers/image-spec/specs-go/v1/mediatype.go
generated
vendored
@@ -54,4 +54,7 @@ const (
|
||||
|
||||
// MediaTypeImageConfig specifies the media type for the image configuration.
|
||||
MediaTypeImageConfig = "application/vnd.oci.image.config.v1+json"
|
||||
|
||||
// MediaTypeArtifactManifest specifies the media type for a content descriptor.
|
||||
MediaTypeArtifactManifest = "application/vnd.oci.artifact.manifest.v1+json"
|
||||
)
|
||||
|
||||
4
vendor/github.com/opencontainers/image-spec/specs-go/version.go
generated
vendored
4
vendor/github.com/opencontainers/image-spec/specs-go/version.go
generated
vendored
@@ -20,9 +20,9 @@ const (
|
||||
// VersionMajor is for an API incompatible changes
|
||||
VersionMajor = 1
|
||||
// VersionMinor is for functionality in a backwards-compatible manner
|
||||
VersionMinor = 0
|
||||
VersionMinor = 1
|
||||
// VersionPatch is for backwards-compatible bug fixes
|
||||
VersionPatch = 2
|
||||
VersionPatch = 0
|
||||
|
||||
// VersionDev indicates development branch. Releases will be empty string.
|
||||
VersionDev = "-dev"
|
||||
|
||||
19
vendor/modules.txt
vendored
19
vendor/modules.txt
vendored
@@ -30,7 +30,7 @@ github.com/Microsoft/go-winio/pkg/fs
|
||||
github.com/Microsoft/go-winio/pkg/guid
|
||||
github.com/Microsoft/go-winio/pkg/security
|
||||
github.com/Microsoft/go-winio/vhd
|
||||
# github.com/Microsoft/hcsshim v0.9.7
|
||||
# github.com/Microsoft/hcsshim v0.9.8
|
||||
## explicit; go 1.13
|
||||
github.com/Microsoft/hcsshim
|
||||
github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/options
|
||||
@@ -160,7 +160,7 @@ github.com/containerd/cgroups/v2/stats
|
||||
# github.com/containerd/console v1.0.3
|
||||
## explicit; go 1.13
|
||||
github.com/containerd/console
|
||||
# github.com/containerd/containerd v1.6.19
|
||||
# github.com/containerd/containerd v1.6.21
|
||||
## explicit; go 1.17
|
||||
github.com/containerd/containerd
|
||||
github.com/containerd/containerd/api/events
|
||||
@@ -180,6 +180,7 @@ github.com/containerd/containerd/api/types
|
||||
github.com/containerd/containerd/api/types/task
|
||||
github.com/containerd/containerd/archive
|
||||
github.com/containerd/containerd/archive/compression
|
||||
github.com/containerd/containerd/archive/tarheader
|
||||
github.com/containerd/containerd/cio
|
||||
github.com/containerd/containerd/containers
|
||||
github.com/containerd/containerd/content
|
||||
@@ -257,7 +258,7 @@ github.com/containerd/go-runc
|
||||
## explicit; go 1.16
|
||||
github.com/containerd/stargz-snapshotter/estargz
|
||||
github.com/containerd/stargz-snapshotter/estargz/errorutil
|
||||
# github.com/containerd/ttrpc v1.1.0
|
||||
# github.com/containerd/ttrpc v1.1.1
|
||||
## explicit; go 1.13
|
||||
github.com/containerd/ttrpc
|
||||
# github.com/containerd/typeurl v1.0.2
|
||||
@@ -459,7 +460,7 @@ github.com/imdario/mergo
|
||||
# github.com/inconshreveable/mousetrap v1.0.1
|
||||
## explicit; go 1.18
|
||||
github.com/inconshreveable/mousetrap
|
||||
# github.com/ishidawataru/sctp v0.0.0-20210707070123-9a39160e9062
|
||||
# github.com/ishidawataru/sctp v0.0.0-20230406120618-7ff4192f6ff2
|
||||
## explicit; go 1.12
|
||||
github.com/ishidawataru/sctp
|
||||
# github.com/jmespath/go-jmespath v0.4.0
|
||||
@@ -486,7 +487,7 @@ github.com/mistifyio/go-zfs
|
||||
# github.com/mitchellh/hashstructure/v2 v2.0.2
|
||||
## explicit; go 1.14
|
||||
github.com/mitchellh/hashstructure/v2
|
||||
# github.com/moby/buildkit v0.10.7-0.20230306143919-70f2ad56d3e5
|
||||
# github.com/moby/buildkit v0.10.7-0.20230412161310-d52b2d584242
|
||||
## explicit; go 1.17
|
||||
github.com/moby/buildkit/api/services/control
|
||||
github.com/moby/buildkit/api/types
|
||||
@@ -611,7 +612,7 @@ github.com/moby/patternmatcher
|
||||
# github.com/moby/pubsub v1.0.0
|
||||
## explicit; go 1.19
|
||||
github.com/moby/pubsub
|
||||
# github.com/moby/swarmkit/v2 v2.0.0-20230309194213-a745a8755ce3
|
||||
# github.com/moby/swarmkit/v2 v2.0.0-20230315203717-e28e8ba9bc83
|
||||
## explicit; go 1.18
|
||||
github.com/moby/swarmkit/v2/agent
|
||||
github.com/moby/swarmkit/v2/agent/configs
|
||||
@@ -706,12 +707,12 @@ github.com/morikuni/aec
|
||||
## explicit; go 1.13
|
||||
github.com/opencontainers/go-digest
|
||||
github.com/opencontainers/go-digest/digestset
|
||||
# github.com/opencontainers/image-spec v1.0.3-0.20220303224323-02efb9a75ee1
|
||||
## explicit; go 1.16
|
||||
# github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b
|
||||
## explicit; go 1.17
|
||||
github.com/opencontainers/image-spec/identity
|
||||
github.com/opencontainers/image-spec/specs-go
|
||||
github.com/opencontainers/image-spec/specs-go/v1
|
||||
# github.com/opencontainers/runc v1.1.3
|
||||
# github.com/opencontainers/runc v1.1.5
|
||||
## explicit; go 1.16
|
||||
github.com/opencontainers/runc/libcontainer/cgroups
|
||||
github.com/opencontainers/runc/libcontainer/configs
|
||||
|
||||
Reference in New Issue
Block a user