Commit 5802b429 authored by Brad Davidson's avatar Brad Davidson Committed by Brad Davidson

Bump containerd to v1.4.9-k3s1

parent abb6581a
......@@ -9,7 +9,7 @@ replace (
github.com/containerd/btrfs => github.com/containerd/btrfs v1.0.0
github.com/containerd/cgroups => github.com/containerd/cgroups v1.0.1
github.com/containerd/console => github.com/containerd/console v1.0.2
github.com/containerd/containerd => github.com/k3s-io/containerd v1.4.8-k3s1 // k3s-release/1.4
github.com/containerd/containerd => github.com/k3s-io/containerd v1.4.9-k3s1 // k3s-release/1.4
github.com/containerd/continuity => github.com/k3s-io/continuity v0.0.0-20210309170710-f93269e0d5c1
github.com/containerd/cri => github.com/k3s-io/cri v1.4.0-k3s.7 // k3s-release/1.4
github.com/containerd/fifo => github.com/containerd/fifo v1.0.0
......
......@@ -524,8 +524,8 @@ github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes=
github.com/k3s-io/containerd v1.4.8-k3s1 h1:p4Z22iGEy7EaOCDChlgojqm6Jnziv19EuqnnLnK4tpk=
github.com/k3s-io/containerd v1.4.8-k3s1/go.mod h1:FxLYZ8JAZ2kqHz/1mpWp1wkcquVwfNbDlUKjrT1B0iI=
github.com/k3s-io/containerd v1.4.9-k3s1 h1:gV6EDgGcp4sxeZ+5dOaul+K+Z6nSx3rfzmC28DIDSSo=
github.com/k3s-io/containerd v1.4.9-k3s1/go.mod h1:O7TXIlGKEOd9pX4UfoQW7kzPLmpjWSRRE1V0qZ+XZFw=
github.com/k3s-io/continuity v0.0.0-20210309170710-f93269e0d5c1 h1:KEz2rd9IDbrQT8w6RibEYlwfTXiu0P6hQDE+6O4IJdI=
github.com/k3s-io/continuity v0.0.0-20210309170710-f93269e0d5c1/go.mod h1:EXlVlkqNba9rJe3j7w3Xa924itAMLgZH4UD/Q4PExuQ=
github.com/k3s-io/cri v1.4.0-k3s.7 h1:1ycdF3dMDJMW/k/UxDC6eMsyGSMZ/p0AoUBVdJvNGQs=
......
......@@ -3,9 +3,12 @@ module github.com/containerd/containerd
go 1.14
replace (
github.com/Microsoft/go-winio => github.com/Microsoft/go-winio v0.4.19
github.com/Microsoft/hcsshim => github.com/Microsoft/hcsshim v0.8.16
github.com/containerd/continuity => github.com/k3s-io/continuity v0.0.0-20210309170710-f93269e0d5c1
github.com/containerd/cri => github.com/k3s-io/cri v1.4.0-k3s.7 // k3s-release/1.4
github.com/golang/protobuf => github.com/golang/protobuf v1.3.5
github.com/opencontainers/runc => github.com/opencontainers/runc v1.0.0-rc94
google.golang.org/genproto => google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63
k8s.io/api => k8s.io/api v0.19.10
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.19.10
......@@ -32,12 +35,13 @@ replace (
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.19.10
k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.19.10
k8s.io/sample-controller => k8s.io/sample-controller v0.19.10
)
require (
github.com/BurntSushi/toml v0.3.1
github.com/Microsoft/go-winio v0.4.19
github.com/Microsoft/hcsshim v0.8.20
github.com/Microsoft/hcsshim v0.8.16
github.com/Microsoft/hcsshim/test v0.0.0-20210227013316-43a75bb4edd3
github.com/containerd/aufs v1.0.0
github.com/containerd/btrfs v1.0.0
......@@ -50,7 +54,7 @@ require (
github.com/containerd/ttrpc v1.0.2
github.com/containerd/typeurl v1.0.2
github.com/containerd/zfs v1.0.0
github.com/coreos/go-systemd/v22 v22.1.0
github.com/coreos/go-systemd/v22 v22.3.1
github.com/docker/docker v17.12.0-ce-rc1.0.20200310163718-4634ce647cf2+incompatible // indirect
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c
github.com/docker/go-metrics v0.0.1
......@@ -64,8 +68,8 @@ require (
github.com/imdario/mergo v0.3.11
github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/image-spec v1.0.1
github.com/opencontainers/runc v1.0.0-rc93
github.com/opencontainers/runtime-spec v1.0.3-0.20200929063507-e6143ca7d51d
github.com/opencontainers/runc v1.0.0-rc94
github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417
github.com/opencontainers/selinux v1.8.0
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.7.1
......@@ -75,7 +79,7 @@ require (
go.etcd.io/bbolt v1.3.5
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a
golang.org/x/sys v0.0.0-20210324051608-47abb6519492
golang.org/x/sys v0.0.0-20210426230700-d19ff857e887
google.golang.org/grpc v1.33.2
gotest.tools/v3 v3.0.3
)
......@@ -31,6 +31,7 @@ import (
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/version"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"golang.org/x/net/context/ctxhttp"
......@@ -356,6 +357,9 @@ func (ah *authHandler) fetchTokenWithOAuth(ctx context.Context, to tokenOptions)
req.Header[k] = append(req.Header[k], v...)
}
}
if len(req.Header.Get("User-Agent")) == 0 {
req.Header.Set("User-Agent", "containerd/"+version.Version)
}
resp, err := ctxhttp.Do(ctx, ah.client, req)
if err != nil {
......@@ -408,6 +412,9 @@ func (ah *authHandler) fetchToken(ctx context.Context, to tokenOptions) (string,
req.Header[k] = append(req.Header[k], v...)
}
}
if len(req.Header.Get("User-Agent")) == 0 {
req.Header.Set("User-Agent", "containerd/"+version.Version)
}
reqParams := req.URL.Query()
......
......@@ -148,7 +148,7 @@ func (r dockerFetcher) Fetch(ctx context.Context, desc ocispec.Descriptor) (io.R
})
}
func (r dockerFetcher) open(ctx context.Context, req *request, mediatype string, offset int64) (io.ReadCloser, error) {
func (r dockerFetcher) open(ctx context.Context, req *request, mediatype string, offset int64) (_ io.ReadCloser, retErr error) {
req.header.Set("Accept", strings.Join([]string{mediatype, `*/*`}, ", "))
if offset > 0 {
......@@ -162,13 +162,17 @@ func (r dockerFetcher) open(ctx context.Context, req *request, mediatype string,
if err != nil {
return nil, err
}
defer func() {
if retErr != nil {
resp.Body.Close()
}
}()
if resp.StatusCode > 299 {
// TODO(stevvooe): When doing a offset specific request, we should
// really distinguish between a 206 and a 200. In the case of 200, we
// can discard the bytes, hiding the seek behavior from the
// implementation.
defer resp.Body.Close()
if resp.StatusCode == http.StatusNotFound {
return nil, errors.Wrapf(errdefs.ErrNotFound, "content at %v not found", req.String())
......
......@@ -109,12 +109,15 @@ func (p dockerPusher) Push(ctx context.Context, desc ocispec.Descriptor) (conten
// TODO: Set updated time?
},
})
resp.Body.Close()
return nil, errors.Wrapf(errdefs.ErrAlreadyExists, "content %v on remote", desc.Digest)
}
} else if resp.StatusCode != http.StatusNotFound {
resp.Body.Close()
// TODO: log error
return nil, errors.Errorf("unexpected response: %s", resp.Status)
}
resp.Body.Close()
}
if isManifest {
......
......@@ -239,10 +239,10 @@ func (r *dockerResolver) Resolve(ctx context.Context, ref string) (string, ocisp
}
var (
lastErr error
paths [][]string
dgst = refspec.Digest()
caps = HostCapabilityPull
firstErr error
paths [][]string
dgst = refspec.Digest()
caps = HostCapabilityPull
)
if dgst != "" {
......@@ -293,8 +293,8 @@ func (r *dockerResolver) Resolve(ctx context.Context, ref string) (string, ocisp
err = errors.Wrapf(err, "pull access denied, repository does not exist or may require authorization")
}
// Store the error for referencing later
if lastErr == nil {
lastErr = err
if firstErr == nil {
firstErr = err
}
log.G(ctx).WithError(err).Info("trying next host")
continue // try another host
......@@ -306,7 +306,14 @@ func (r *dockerResolver) Resolve(ctx context.Context, ref string) (string, ocisp
log.G(ctx).Info("trying next host - response was http.StatusNotFound")
continue
}
return "", ocispec.Descriptor{}, errors.Errorf("unexpected status code %v: %v", u, resp.Status)
if resp.StatusCode > 399 {
// Set firstErr when encountering the first non-404 status code.
if firstErr == nil {
firstErr = errors.Errorf("pulling from host %s failed with status code %v: %v", host.Host, u, resp.Status)
}
continue // try another host
}
return "", ocispec.Descriptor{}, errors.Errorf("pulling from host %s failed with unexpected status code %v: %v", host.Host, u, resp.Status)
}
size := resp.ContentLength
contentType := getManifestMediaType(resp)
......@@ -369,8 +376,8 @@ func (r *dockerResolver) Resolve(ctx context.Context, ref string) (string, ocisp
}
// Prevent resolving to excessively large manifests
if size > MaxManifestSize {
if lastErr == nil {
lastErr = errors.Wrapf(errdefs.ErrNotFound, "rejecting %d byte manifest for %s", size, ref)
if firstErr == nil {
firstErr = errors.Wrapf(errdefs.ErrNotFound, "rejecting %d byte manifest for %s", size, ref)
}
continue
}
......@@ -386,11 +393,15 @@ func (r *dockerResolver) Resolve(ctx context.Context, ref string) (string, ocisp
}
}
if lastErr == nil {
lastErr = errors.Wrap(errdefs.ErrNotFound, ref)
// If above loop terminates without return, then there was an error.
// "firstErr" contains the first non-404 error. That is, "firstErr == nil"
// means that either no registries were given or each registry returned 404.
if firstErr == nil {
firstErr = errors.Wrap(errdefs.ErrNotFound, ref)
}
return "", ocispec.Descriptor{}, lastErr
return "", ocispec.Descriptor{}, firstErr
}
func (r *dockerResolver) Fetcher(ctx context.Context, ref string) (remotes.Fetcher, error) {
......@@ -561,7 +572,21 @@ func (r *request) do(ctx context.Context) (*http.Response, error) {
if err := r.authorize(ctx, req); err != nil {
return nil, errors.Wrap(err, "failed to authorize")
}
resp, err := ctxhttp.Do(ctx, r.host.Client, req)
var client = &http.Client{}
if r.host.Client != nil {
*client = *r.host.Client
}
if client.CheckRedirect == nil {
client.CheckRedirect = func(req *http.Request, via []*http.Request) error {
if len(via) >= 10 {
return errors.New("stopped after 10 redirects")
}
return errors.Wrap(r.authorize(ctx, req), "failed to authorize redirect")
}
}
resp, err := ctxhttp.Do(ctx, client, req)
if err != nil {
return nil, errors.Wrap(err, "failed to do request")
}
......
......@@ -23,7 +23,7 @@ var (
Package = "github.com/containerd/containerd"
// Version holds the complete version number. Filled in at linking time.
Version = "1.4.8+unknown"
Version = "1.4.9+unknown"
// Revision is filled with the VCS (e.g. git) revision being used to build
// the program at linking time.
......
......@@ -49,7 +49,7 @@ github.com/Microsoft/go-winio/pkg/etwlogrus
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.8.20 => github.com/Microsoft/hcsshim v0.8.20
# github.com/Microsoft/hcsshim v0.8.16 => github.com/Microsoft/hcsshim v0.8.20
github.com/Microsoft/hcsshim
github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/options
github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/stats
......@@ -176,7 +176,7 @@ github.com/containerd/cgroups/v2
github.com/containerd/cgroups/v2/stats
# github.com/containerd/console v1.0.2 => github.com/containerd/console v1.0.2
github.com/containerd/console
# github.com/containerd/containerd v1.5.1 => github.com/k3s-io/containerd v1.4.8-k3s1
# github.com/containerd/containerd v1.5.1 => github.com/k3s-io/containerd v1.4.9-k3s1
## explicit
github.com/containerd/containerd
github.com/containerd/containerd/api/events
......@@ -3196,7 +3196,7 @@ sigs.k8s.io/yaml
# github.com/containerd/btrfs => github.com/containerd/btrfs v1.0.0
# github.com/containerd/cgroups => github.com/containerd/cgroups v1.0.1
# github.com/containerd/console => github.com/containerd/console v1.0.2
# github.com/containerd/containerd => github.com/k3s-io/containerd v1.4.8-k3s1
# github.com/containerd/containerd => github.com/k3s-io/containerd v1.4.9-k3s1
# github.com/containerd/continuity => github.com/k3s-io/continuity v0.0.0-20210309170710-f93269e0d5c1
# github.com/containerd/cri => github.com/k3s-io/cri v1.4.0-k3s.7
# github.com/containerd/fifo => github.com/containerd/fifo v1.0.0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment