Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vendor cleanup #2124

Merged
merged 14 commits into from
Mar 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist: xenial
language: go

sudo: required
Expand All @@ -6,9 +7,12 @@ services:
- docker

before_install:
- if [ "${TRAVIS_OS_NAME}" = linux ]; then make vendor; fi
- if [ "${TRAVIS_OS_NAME}" = linux ]; then ./hack/tree_status.sh; fi
- if [ "${TRAVIS_OS_NAME}" = linux ]; then sudo apt-get -qq update; fi
- if [ "${TRAVIS_OS_NAME}" = linux ]; then sudo apt-get -qq install btrfs-tools libdevmapper-dev libgpgme11-dev libseccomp-dev; fi
- if [ "${TRAVIS_OS_NAME}" = linux ]; then sudo apt-get -qq install autoconf automake bison clang-format-3.9 e2fslibs-dev libfuse-dev libtool liblzma-dev gettext libsystemd-journal-dev; fi
- if [ "${TRAVIS_OS_NAME}" = linux ]; then sudo apt-get -qq install autoconf automake bison clang-format-3.9 e2fslibs-dev libfuse-dev libtool liblzma-dev gettext libsystemd-dev; fi
- if [ "${TRAVIS_OS_NAME}" = linux ]; then sudo apt-get -qq install libc-dev linux-libc-dev; fi
- if [ "${TRAVIS_OS_NAME}" = osx ]; then brew update && brew install gpgme; fi

install:
Expand Down
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,11 @@ ${BUILD_BIN_PATH}/ginkgo:
mkdir -p ${BUILD_BIN_PATH}
$(GO) build -o ${BUILD_BIN_PATH}/ginkgo ./vendor/github.com/onsi/ginkgo/ginkgo

vendor:
vndr -whitelist "github.com/onsi/ginkgo/ginkgo/.*" \
-whitelist "github.com/golang/mock/.*" ${PKG}
vendor: .install.vndr
$(GOPATH)/bin/vndr \
-whitelist "github.com/onsi/ginkgo" \
-whitelist "github.com/golang/mock" \
${PKG}

${BUILD_BIN_PATH}/mockgen:
mkdir -p ${BUILD_BIN_PATH}
Expand Down Expand Up @@ -309,6 +311,9 @@ install.tools: .install.gitvalidation .install.golangci-lint .install.md2man .in
go get -u github.com/cpuguy83/go-md2man; \
fi

.install.vndr: .gopathok
$(GO) get -u github.com/LK4D4/vndr

.install.ostree: .gopathok
if ! pkg-config ostree-1 2> /dev/null ; then \
git clone https://github.com/ostreedev/ostree $(GOPATH)/src/github.com/ostreedev/ostree ; \
Expand Down
13 changes: 13 additions & 0 deletions hack/tree_status.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
set -e

STATUS=$(git status --porcelain)
if [[ -z $STATUS ]]
then
echo "tree is clean"
else
echo "tree is dirty, please commit all changes and sync the vendor.conf"
echo ""
echo "$STATUS"
exit 1
fi
7 changes: 6 additions & 1 deletion lib/container_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,12 @@ func (c *ContainerServer) LoadSandbox(id string) error {
return err
}

processLabel, mountLabel, err := label.InitLabels(label.DupSecOpt(m.Process.SelinuxLabel))
dupLabels, err := label.DupSecOpt(m.Process.SelinuxLabel)
if err != nil {
return err
}

processLabel, mountLabel, err := label.InitLabels(dupLabels)
if err != nil {
return err
}
Expand Down
8 changes: 6 additions & 2 deletions lib/container_server_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ import (
)

