Skip to content

Commit

Permalink
Merge pull request #42 from ernoaapa/update-containerd
Browse files Browse the repository at this point in the history
Updated containerd to v1.1.0 and all deps
  • Loading branch information
ernoaapa authored May 17, 2018
2 parents 485cc43 + e3eb06b commit 3089eaf
Show file tree
Hide file tree
Showing 397 changed files with 13,466 additions and 6,447 deletions.
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ nfpm:
- deb

dependencies:
- containerd (>= 1.0.3)
- containerd (>= 1.1.0)

files:
"build/etc/systemd/system/eliotd.service": "/etc/systemd/system/eliotd.service"
Expand Down
4 changes: 2 additions & 2 deletions deps/build-containerd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

set -eu

CONTAINERD_VERSION="v1.0.3"
RUNC_DEP_VERSION="1.0.0-rc4+9f9c9623"
CONTAINERD_VERSION="v1.1.0"
RUNC_DEP_VERSION="1.0.0-rc4+a618ab5a"
BUILD_DIR=/tmp/build
ELIOT_SRC_DIR=$(pwd)
TARGET_DIR=${ELIOT_SRC_DIR}/dist
Expand Down
22 changes: 10 additions & 12 deletions pkg/runtime/containerd.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,6 @@ func resolveContainerStatus(ctx context.Context, container containerd.Container)
return status
}

func getValues(podsByName map[string]*model.Pod) (result []model.Pod) {
for _, pod := range podsByName {
result = append(result, *pod)
}
return result
}

