From 4cc8bafa20790bebc93b162412a6548a57461a9e Mon Sep 17 00:00:00 2001 From: Lantao Liu Date: Fri, 15 Nov 2019 10:27:26 -0800 Subject: [PATCH 1/3] Update vendors. Signed-off-by: Lantao Liu --- vendor.conf | 4 ++-- .../grpc/internal/transport/http2_server.go | 5 ++++- .../google.golang.org/grpc/internal/transport/http_util.go | 1 + vendor/google.golang.org/grpc/version.go | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/vendor.conf b/vendor.conf index cabd66f7b..af0aac231 100644 --- a/vendor.conf +++ b/vendor.conf @@ -7,10 +7,10 @@ github.com/docker/distribution 0d3efadf0154c2b8a4e7b6621fff9809655cc580 # containerd dependencies go.opencensus.io v0.22.0 go.etcd.io/bbolt v1.3.3 -google.golang.org/grpc 6eaf6f47437a6b4e2153a190160ef39a92c7eceb # v1.23.0 +google.golang.org/grpc 39e8a7b072a67ca2a75f57fa2e0d50995f5b22f6 # v1.23.1 google.golang.org/genproto d80a6e20e776b0b17a324d0ba1ab50a39c8e8944 golang.org/x/text 19e51611da83d6be54ddafce4a4af510cb3e9ea4 -golang.org/x/sys c990c680b611ac1aeb7d8f2af94a825f98d69720 https://github.com/golang/sys # TODO(windows): update this in containerd/containerd +golang.org/x/sys c990c680b611ac1aeb7d8f2af94a825f98d69720 https://github.com/golang/sys golang.org/x/sync 42b317875d0fa942474b76e1b46a6060d720ae6e golang.org/x/net f3200d17e092c607f615320ecaad13d87ad9a2b3 github.com/urfave/cli 7bc6a0acffa589f415f88aca16cc1de5ffd66f9c diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_server.go b/vendor/google.golang.org/grpc/internal/transport/http2_server.go index 83439b562..4e26f6a1d 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http2_server.go +++ b/vendor/google.golang.org/grpc/internal/transport/http2_server.go @@ -138,7 +138,10 @@ func newHTTP2Server(conn net.Conn, config *ServerConfig) (_ ServerTransport, err } framer := newFramer(conn, writeBufSize, readBufSize, maxHeaderListSize) // Send initial settings as connection preface to client. - var isettings []http2.Setting + isettings := []http2.Setting{{ + ID: http2.SettingMaxFrameSize, + Val: http2MaxFrameLen, + }} // TODO(zhaoq): Have a better way to signal "no limit" because 0 is // permitted in the HTTP2 spec. maxStreams := config.MaxStreams diff --git a/vendor/google.golang.org/grpc/internal/transport/http_util.go b/vendor/google.golang.org/grpc/internal/transport/http_util.go index 9d212867c..8f5f3349d 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http_util.go +++ b/vendor/google.golang.org/grpc/internal/transport/http_util.go @@ -667,6 +667,7 @@ func newFramer(conn net.Conn, writeBufferSize, readBufferSize int, maxHeaderList writer: w, fr: http2.NewFramer(w, r), } + f.fr.SetMaxReadFrameSize(http2MaxFrameLen) // Opt-in to Frame reuse API on framer to reduce garbage. // Frames aren't safe to read from after a subsequent call to ReadFrame. f.fr.SetReuseFrames() diff --git a/vendor/google.golang.org/grpc/version.go b/vendor/google.golang.org/grpc/version.go index 5411a73a2..588850563 100644 --- a/vendor/google.golang.org/grpc/version.go +++ b/vendor/google.golang.org/grpc/version.go @@ -19,4 +19,4 @@ package grpc // Version is the current grpc version. -const Version = "1.23.0" +const Version = "1.23.1" From a60143be5b1f27dc71a149cc464a70127171c4fd Mon Sep 17 00:00:00 2001 From: Lantao Liu Date: Fri, 15 Nov 2019 10:27:55 -0800 Subject: [PATCH 2/3] Add `GOOS=windows make release` support. Signed-off-by: Lantao Liu --- Makefile | 22 ++++--- hack/install/utils.sh | 7 +- hack/install/windows/install-cni-config.sh | 2 +- hack/install/windows/install-cni.sh | 8 ++- hack/install/windows/install-hcsshim.sh | 2 +- hack/release-windows.sh | 75 ++++++++++++++++++++++ hack/release.sh | 4 ++ 7 files changed, 104 insertions(+), 16 deletions(-) create mode 100755 hack/release-windows.sh diff --git a/Makefile b/Makefile index 8545fa1f8..304080843 100644 --- a/Makefile +++ b/Makefile @@ -39,8 +39,9 @@ SOURCES := $(shell find cmd/ pkg/ vendor/ -name '*.go') PLUGIN_SOURCES := $(shell ls *.go) INTEGRATION_SOURCES := $(shell find integration/ -name '*.go') +CONTAINERD_BIN := containerd ifeq ($(GOOS),windows) - BIN_EXT := .exe + CONTAINERD_BIN := $(CONTAINERD_BIN).exe endif all: binaries @@ -82,9 +83,9 @@ sync-vendor: update-vendor: sync-vendor sort-vendor ## Syncs containerd/vendor.conf -> vendor.conf and sorts vendor.conf @echo "$(WHALE) $@" -$(BUILD_DIR)/containerd: $(SOURCES) $(PLUGIN_SOURCES) +$(BUILD_DIR)/$(CONTAINERD_BIN): $(SOURCES) $(PLUGIN_SOURCES) @echo "$(WHALE) $@" - $(GO) build -o $@$(BIN_EXT) \ + $(GO) build -o $@ \ -tags '$(BUILD_TAGS)' \ -ldflags '$(GO_LDFLAGS)' \ -gcflags '$(GO_GCFLAGS)' \ @@ -117,29 +118,34 @@ clean: ## cleanup binaries @echo "$(WHALE) $@" @rm -rf $(BUILD_DIR)/* -binaries: $(BUILD_DIR)/containerd ## build a customized containerd (same result as make containerd) +binaries: $(BUILD_DIR)/$(CONTAINERD_BIN) ## build a customized containerd (same result as make containerd) @echo "$(WHALE) $@" static-binaries: GO_LDFLAGS += -extldflags "-fno-PIC -static" -static-binaries: $(BUILD_DIR)/containerd ## build static containerd +static-binaries: $(BUILD_DIR)/$(CONTAINERD_BIN) ## build static containerd @echo "$(WHALE) $@" -containerd: $(BUILD_DIR)/containerd ## build a customized containerd with CRI plugin for testing +containerd: $(BUILD_DIR)/$(CONTAINERD_BIN) ## build a customized containerd with CRI plugin for testing @echo "$(WHALE) $@" install-containerd: containerd ## installs customized containerd to system location @echo "$(WHALE) $@" - @install -D -m 755 $(BUILD_DIR)/containerd "$(BINDIR)/containerd" + @install -D -m 755 $(BUILD_DIR)/$(CONTAINERD_BIN) "$(BINDIR)/$(CONTAINERD_BIN)" install: install-containerd ## installs customized containerd to system location @echo "$(WHALE) $@" uninstall: ## remove containerd from system location @echo "$(WHALE) $@" - @rm -f "$(BINDIR)/containerd" + @rm -f "$(BINDIR)/$(CONTAINERD_BIN)" +ifeq ($(GOOS),windows) +$(BUILD_DIR)/$(TARBALL): static-binaries vendor.conf + @BUILD_DIR=$(BUILD_DIR) TARBALL=$(TARBALL) VERSION=$(VERSION) ./hack/release-windows.sh +else $(BUILD_DIR)/$(TARBALL): static-binaries vendor.conf @BUILD_DIR=$(BUILD_DIR) TARBALL=$(TARBALL) VERSION=$(VERSION) ./hack/release.sh +endif release: $(BUILD_DIR)/$(TARBALL) ## build release tarball diff --git a/hack/install/utils.sh b/hack/install/utils.sh index 69a6ea51e..c95b456d8 100755 --- a/hack/install/utils.sh +++ b/hack/install/utils.sh @@ -16,11 +16,12 @@ source $(dirname "${BASH_SOURCE[0]}")/../utils.sh -# DESTDIR is the dest path to install dependencies. +# DESTDIR is the absolute dest path to install dependencies. DESTDIR=${DESTDIR:-"/"} -# Convert to absolute path if it's relative. +# Make sure that DESTDIR is an absolute path. if [[ ${DESTDIR} != /* ]]; then - DESTDIR=${ROOT}/${DESTDIR} + echo "DESTDIR is not an absolute path" + exit 1 fi # NOSUDO indicates not to use sudo during installation. diff --git a/hack/install/windows/install-cni-config.sh b/hack/install/windows/install-cni-config.sh index 395292026..a2313bc6b 100755 --- a/hack/install/windows/install-cni-config.sh +++ b/hack/install/windows/install-cni-config.sh @@ -74,7 +74,7 @@ bash -c 'cat >"'"${CNI_CONFIG_DIR}"'"/0-containerd-nat.conf < ${tarball}.sha256 diff --git a/hack/release.sh b/hack/release.sh index 6c07a686f..fe99652aa 100755 --- a/hack/release.sh +++ b/hack/release.sh @@ -26,6 +26,10 @@ umask 0022 # BUILD_DIR is the directory to generate release tar. # TARBALL is the name of the release tar. BUILD_DIR=${BUILD_DIR:-"_output"} +# Convert to absolute path if it's relative. +if [[ ${BUILD_DIR} != /* ]]; then + BUILD_DIR=${ROOT}/${BUILD_DIR} +fi TARBALL=${TARBALL:-"cri-containerd.tar.gz"} # INCLUDE_CNI indicates whether to install CNI. By default don't # include CNI in release tarball. From 0cb707e5f605cc8d78b0a8d33421eb807afdbd1e Mon Sep 17 00:00:00 2001 From: Lantao Liu Date: Fri, 15 Nov 2019 17:26:31 -0800 Subject: [PATCH 3/3] Add build script, this will be used in CI. Signed-off-by: Lantao Liu --- test/windows/build.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 test/windows/build.sh diff --git a/test/windows/build.sh b/test/windows/build.sh new file mode 100755 index 000000000..29d57a7bb --- /dev/null +++ b/test/windows/build.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# 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. + +# This script is used to build and upload containerd with latest CRI plugin +# from containerd/cri in gcr.io/k8s-testimages/kubekins-e2e. + +set -o xtrace +set -o errexit +set -o nounset +set -o pipefail + +source $(dirname "${BASH_SOURCE[0]}")/../build-utils.sh +cd "${ROOT}" + +# Make sure output directory is clean. +GOOS=windows make clean +# Build and push test tarball. +PUSH_VERSION=true DEPLOY_DIR=${DEPLOY_DIR:-"windows"} GOOS=windows \ + make push TARBALL_PREFIX=cri-containerd-cni INCLUDE_CNI=true CUSTOM_CONTAINERD=true