func (c *ContainerServer) addSandboxPlatform(sb *sandbox.Sandbox) {
c.state.processLevels[selinux.NewContext(sb.ProcessLabel())["level"]]++
// NewContext() always returns nil, so we can safely ignore the error
ctx, _ := selinux.NewContext(sb.ProcessLabel())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would still go for the error handling here since I have the feeling that it will be missed when the day comes that selinux.NewContext returns a real error.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, from a maintainability perspective we should catch if there ever becomes an error

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that @rhatdan wants to get rid of those entirely by letting containers/storage handle all label issue but I can update the code now to be on the safe side.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've had a look at the call stack and don't think it's worth the effort. We had to change a whole bunch of APIs up to the ContainerServer which does not really implement error handling (even for {Add,Remove}Container).

I agree that errors shouldn't be ignored but given this affects large parts of the API, I prefer to defer this to a separate PR.

c.state.processLevels[ctx["level"]]++
}

func (c *ContainerServer) removeSandboxPlatform(sb *sandbox.Sandbox) {
processLabel := sb.ProcessLabel()
level := selinux.NewContext(processLabel)["level"]
// NewContext() always returns nil, so we can safely ignore the error
ctx, _ := selinux.NewContext(processLabel)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same for here. Another option would be to revert the selinux-go related changes and put it in a separate PR like this: #2127 WDYT? (If you disagree I will close my PR)

level := ctx["level"]
pl, ok := c.state.processLevels[level]
if ok {
c.state.processLevels[level] = pl - 1
Expand Down
8 changes: 6 additions & 2 deletions oci/oci_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import (
"time"

"github.com/docker/docker/pkg/pools"
"github.com/docker/docker/pkg/term"
"github.com/kr/pty"
"github.com/opencontainers/runc/libcontainer"
"golang.org/x/sys/unix"
"k8s.io/client-go/tools/remotecommand"
kubecontainer "k8s.io/kubernetes/pkg/kubelet/container"
"k8s.io/kubernetes/pkg/util/term"
)

const (
Expand Down Expand Up @@ -60,6 +60,10 @@ func genericCalculateCPUPercent(cpuTotal uint64, perCPU []uint64) float64 {
return cpuPercent
}

func setSize(fd uintptr, size remotecommand.TerminalSize) error {
return term.SetWinsize(fd, &term.Winsize{Height: size.Height, Width: size.Width})
vrothberg marked this conversation as resolved.
Show resolved Hide resolved
}

func ttyCmd(execCmd *exec.Cmd, stdin io.Reader, stdout io.WriteCloser, resize <-chan remotecommand.TerminalSize) error {
p, err := pty.Start(execCmd)
if err != nil {
Expand All @@ -71,7 +75,7 @@ func ttyCmd(execCmd *exec.Cmd, stdin io.Reader, stdout io.WriteCloser, resize <-
defer stdout.Close()

kubecontainer.HandleResizing(resize, func(size remotecommand.TerminalSize) {
term.SetSize(p.Fd(), size)
setSize(p.Fd(), size)
})

if stdin != nil {
Expand Down
2 changes: 1 addition & 1 deletion server/container_create_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const minMemoryLimit = 4194304

func findCgroupMountpoint(name string) error {
// Set up pids limit if pids cgroup is mounted
_, err := cgroups.FindCgroupMountpoint(name)
_, err := cgroups.FindCgroupMountpoint("", name)
return err
}

Expand Down
88 changes: 38 additions & 50 deletions vendor.conf
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
k8s.io/kubernetes release-1.13 https://github.com/kubernetes/kubernetes
k8s.io/client-go release-10.0 https://github.com/kubernetes/client-go
k8s.io/apimachinery release-1.13 https://github.com/kubernetes/apimachinery
k8s.io/apiserver release-1.13 https://github.com/kubernetes/apiserver
k8s.io/utils 0d26856f57b32ec3398579285e5c8a2bfe8c5243 https://github.com/kubernetes/utils
k8s.io/api release-1.13 https://github.com/kubernetes/api
k8s.io/kube-openapi 39cb288412c48cb533ba4be5d6c28620b9a0c1b4 https://github.com/kubernetes/kube-openapi
k8s.io/apiextensions-apiserver release-1.13 https://github.com/kubernetes/apiextensions-apiserver
k8s.io/csi-api release-1.13 https://github.com/kubernetes/csi-api
k8s.io/cloud-provider release-1.13 https://github.com/kubernetes/cloud-provider
k8s.io/kubernetes v1.13.4 https://github.com/kubernetes/kubernetes
k8s.io/client-go kubernetes-1.13.4 https://github.com/kubernetes/client-go
k8s.io/apimachinery kubernetes-1.13.4 https://github.com/kubernetes/apimachinery
k8s.io/apiserver kubernetes-1.13.4 https://github.com/kubernetes/apiserver
k8s.io/api kubernetes-1.13.4 https://github.com/kubernetes/api
k8s.io/apiextensions-apiserver kubernetes-1.13.4 https://github.com/kubernetes/apiextensions-apiserver
k8s.io/csi-api kubernetes-1.13.4 https://github.com/kubernetes/csi-api
k8s.io/cloud-provider kubernetes-1.13.4 https://github.com/kubernetes/cloud-provider
k8s.io/klog 8139d8cb77af419532b33dfa7dd09fbc5f1d344f
sigs.k8s.io/yaml fd68e9863619f6ec2fdd8625fe1f02e7c877e480 https://github.com/kubernetes-sigs/yaml
k8s.io/kube-openapi 15615b16d372105f0c69ff47dfe7402926a65aaa https://github.com/kubernetes/kube-openapi
k8s.io/utils 21c4ce38f2a793ec01e925ddc31216500183b773 https://github.com/kubernetes/utils
sigs.k8s.io/yaml v1.1.0 https://github.com/kubernetes-sigs/yaml
#
github.com/googleapis/gnostic 0c5108395e2debce0d731cf0287ddf7242066aba
github.com/gregjones/httpcache 787624de3eb7bd915c329cba748687a3b22666a6
Expand All @@ -18,18 +18,19 @@ github.com/peterbourgon/diskv v2.0.1
github.com/sirupsen/logrus v1.0.0
github.com/containers/image 93bced01015eb94bec4821df1876314be8197680
github.com/docker/docker-credential-helpers d68f9aeca33f5fd3f08eeae5e9d175edf4e731d1
github.com/ostreedev/ostree-go master
github.com/ostreedev/ostree-go d0388bd827cfac6fa8eec760246eb8375674b2a0
github.com/containers/storage v1.11
github.com/containernetworking/cni v0.7.0-alpha1
github.com/containernetworking/plugins v0.7.5
google.golang.org/grpc 5b3c4e850e90a4cf6a20ebd46c8b32a0a3afcb9e https://github.com/grpc/grpc-go
google.golang.org/genproto 09f6ed296fc66555a25fe4ce95173148778dfa85
github.com/opencontainers/selinux 6ba084dd09db3dfe49a839bab0bbe97fd9274d80
github.com/opencontainers/selinux v1.2
github.com/opencontainers/go-digest c9281466c8b2f606084ac71339773efd177436e7
github.com/opencontainers/runtime-tools 1c243a8a8eb44d491790798afc9b634c6f6a6380
github.com/opencontainers/runc 10d38b660a77168360df3522881e2dc2be5056bd
github.com/mrunalp/fileutils master
github.com/vishvananda/netlink master
github.com/vishvananda/netns master
github.com/opencontainers/runc 11fc498ffa5c4561eef9242e7f7115d57e57055b
github.com/mrunalp/fileutils 7d4729fb36185a7c1719923406c9d40e54fb93c7
github.com/vishvananda/netlink v1.0.0
github.com/vishvananda/netns 13995c7128ccc8e51e9a6bd2b551020a27180abd
github.com/opencontainers/image-spec v1.0.0
github.com/opencontainers/runtime-spec eba862dc2470385a233c7507392675cbeadf7353 # v1.0.1-45-geba862d
github.com/tchap/go-patricia v2.2.6
Expand All @@ -53,21 +54,12 @@ github.com/seccomp/libseccomp-golang v0.9.0
github.com/syndtr/gocapability e7cb7fa329f456b3855136a2642b197bad7366ba
github.com/blang/semver v3.5.0
github.com/BurntSushi/toml v0.3.0
github.com/mitchellh/go-wordwrap ad45545899c7b13c020ea92b2072220eefad42b8
github.com/davecgh/go-spew v1.1.0
github.com/go-openapi/spec 6aced65f8501fe1217321abf0749d354824ba2ff
github.com/go-openapi/jsonpointer 779f45308c19820f1a69e9a4cd965f496e0da10f
github.com/go-openapi/jsonreference 36d33bfe519efae5632669801b180bf1a245da3b
github.com/go-openapi/swag 1d0bd113de87027671077d3c71eb3ac5d7dbba72
github.com/google/gofuzz 44d81051d367757e1c7c6a5a86423ece9afcf63c
github.com/mailru/easyjson 99e922cf9de1bc0ab38310c277cff32c2147e747
github.com/PuerkitoBio/purell v1.1.0
github.com/PuerkitoBio/urlesc 5bd2802263f21d8788851d5305584c82a5c75d7e
github.com/ugorji/go d23841a297e5489e787e72fceffabf9d2994b52a
github.com/spf13/pflag 9ff6c6923cfffbcd502984b8e0c80539a94968b7
golang.org/x/crypto 49796115aa4b964c318aad4f3084fdb41e9aa067
golang.org/x/net e147a9138326bc0e9d4e179541ffd8af41cff8a9
golang.org/x/sys 7ddbeae9ae08c6a06a59597f0c9edbc5ff2444ce
golang.org/x/sys c8c8c57fd1e1a977c10821a559dda983a9a9a3b5
golang.org/x/text 17bcc049122f272a32787ba38073ee47433023e9
golang.org/x/oauth2 a6bd8cefa1811bd24b86f8902872e4e8225f74c4
golang.org/x/sync 42b317875d0fa942474b76e1b46a6060d720ae6e
Expand All @@ -83,27 +75,16 @@ github.com/Azure/go-ansiterm 19f72df4d05d31cbe1c56bfc8045c96babff6c7e
github.com/Microsoft/go-winio 78439966b38d69bf38227fbf57ac8a6fee70f69a
github.com/Microsoft/hcsshim 43f9725307998e09f2e3816c2c0c36dc98f0c982
github.com/emicklei/go-restful ff4f55a206334ef123e4f79bbf348980da81ca46
github.com/emicklei/go-restful-swagger12 1.0.1
github.com/pkg/errors v0.8.0
github.com/godbus/dbus a389bdde4dd695d414e47b755e95e72b7826432c
github.com/urfave/cli v1.20.0
github.com/vbatts/tar-split v0.10.2
github.com/renstrom/dedent v1.0.0
github.com/hpcloud/tail v1.0.0
gopkg.in/fsnotify.v1 v1.4.2
gopkg.in/tomb.v1 v1
github.com/fatih/camelcase f6a740d52f961c60348ebb109adde9f4635d7540
github.com/buger/goterm 2f8dfbc7dbbff5dd1d391ed91482c24df243b2d3
github.com/dgrijalva/jwt-go v3.0.0
github.com/exponent-io/jsonpath d6023ce2651d8eafb5c75bb0c7167536102ec9f5
gopkg.in/tomb.v1 dd632973f1e7218eb1089048e0798ec9ae7dceb8
github.com/hashicorp/golang-lru a0d98a5f288019575c6d1f4bb1573fef2d1fcdc4
github.com/go-openapi/loads 18441dfa706d924a39a030ee2c3b1d8d81917b38
github.com/go-openapi/analysis b44dc874b601d9e4e2f6e19140e794ba24bead3b
github.com/go-openapi/strfmt 93a31ef21ac23f317792fff78f9539219dd74619
github.com/asaskevich/govalidator v6
github.com/go-openapi/errors d24ebc2075bad502fac3a8ae27aa6dd58e1952dc
github.com/mitchellh/mapstructure d0303fe809921458f417bcf828397a65db30a7e4
gopkg.in/mgo.v2 v2
gopkg.in/mgo.v2 9856a29383ce1c59f308dd1cf0363a79b5bef6b5
github.com/prometheus/client_golang e7e903064f5e9eb5da98208bae10b475d4db0f8c
github.com/prometheus/client_model fa8ad6fec33561be4280a8f0514318c79d7f6cb6
github.com/prometheus/common 13ba4ddd0caa9c28ca7b7bffe1dfa9ed8d5ef207
Expand All @@ -116,26 +97,33 @@ github.com/soheilhy/cmux v0.1.4
github.com/hashicorp/go-multierror 83588e72410abfbe4df460eeb6f30841ae47d4c4
github.com/hashicorp/errwrap 7554cd9344cec97297fa6649b055a8c98c2a1e55
github.com/pquerna/ffjson d49c2bc1aa135aad0c6f4fc2056623ec78f5d5ac
github.com/stretchr/testify 4d4bfba8f1d1027c4fdbe371823030df51419987
github.com/pmezard/go-difflib v1.0.0
github.com/xeipuuv/gojsonreference master
github.com/xeipuuv/gojsonschema master
github.com/xeipuuv/gojsonpointer master
github.com/xeipuuv/gojsonreference bd5ef7bd5415a7ac448318e64f11a24cd21e594b
github.com/xeipuuv/gojsonschema v1.1.0
github.com/xeipuuv/gojsonpointer 4e3ac2762d5f479393488629ee9370b50873b3a6
github.com/containerd/console 84eeaae905fa414d03e07bcd6c8d3f19e7cf180e
github.com/cyphar/filepath-securejoin v0.2.1
gopkg.in/square/go-jose.v2 89060dee6a84df9a4dae49f676f0c755037834f1
golang.org/x/time f51c12702a4d776e4c1fa9b0fabab841babae631
github.com/cri-o/ocicni v0.1.0
github.com/containers/libpod e75469ab99c48e9fbe2b36ade229d384bdea9144
github.com/cri-o/ocicni 2d2983e40c242322a56c22a903785e7f83eb378c
github.com/containers/buildah v1.7.1
github.com/seccomp/containers-golang v0.1
github.com/openshift/imagebuilder 36823496a6868f72bc36282cc475eb8a070c0934
github.com/fsouza/go-dockerclient 29c1814d12c072344bb91aac5d2ff719db39c523
vrothberg marked this conversation as resolved.
Show resolved Hide resolved
github.com/Nvveen/Gotty cd527374f1e5bff4938207604a14f2e38a9cf512
github.com/containers/libpod v1.1.2
github.com/docker/libnetwork 5f7a3f68c3d9696229cdc09b8cb3d84c06b13e4e
github.com/pmezard/go-difflib v1.0.0
github.com/fatih/camelcase f6a740d52f961c60348ebb109adde9f4635d7540
github.com/opentracing/opentracing-go 25a84ff92183e2f8ac018ba1db54f8a07b3c0e04
github.com/ulule/deepcopier ca99b135e50f526fde9cd88705f0ff2f3f95b77c
github.com/containerd/continuity d8fb8589b0e8e85b8c8bbaa8840226d0dfeb7371
github.com/modern-go/reflect2 05fbef0ca5da472bbf96c9322b84a53edc03c9fd
github.com/modern-go/concurrent bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94
github.com/ulikunitz/xz v0.5.4
github.com/klauspost/pgzip v1.2.1
github.com/klauspost/compress v1.4.1
github.com/klauspost/cpuid v1.2.0
github.com/boltdb/bolt master
github.com/checkpoint-restore/go-criu master
github.com/boltdb/bolt fd01fc79c553a8e99d512a07e8e0c63d4a3ccfc5
github.com/checkpoint-restore/go-criu v3.11
github.com/containers/psgo 5dde6da0bc8831b35243a847625bcf18183bd1ee
github.com/coreos/go-iptables 25d087f3cffd9aedc0c2b7eff25f23cbf3c20fe1
github.com/onsi/gomega v1.4.3
Expand Down
21 changes: 21 additions & 0 deletions vendor/github.com/Azure/go-ansiterm/LICENSE

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

12 changes: 12 additions & 0 deletions vendor/github.com/Azure/go-ansiterm/README.md

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