// GetPod return pod by name
func (c *ContainerdClient) GetPod(namespace, podName string) (model.Pod, error) {
pods, err := c.GetPods(namespace)
Expand Down Expand Up @@ -419,7 +412,7 @@ func (c *ContainerdClient) PullImage(namespace, ref string, progress *progress.I
return errors.Wrapf(err, "Error while resolving image [%s] supported platforms", ref)
}

if !platformExist(platforms.Default(), supported) {
if !platformExist(platforms.DefaultSpec(), supported) {
platformNames := []string{}
for _, platform := range supported {
platformNames = append(platformNames, platforms.Format(platform))
Expand All @@ -445,8 +438,8 @@ func (c *ContainerdClient) PullImage(namespace, ref string, progress *progress.I
return nil
}

func platformExist(platform string, supported []imagespecs.Platform) bool {
matcher, _ := platforms.Parse(platform)
func platformExist(platform imagespecs.Platform, supported []imagespecs.Platform) bool {
matcher := platforms.NewMatcher(platform)
for _, platform := range supported {
if matcher.Match(platform) {
return true
Expand Down Expand Up @@ -559,7 +552,10 @@ func (c *ContainerdClient) Exec(namespace, name, id string, args []string, tty b
pspec.Terminal = tty
pspec.Args = args

process, err := task.Exec(ctx, id, pspec, cio.NewIOWithTerminal(io.Stdin, io.Stdout, io.Stderr, tty))
process, err := task.Exec(ctx, id, pspec, cio.NewCreator(
cio.WithStreams(io.Stdin, io.Stdout, io.Stderr),
cio.WithTerminal,
))
if err != nil {
return err
}
Expand Down Expand Up @@ -593,7 +589,9 @@ func (c *ContainerdClient) Attach(namespace, name string, io AttachIO) error {
return errors.Wrapf(err, "Cannot attach to container [%s] in namespace [%s]", name, namespace)
}

task, taskErr := container.Task(ctx, cio.WithAttach(io.Stdin, io.Stdout, io.Stderr))
task, taskErr := container.Task(ctx, cio.NewAttach(
cio.WithStreams(io.Stdin, io.Stdout, io.Stderr),
))
if taskErr != nil {
return taskErr
}
Expand Down
8 changes: 6 additions & 2 deletions pkg/runtime/containerd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,20 @@ package runtime
import (
"testing"

"github.com/containerd/containerd/platforms"
imagespecs "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/stretchr/testify/assert"
)

func TestPlatformExist(t *testing.T) {
assert.True(t, platformExist("linux/arm64", []imagespecs.Platform{
platform, err := platforms.Parse("linux/arm64")
assert.NoError(t, err)

assert.True(t, platformExist(platform, []imagespecs.Platform{
{OS: "linux", Architecture: "arm64"},
}))

assert.False(t, platformExist("linux/arm64", []imagespecs.Platform{
assert.False(t, platformExist(platform, []imagespecs.Platform{
{OS: "linux", Architecture: "amd64"},
}))
}
8 changes: 8 additions & 0 deletions pkg/runtime/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,11 @@ func ensureMountSourceDirExists(mounts []model.Mount) error {
}
return nil
}

// getValues return list of values from map
func getValues(podsByName map[string]*model.Pod) (result []model.Pod) {
for _, pod := range podsByName {
result = append(result, *pod)
}
return result
}
46 changes: 46 additions & 0 deletions pkg/runtime/utils_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package runtime

import (
"io/ioutil"
"os"
"path/filepath"
"testing"

"github.com/ernoaapa/eliot/pkg/fs"
"github.com/ernoaapa/eliot/pkg/model"
log "github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
)

func TestEnsureMountSourceDirExistsCreatesDirectory(t *testing.T) {
dir, err := ioutil.TempDir("", "example")
if err != nil {
log.Fatal(err)
}
defer os.RemoveAll(dir)
source := filepath.Join(dir, "temp", "directory")
assert.False(t, fs.DirExist(source))
assert.NoError(t, ensureMountSourceDirExists([]model.Mount{{Source: source}}))
assert.True(t, fs.DirExist(source))
}

func TestEnsureMountSourceDirExistsSkipFiles(t *testing.T) {
dir, err := ioutil.TempDir("", "example")
if err != nil {
log.Fatal(err)
}
defer os.RemoveAll(dir)
source := filepath.Join(dir, "file")
assert.NoError(t, ioutil.WriteFile(source, []byte("foobar"), os.ModePerm))

assert.NoError(t, ensureMountSourceDirExists([]model.Mount{{Source: source}}))
}

func TestGetValues(t *testing.T) {
expected := &model.Pod{}
result := getValues(map[string]*model.Pod{
"foo": expected,
})

assert.Equal(t, []model.Pod{*expected}, result)
}
25 changes: 13 additions & 12 deletions vendor.conf
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
github.com/pkg/errors v0.8.0
github.com/urfave/cli v1.20.0
github.com/urfave/cli 7bc6a0acffa589f415f88aca16cc1de5ffd66f9c
github.com/stretchr/testify v1.1.4
github.com/davecgh/go-spew v1.1.0
github.com/pmezard/go-difflib v1.0.0
github.com/containerd/containerd v1.0.2+patch-1 /~https://github.com/ernoaapa/containerd.git
github.com/containerd/containerd v1.1.0
github.com/sirupsen/logrus v1.0.3
golang.org/x/crypto 81e90905daefcd6fd217b62423c0908922eadb30
golang.org/x/sys bb24a47a89eac6c1227fbcb2ae37a8b9ed323366
golang.org/x/crypto 49796115aa4b964c318aad4f3084fdb41e9aa067
golang.org/x/sys 314a259e304ff91bd6985da2a7149bbf91237993 /~https://github.com/golang/sys
github.com/Microsoft/go-winio v0.4.7
github.com/containerd/fifo fbfb6a11ec671efbe94ad1c12c2e98773f19e1e6
github.com/gogo/protobuf v0.5
github.com/containerd/fifo 3d5202aec260678c48179c56f40e6f38a095738c
github.com/gogo/protobuf v1.0.0
github.com/golang/protobuf 1643683e1b54a9e88ad26d98f81400c8c9d9f4f9
github.com/opencontainers/go-digest v1.0.0-rc1
github.com/opencontainers/image-spec v1.0.1
github.com/opencontainers/runc 9f9c96235cc97674e935002fc3d78361b696a69e
github.com/opencontainers/runc 69663f0bd4b60df09991c08812a60108003fa340
github.com/opencontainers/runtime-spec v1.0.1
golang.org/x/net 66aacef3dd8a676686c7ae3716979581e8b03c47
google.golang.org/grpc v1.7.1
google.golang.org/grpc v1.10.1
google.golang.org/genproto d80a6e20e776b0b17a324d0ba1ab50a39c8e8944
golang.org/x/text 19e51611da83d6be54ddafce4a4af510cb3e9ea4
github.com/docker/go-events 9461782956ad83b30282bf90e31fa6a70c255ba9
golang.org/x/sync 450f422ab23cf9881c94e2db30cac0eb1b7cf80c
github.com/containerd/continuity cf279e6ac893682272b4479d4c67fd3abf878b4e
github.com/containerd/continuity 3e8f2ea4b190484acb976a5b378d373429639a1a
gopkg.in/go-playground/validator.v9 v9.9.4
github.com/go-playground/universal-translator v0.16.0
github.com/go-playground/locales v0.11.2
Expand All @@ -36,10 +36,11 @@ github.com/rs/xid v1.1
github.com/miekg/dns v1.0.4
github.com/cenkalti/backoff v1.1.0
github.com/containerd/typeurl f6943554a7e7e88b3c14aad190bf05932da84788
github.com/docker/docker v17.05.0-ce
k8s.io/kubernetes v1.9.0-alpha.2
github.com/docker/docker 86f080cff0914e9694068ed78d503701667c4c00
k8s.io/kubernetes v1.10.0
github.com/thejerf/suture v2.0.1
github.com/ghodss/yaml v1.0.0
github.com/syndtr/gocapability db04d3cc01c8b54962a58ec7e491717d06cfcc16
github.com/hako/durafmt 987f93c94e473e74aadc826871e61ae6b3360ebb
github.com/c2h5oh/datasize 4eba002a5eaea69cf8d235a388fc6b65ae68d2dd
github.com/c2h5oh/datasize 4eba002a5eaea69cf8d235a388fc6b65ae68d2dd
github.com/gogo/googleapis 08a7655d27152912db7aaf4f983275eaf8d128ef

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3089eaf

Please sign in to comment.