forked from containerd/cri
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add build-containerd.sh to build containerd from existing repo
Signed-off-by: Lantao Liu <[email protected]>
- Loading branch information
1 parent
0b8e906
commit a69f355
Showing
18 changed files
with
412 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2018 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. | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
source $(dirname "${BASH_SOURCE[0]}")/utils.sh | ||
CNI_DIR=${DESTDIR}/opt/cni | ||
CNI_CONFIG_DIR=${DESTDIR}/etc/cni/net.d | ||
CNI_PKG=github.com/containernetworking/plugins | ||
|
||
# Create a temporary GOPATH for cni installation. | ||
TMPGOPATH=$(mktemp -d /tmp/cri-install-cni.XXXX) | ||
GOPATH=${TMPGOPATH} | ||
|
||
# Install cni | ||
from-vendor CNI github.com/containernetworking/plugins | ||
checkout_repo ${CNI_PKG} ${CNI_VERSION} ${CNI_REPO} | ||
cd ${GOPATH}/src/${CNI_PKG} | ||
FASTBUILD=true ./build.sh | ||
${SUDO} mkdir -p ${CNI_DIR} | ||
${SUDO} cp -r ./bin ${CNI_DIR} | ||
${SUDO} mkdir -p ${CNI_CONFIG_DIR} | ||
${SUDO} bash -c 'cat >'${CNI_CONFIG_DIR}'/10-containerd-net.conflist <<EOF | ||
{ | ||
"cniVersion": "0.3.1", | ||
"name": "containerd-net", | ||
"plugins": [ | ||
{ | ||
"type": "bridge", | ||
"bridge": "cni0", | ||
"isGateway": true, | ||
"ipMasq": true, | ||
"promiscMode": true, | ||
"ipam": { | ||
"type": "host-local", | ||
"subnet": "10.88.0.0/16", | ||
"routes": [ | ||
{ "dst": "0.0.0.0/0" } | ||
] | ||
} | ||
}, | ||
{ | ||
"type": "portmap", | ||
"capabilities": {"portMappings": true} | ||
} | ||
] | ||
} | ||
EOF' | ||
|
||
# Clean the tmp GOPATH dir. | ||
rm -rf ${TMPGOPATH} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2018 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. | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
source $(dirname "${BASH_SOURCE[0]}")/utils.sh | ||
CONTAINERD_DIR=${DESTDIR}/usr/local | ||
CONTAINERD_PKG=github.com/containerd/containerd | ||
|
||
# CHECKOUT_CONTAINERD indicates whether to checkout containerd repo. | ||
# This is useful for build containerd from existing repo, currently | ||
# used by containerd CI test. | ||
CHECKOUT_CONTAINERD=${CHECKOUT_CONTAINERD:-true} | ||
|
||
if ${CHECKOUT_CONTAINERD}; then | ||
# Create a temporary GOPATH for containerd installation. | ||
TMPGOPATH=$(mktemp -d /tmp/cri-install-containerd.XXXX) | ||
GOPATH=${TMPGOPATH} | ||
from-vendor CONTAINERD github.com/containerd/containerd | ||
checkout_repo ${CONTAINERD_PKG} ${CONTAINERD_VERSION} ${CONTAINERD_REPO} | ||
fi | ||
|
||
# Install containerd | ||
cd ${GOPATH}/src/${CONTAINERD_PKG} | ||
make BUILDTAGS="${BUILDTAGS}" | ||
# containerd make install requires `go` to work. Explicitly | ||
# set PATH to make sure it can find `go` even with `sudo`. | ||
${SUDO} sh -c "PATH=${PATH} make install -e DESTDIR=${CONTAINERD_DIR}" | ||
|
||
# Clean the tmp GOPATH dir. | ||
if ${CHECKOUT_CONTAINERD}; then | ||
rm -rf ${TMPGOPATH} | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2018 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. | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
source $(dirname "${BASH_SOURCE[0]}")/utils.sh | ||
CRICTL_DIR=${DESTDIR}/usr/local/bin | ||
CRICTL_CONFIG_DIR=${DESTDIR}/etc | ||
|
||
# Create a temporary GOPATH for crictl installation. | ||
TMPGOPATH=$(mktemp -d /tmp/cri-install-crictl.XXXX) | ||
GOPATH=${TMPGOPATH} | ||
|
||
#Install crictl | ||
checkout_repo ${CRITOOL_PKG} ${CRITOOL_VERSION} ${CRITOOL_REPO} | ||
cd ${GOPATH}/src/${CRITOOL_PKG} | ||
make crictl | ||
${SUDO} make install-crictl -e BINDIR=${CRICTL_DIR} GOPATH=${GOPATH} | ||
${SUDO} mkdir -p ${CRICTL_CONFIG_DIR} | ||
${SUDO} bash -c 'cat >'${CRICTL_CONFIG_DIR}'/crictl.yaml <<EOF | ||
runtime-endpoint: /run/containerd/containerd.sock | ||
EOF' | ||
|
||
# Clean the tmp GOPATH dir. | ||
rm -rf ${TMPGOPATH} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2017 The Kubernetes 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. | ||
|
||
# Dependencies: | ||
# runc: | ||
# - libseccomp-dev(Ubuntu,Debian)/libseccomp-devel(Fedora, CentOS, RHEL). Note that | ||
# libseccomp in ubuntu <=trusty and debian <=jessie is not new enough, backport | ||
# is required. | ||
# - libapparmor-dev(Ubuntu,Debian)/libapparmor-devel(Fedora, CentOS, RHEL) | ||
# containerd: | ||
# - btrfs-tools(Ubuntu,Debian)/btrfs-progs-devel(Fedora, CentOS, RHEL) | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
cd $(dirname "${BASH_SOURCE[0]}") | ||
|
||
# INSTALL_CNI indicates whether to install CNI. CNI installation | ||
# makes sense for local testing, but doesn't make sense for cluster | ||
# setup, because CNI daemonset is usually used to deploy CNI binaries | ||
# and configurations in cluster. | ||
INSTALL_CNI=${INSTALL_CNI:-true} | ||
|
||
# Install runc | ||
./install-runc.sh | ||
|
||
# Install cni | ||
if ${INSTALL_CNI}; then | ||
./install-cni.sh | ||
fi | ||
|
||
# Install containerd | ||
./install-containerd.sh | ||
|
||
#Install crictl | ||
./install-crictl.sh |
Oops, something went wrong.