mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 04:33:26 +00:00
Build runtime Docker images.
Also added release process to push these images to GCS.
This commit is contained in:
parent
46764ab4aa
commit
4547cee6cb
@ -20,4 +20,4 @@ set -e
|
|||||||
|
|
||||||
source $(dirname $0)/common.sh
|
source $(dirname $0)/common.sh
|
||||||
|
|
||||||
make-binaries
|
make-binaries "$@"
|
||||||
|
@ -21,11 +21,13 @@ source $(dirname $0)/common.sh
|
|||||||
ETCD_DIR="${KUBE_REPO_ROOT}/output/etcd"
|
ETCD_DIR="${KUBE_REPO_ROOT}/output/etcd"
|
||||||
mkdir -p "${ETCD_DIR}"
|
mkdir -p "${ETCD_DIR}"
|
||||||
|
|
||||||
|
echo "+++ Running integration test"
|
||||||
|
|
||||||
etcd -name test -data-dir ${ETCD_DIR} > "${KUBE_REPO_ROOT}/output/etcd.log" &
|
etcd -name test -data-dir ${ETCD_DIR} > "${KUBE_REPO_ROOT}/output/etcd.log" &
|
||||||
ETCD_PID=$!
|
ETCD_PID=$!
|
||||||
|
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
${KUBE_TARGET}/integration
|
${KUBE_TARGET}/linux/amd64/integration
|
||||||
|
|
||||||
kill $ETCD_PID
|
kill $ETCD_PID
|
||||||
|
@ -33,6 +33,8 @@ find_test_dirs() {
|
|||||||
|
|
||||||
cd "${KUBE_TARGET}"
|
cd "${KUBE_TARGET}"
|
||||||
|
|
||||||
|
echo "+++ Running unit tests"
|
||||||
|
|
||||||
if [[ -n "$1" ]]; then
|
if [[ -n "$1" ]]; then
|
||||||
go test -cover -coverprofile="tmp.out" "$KUBE_GO_PACKAGE/$1"
|
go test -cover -coverprofile="tmp.out" "$KUBE_GO_PACKAGE/$1"
|
||||||
exit 0
|
exit 0
|
||||||
|
165
build/common.sh
165
build/common.sh
@ -37,26 +37,34 @@ readonly REMOTE_OUTPUT_DIR="/go/src/${KUBE_GO_PACKAGE}/output/build"
|
|||||||
readonly DOCKER_CONTAINER_NAME=kube-build
|
readonly DOCKER_CONTAINER_NAME=kube-build
|
||||||
readonly DOCKER_MOUNT="-v ${LOCAL_OUTPUT_DIR}:${REMOTE_OUTPUT_DIR}"
|
readonly DOCKER_MOUNT="-v ${LOCAL_OUTPUT_DIR}:${REMOTE_OUTPUT_DIR}"
|
||||||
|
|
||||||
# Verify that the right utilitites and such are installed.
|
readonly KUBE_RUN_IMAGE_BASE="kubernetes"
|
||||||
if [[ -z "$(which docker)" ]]; then
|
readonly KUBE_RUN_BINARIES="
|
||||||
|
apiserver
|
||||||
|
controller-manager
|
||||||
|
proxy
|
||||||
|
"
|
||||||
|
|
||||||
|
# Verify that the right utilities and such are installed for building Kube.
|
||||||
|
function verify-prereqs() {
|
||||||
|
if [[ -z "$(which docker)" ]]; then
|
||||||
echo "Can't find 'docker' in PATH, please fix and retry." >&2
|
echo "Can't find 'docker' in PATH, please fix and retry." >&2
|
||||||
echo "See https://docs.docker.com/installation/#installation for installation instructions." >&2
|
echo "See https://docs.docker.com/installation/#installation for installation instructions." >&2
|
||||||
exit 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
if [[ -z "$(which boot2docker)" ]]; then
|
if [[ -z "$(which boot2docker)" ]]; then
|
||||||
echo "It looks like you are running on Mac OS X and boot2docker can't be found." >&2
|
echo "It looks like you are running on Mac OS X and boot2docker can't be found." >&2
|
||||||
echo "See: https://docs.docker.com/installation/mac/" >&2
|
echo "See: https://docs.docker.com/installation/mac/" >&2
|
||||||
exit 1
|
return 1
|
||||||
fi
|
fi
|
||||||
if [[ $(boot2docker status) != "running" ]]; then
|
if [[ $(boot2docker status) != "running" ]]; then
|
||||||
echo "boot2docker VM isn't started. Please run 'boot2docker start'" >&2
|
echo "boot2docker VM isn't started. Please run 'boot2docker start'" >&2
|
||||||
exit 1
|
return 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
if ! docker info > /dev/null 2>&1 ; then
|
if ! docker info > /dev/null 2>&1 ; then
|
||||||
echo "Can't connect to 'docker' daemon. please fix and retry." >&2
|
echo "Can't connect to 'docker' daemon. please fix and retry." >&2
|
||||||
echo >&2
|
echo >&2
|
||||||
echo "Possible causes:" >&2
|
echo "Possible causes:" >&2
|
||||||
@ -64,12 +72,60 @@ if ! docker info > /dev/null 2>&1 ; then
|
|||||||
echo " - On Mac OS X, DOCKER_HOST env variable isn't set approriately" >&2
|
echo " - On Mac OS X, DOCKER_HOST env variable isn't set approriately" >&2
|
||||||
echo " - On Linux, user isn't in 'docker' group. Add and relogin." >&2
|
echo " - On Linux, user isn't in 'docker' group. Add and relogin." >&2
|
||||||
echo " - On Linux, Docker daemon hasn't been started or has crashed" >&2
|
echo " - On Linux, Docker daemon hasn't been started or has crashed" >&2
|
||||||
exit 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Verify things are set up for uploading to GCS
|
||||||
|
function verify-gcs-prereqs() {
|
||||||
|
if [[ -z "$(which gsutil)" || -z "$(which gcloud)" ]]; then
|
||||||
|
echo "Releasing Kubernetes requires gsutil and gcloud. Please download,"
|
||||||
|
echo "install and authorize through the Google Cloud SDK: "
|
||||||
|
echo
|
||||||
|
echo " https://developers.google.com/cloud/sdk/"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
FIND_ACCOUNT="gcloud auth list 2>/dev/null | grep '(active)' | awk '{ print \$2 }'"
|
||||||
|
GCLOUD_ACCOUNT=${GCLOUD_ACCOUNT-$(eval ${FIND_ACCOUNT})}
|
||||||
|
if [[ -z "${GCLOUD_ACCOUNT}" ]]; then
|
||||||
|
echo "No account authorized through gcloud. Please fix with:"
|
||||||
|
echo
|
||||||
|
echo " gcloud auth login"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
FIND_PROJECT="gcloud config list project | tail -n 1 | awk '{ print \$3 }'"
|
||||||
|
GCLOUD_PROJECT=${GCLOUD_PROJECT-$(eval ${FIND_PROJECT})}
|
||||||
|
if [[ -z "${GCLOUD_PROJECT}" ]]; then
|
||||||
|
echo "No account authorized through gcloud. Please fix with:"
|
||||||
|
echo
|
||||||
|
echo " gcloud config set project <project id>"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create a unique bucket name for releasing Kube and make sure it exists.
|
||||||
|
function ensure-gcs-release-bucket() {
|
||||||
|
if which md5 > /dev/null; then
|
||||||
|
HASH=$(md5 -q -s "$GCLOUD_PROJECT")
|
||||||
|
else
|
||||||
|
HASH=$(echo -n "$GCLOUD_PROJECT" | md5sum)
|
||||||
|
fi
|
||||||
|
HASH=${HASH:0:5}
|
||||||
|
KUBE_RELEASE_BUCKET=${KUBE_RELEASE_BUCKET-kubernetes-releases-$HASH}
|
||||||
|
KUBE_RELEASE_PREFIX=${KUBE_RELEASE_PREFIX-devel/}
|
||||||
|
DOCKER_REG_PREFIX=${DOCKER_REG_PREFIX-docker-reg/}
|
||||||
|
|
||||||
|
if ! gsutil ls gs://${KUBE_RELEASE_BUCKET} >/dev/null 2>&1 ; then
|
||||||
|
echo "Creating Google Cloud Storage bucket: $RELEASE_BUCKET"
|
||||||
|
gsutil mb gs://${KUBE_RELEASE_BUCKET}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Set up the context directory for the kube-build image and build it.
|
# Set up the context directory for the kube-build image and build it.
|
||||||
function build-image() {
|
function build-image() {
|
||||||
local -r BUILD_CONTEXT_DIR=${KUBE_REPO_ROOT}/output/build-image
|
local -r BUILD_CONTEXT_DIR="${KUBE_REPO_ROOT}/output/images/${KUBE_BUILD_IMAGE}"
|
||||||
local -r SOURCE="
|
local -r SOURCE="
|
||||||
api
|
api
|
||||||
build
|
build
|
||||||
@ -79,19 +135,47 @@ function build-image() {
|
|||||||
third_party
|
third_party
|
||||||
LICENSE
|
LICENSE
|
||||||
"
|
"
|
||||||
local -r DOCKER_BUILD_CMD="docker build -t ${KUBE_BUILD_IMAGE} ${BUILD_CONTEXT_DIR}"
|
|
||||||
|
|
||||||
echo "+++ Building Docker image ${KUBE_BUILD_IMAGE}. First run can take minutes."
|
|
||||||
|
|
||||||
mkdir -p ${BUILD_CONTEXT_DIR}
|
mkdir -p ${BUILD_CONTEXT_DIR}
|
||||||
tar czf ${BUILD_CONTEXT_DIR}/kube-source.tar.gz ${SOURCE}
|
tar czf ${BUILD_CONTEXT_DIR}/kube-source.tar.gz ${SOURCE}
|
||||||
cp build/build-image/Dockerfile ${BUILD_CONTEXT_DIR}/Dockerfile
|
cp build/build-image/Dockerfile ${BUILD_CONTEXT_DIR}/Dockerfile
|
||||||
|
docker-build "${KUBE_BUILD_IMAGE}" "${BUILD_CONTEXT_DIR}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Builds the runtime image. Assumes that the appropriate binaries are already
|
||||||
|
# built and in output/build/.
|
||||||
|
function run-image() {
|
||||||
|
local -r BUILD_CONTEXT_BASE="${KUBE_REPO_ROOT}/output/images/${KUBE_RUN_IMAGE_BASE}"
|
||||||
|
|
||||||
|
# First build the base image. This one brings in all of the binaries.
|
||||||
|
mkdir -p "${BUILD_CONTEXT_BASE}"
|
||||||
|
tar czf ${BUILD_CONTEXT_BASE}/kube-bins.tar.gz \
|
||||||
|
-C "output/build/linux/amd64" \
|
||||||
|
${KUBE_RUN_BINARIES}
|
||||||
|
cp -R build/run-images/base/* "${BUILD_CONTEXT_BASE}/"
|
||||||
|
docker-build "${KUBE_RUN_IMAGE_BASE}" "${BUILD_CONTEXT_BASE}"
|
||||||
|
|
||||||
|
for b in $KUBE_RUN_BINARIES ; do
|
||||||
|
local SUB_CONTEXT_DIR="${BUILD_CONTEXT_BASE}-$b"
|
||||||
|
mkdir -p "${SUB_CONTEXT_DIR}"
|
||||||
|
cp -R build/run-images/$b/* "${SUB_CONTEXT_DIR}/"
|
||||||
|
docker-build "${KUBE_RUN_IMAGE_BASE}-$b" "${SUB_CONTEXT_DIR}"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Build a docker image from a Dockerfile.
|
||||||
|
# $1 is the name of the image to build
|
||||||
|
# $2 is the location of the "context" directory, with the Dockerfile at the root.
|
||||||
|
function docker-build() {
|
||||||
|
local -r IMAGE=$1
|
||||||
|
local -r CONTEXT_DIR=$2
|
||||||
|
local -r BUILD_CMD="docker build -t ${IMAGE} ${CONTEXT_DIR}"
|
||||||
|
|
||||||
|
echo "+++ Building Docker image ${IMAGE}. This can take a while."
|
||||||
set +e # We are handling the error here manually
|
set +e # We are handling the error here manually
|
||||||
local -r DOCKER_OUTPUT="$(${DOCKER_BUILD_CMD} 2>&1)"
|
local -r DOCKER_OUTPUT="$(${BUILD_CMD} 2>&1)"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
set -e
|
set -e
|
||||||
echo "+++ Docker build command failed." >&2
|
echo "+++ Docker build command failed for ${IMAGE}" >&2
|
||||||
echo >&2
|
echo >&2
|
||||||
echo "${DOCKER_OUTPUT}" >&2
|
echo "${DOCKER_OUTPUT}" >&2
|
||||||
echo >&2
|
echo >&2
|
||||||
@ -102,7 +186,52 @@ function build-image() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
set -e
|
set -e
|
||||||
|
}
|
||||||
|
|
||||||
|
function ensure-gcs-docker-registry() {
|
||||||
|
local -r REG_CONTAINER_NAME="gcs-registry"
|
||||||
|
|
||||||
|
local -r RUNNING=$(docker inspect ${REG_CONTAINER_NAME} 2>/dev/null \
|
||||||
|
| build/json-extractor.py 0.State.Running 2>/dev/null)
|
||||||
|
|
||||||
|
[[ "$RUNNING" != "true" ]] || return 0
|
||||||
|
|
||||||
|
# Grovel around and find the OAuth token in the gcloud config
|
||||||
|
local -r BOTO=~/.config/gcloud/legacy_credentials/${GCLOUD_ACCOUNT}/.boto
|
||||||
|
local -r REFRESH_TOKEN=$(grep 'gs_oauth2_refresh_token =' $BOTO | awk '{ print $3 }')
|
||||||
|
|
||||||
|
if [[ -z $REFRESH_TOKEN ]]; then
|
||||||
|
echo "Couldn't find OAuth 2 refresh token in ${BOTO}" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If we have an old one sitting around, remove it
|
||||||
|
docker rm ${REG_CONTAINER_NAME} >/dev/null 2>&1 || true
|
||||||
|
|
||||||
|
echo "+++ Starting GCS backed Docker registry"
|
||||||
|
local DOCKER="docker run -d --name=${REG_CONTAINER_NAME} "
|
||||||
|
DOCKER+="-e GCS_BUCKET=${KUBE_RELEASE_BUCKET} "
|
||||||
|
DOCKER+="-e STORAGE_PATH=${DOCKER_REG_PREFIX} "
|
||||||
|
DOCKER+="-e GCP_OAUTH2_REFRESH_TOKEN=${REFRESH_TOKEN} "
|
||||||
|
DOCKER+="-p 127.0.0.1:5000:5000 "
|
||||||
|
DOCKER+="jbeda/docker-registry"
|
||||||
|
|
||||||
|
${DOCKER}
|
||||||
|
|
||||||
|
# Give it time to spin up before we start throwing stuff at it
|
||||||
|
sleep 5
|
||||||
|
}
|
||||||
|
|
||||||
|
function push-images-to-gcs() {
|
||||||
|
ensure-gcs-docker-registry
|
||||||
|
|
||||||
|
# Tag each of our run binaries with the right registry and push
|
||||||
|
for b in ${KUBE_RUN_BINARIES} ; do
|
||||||
|
echo "+++ Tagging and pushing ${KUBE_RUN_IMAGE_BASE}-$b"
|
||||||
|
docker tag "${KUBE_RUN_IMAGE_BASE}-$b" "localhost:5000/${KUBE_RUN_IMAGE_BASE}-$b"
|
||||||
|
docker push "localhost:5000/${KUBE_RUN_IMAGE_BASE}-$b"
|
||||||
|
docker rmi "localhost:5000/${KUBE_RUN_IMAGE_BASE}-$b"
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Run a command in the kube-build image. This assumes that the image has
|
# Run a command in the kube-build image. This assumes that the image has
|
||||||
|
@ -14,13 +14,14 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
# Make all of the Kubernetes binaries.
|
# Copies any built binaries off the Docker machine.
|
||||||
#
|
#
|
||||||
# This makes the docker build image, builds the binaries and copies them out
|
# This is a no-op on Linux when the Docker daemon is local. This is only
|
||||||
# of the docker container.
|
# necessary on Mac OS X with boot2docker.
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
source $(dirname $0)/common.sh
|
source $(dirname $0)/common.sh
|
||||||
|
|
||||||
|
verify-prereqs
|
||||||
copy-output
|
copy-output
|
||||||
|
70
build/json-extractor.py
Executable file
70
build/json-extractor.py
Executable file
@ -0,0 +1,70 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
# Copyright 2014 Google Inc. All rights reserved.
|
||||||
|
#
|
||||||
|
# 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 is a very simple utility that reads a JSON document from stdin, parses it
|
||||||
|
# and returns the specified value. The value is described using a simple dot
|
||||||
|
# notation. If any errors are encountered along the way, an error is output and
|
||||||
|
# a failure value is returned.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
|
||||||
|
def PrintError(*err):
|
||||||
|
print(*err, file=sys.stderr)
|
||||||
|
|
||||||
|
def main():
|
||||||
|
try:
|
||||||
|
obj = json.load(sys.stdin)
|
||||||
|
except Exception, e:
|
||||||
|
PrintError("Error loading JSON: {0}".format(str(e)))
|
||||||
|
|
||||||
|
if len(sys.argv) == 1:
|
||||||
|
# if we don't have a query string, return success
|
||||||
|
return 0
|
||||||
|
elif len(sys.argv) > 2:
|
||||||
|
PrintError("Usage: {0} <json query>".format(sys.args[0]))
|
||||||
|
return 1
|
||||||
|
|
||||||
|
query_list = sys.argv[1].split('.')
|
||||||
|
for q in query_list:
|
||||||
|
if isinstance(obj, dict):
|
||||||
|
if q not in obj:
|
||||||
|
PrintError("Couldn't find '{0}' in dict".format(q))
|
||||||
|
return 1
|
||||||
|
obj = obj[q]
|
||||||
|
elif isinstance(obj, list):
|
||||||
|
try:
|
||||||
|
index = int(q)
|
||||||
|
except:
|
||||||
|
PrintError("Can't use '{0}' to index into array".format(q))
|
||||||
|
return 1
|
||||||
|
if index >= len(obj):
|
||||||
|
PrintError("Index ({0}) is greater than length of list ({1})".format(q, len(obj)))
|
||||||
|
return 1
|
||||||
|
obj = obj[index]
|
||||||
|
else:
|
||||||
|
PrintError("Trying to query non-queryable object: {0}".format(q))
|
||||||
|
return 1
|
||||||
|
|
||||||
|
if isinstance(obj, str):
|
||||||
|
print(obj)
|
||||||
|
else:
|
||||||
|
print(json.dumps(obj, indent=2))
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main())
|
@ -23,5 +23,6 @@ set -e
|
|||||||
|
|
||||||
source $(dirname $0)/common.sh
|
source $(dirname $0)/common.sh
|
||||||
|
|
||||||
|
verify-prereqs
|
||||||
build-image
|
build-image
|
||||||
run-build-command build/build-image/make-binaries.sh "$@"
|
run-build-command build/build-image/make-binaries.sh "$@"
|
||||||
|
@ -25,4 +25,5 @@ set -e
|
|||||||
|
|
||||||
source $(dirname $0)/common.sh
|
source $(dirname $0)/common.sh
|
||||||
|
|
||||||
|
verify-prereqs
|
||||||
build-image
|
build-image
|
||||||
|
@ -14,14 +14,12 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
# Make all of the Kubernetes binaries.
|
# Clean out the output directory on the docker host.
|
||||||
#
|
|
||||||
# This makes the docker build image, builds the binaries and copies them out
|
|
||||||
# of the docker container.
|
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
source $(dirname $0)/common.sh
|
source $(dirname $0)/common.sh
|
||||||
|
|
||||||
|
verify-prereqs
|
||||||
build-image
|
build-image
|
||||||
run-build-command rm -rf output/build/*
|
run-build-command rm -rf output/build/*
|
||||||
|
@ -14,14 +14,15 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
# Make all of the Kubernetes binaries.
|
# Make all of the Kubernetes binaries for cross compile targets
|
||||||
#
|
#
|
||||||
# This makes the docker build image, builds the binaries and copies them out
|
# This makes the docker build image, builds the cross binaries and copies them
|
||||||
# of the docker container.
|
# out of the docker container.
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
source $(dirname $0)/common.sh
|
source $(dirname $0)/common.sh
|
||||||
|
|
||||||
|
verify-prereqs
|
||||||
build-image
|
build-image
|
||||||
run-build-command build/build-image/make-cross.sh
|
run-build-command build/build-image/make-cross.sh
|
||||||
|
30
build/make-run-image.sh
Executable file
30
build/make-run-image.sh
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
# Copyright 2014 Google Inc. All rights reserved.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
# Build the docker image necessary for running Kubernetes
|
||||||
|
#
|
||||||
|
# This script will make the 'run image' after building all of the necessary
|
||||||
|
# binaries.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
source $(dirname $0)/common.sh
|
||||||
|
|
||||||
|
verify-prereqs
|
||||||
|
build-image
|
||||||
|
run-build-command build/build-image/make-binaries.sh "$@"
|
||||||
|
copy-output
|
||||||
|
run-image
|
35
build/release.sh
Executable file
35
build/release.sh
Executable file
@ -0,0 +1,35 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
# Copyright 2014 Google Inc. All rights reserved.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
# Build a Kubernetes release. This will build the binaries, create the Docker
|
||||||
|
# images and other build artifacts. All intermediate artifacts will be hosted
|
||||||
|
# publicly on Google Cloud Storage currently.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
source $(dirname $0)/common.sh
|
||||||
|
|
||||||
|
verify-prereqs
|
||||||
|
verify-gcs-prereqs
|
||||||
|
ensure-gcs-release-bucket
|
||||||
|
build-image
|
||||||
|
run-build-command build/build-image/make-binaries.sh
|
||||||
|
run-build-command build/build-image/make-cross.sh
|
||||||
|
run-build-command build/build-image/run-tests.sh
|
||||||
|
run-build-command build/build-image/run-integration.sh
|
||||||
|
copy-output
|
||||||
|
run-image
|
||||||
|
push-images-to-gcs
|
25
build/run-images/apiserver/Dockerfile
Normal file
25
build/run-images/apiserver/Dockerfile
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# Copyright 2014 Google Inc. All rights reserved.
|
||||||
|
#
|
||||||
|
# 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 file creates a minimal container for running Kubernetes binaries
|
||||||
|
|
||||||
|
FROM kubernetes
|
||||||
|
MAINTAINER Joe Beda <jbeda@google.com>
|
||||||
|
|
||||||
|
ENV ETCD_SERVERS http://127.0.0.1:4001
|
||||||
|
ENV KUBE_MINIONS ""
|
||||||
|
|
||||||
|
ADD . /kubernetes
|
||||||
|
|
||||||
|
CMD ['./run.sh']
|
21
build/run-images/apiserver/run.sh
Executable file
21
build/run-images/apiserver/run.sh
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
# Copyright 2014 Google Inc. All rights reserved.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
# If the user doesn't specify a minion, assume we are running in a single node
|
||||||
|
# configuration and that we have a local minion.
|
||||||
|
KUBE_MINIONS=${KUBE_MINIONS:$(hostname -f)}
|
||||||
|
|
||||||
|
./apiserver -master=127.0.0.1:8080 -etcd_servers="${ETCD_SERVERS}" --machines="${KUBE_MINIONS}"
|
23
build/run-images/base/Dockerfile
Normal file
23
build/run-images/base/Dockerfile
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Copyright 2014 Google Inc. All rights reserved.
|
||||||
|
#
|
||||||
|
# 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 file creates a minimal container for running Kubernetes binaries
|
||||||
|
|
||||||
|
FROM busybox
|
||||||
|
MAINTAINER Joe Beda <jbeda@google.com>
|
||||||
|
|
||||||
|
WORKDIR /kubernetes
|
||||||
|
|
||||||
|
# Upload Kubernetes
|
||||||
|
ADD kube-bins.tar.gz /kubernetes
|
25
build/run-images/controller-manager/Dockerfile
Normal file
25
build/run-images/controller-manager/Dockerfile
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# Copyright 2014 Google Inc. All rights reserved.
|
||||||
|
#
|
||||||
|
# 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 file creates a minimal container for running Kubernetes binaries
|
||||||
|
|
||||||
|
FROM kubernetes
|
||||||
|
MAINTAINER Joe Beda <jbeda@google.com>
|
||||||
|
|
||||||
|
ENV ETCD_SERVERS http://127.0.0.1:4001
|
||||||
|
ENV API_SERVER 127.0.0.1:8080
|
||||||
|
|
||||||
|
ADD . /kubernetes
|
||||||
|
|
||||||
|
CMD ['./run.sh']
|
17
build/run-images/controller-manager/run.sh
Executable file
17
build/run-images/controller-manager/run.sh
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
# Copyright 2014 Google Inc. All rights reserved.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
./controller-manager -etcd_servers="${ETCD_SERVERS}" -master="${API_SERVER}"
|
24
build/run-images/proxy/Dockerfile
Normal file
24
build/run-images/proxy/Dockerfile
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# Copyright 2014 Google Inc. All rights reserved.
|
||||||
|
#
|
||||||
|
# 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 file creates a minimal container for running Kubernetes binaries
|
||||||
|
|
||||||
|
FROM kubernetes
|
||||||
|
MAINTAINER Joe Beda <jbeda@google.com>
|
||||||
|
|
||||||
|
ENV ETCD_SERVERS http://127.0.0.1:4001
|
||||||
|
|
||||||
|
ADD . /kubernetes
|
||||||
|
|
||||||
|
CMD ['./run.sh']
|
17
build/run-images/proxy/run.sh
Executable file
17
build/run-images/proxy/run.sh
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
# Copyright 2014 Google Inc. All rights reserved.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
./proxy --etcd_servers="${ETCD_SERVERS}"
|
@ -14,15 +14,13 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
# Make all of the Kubernetes binaries.
|
# Run the integration test.
|
||||||
#
|
|
||||||
# This makes the docker build image, builds the binaries and copies them out
|
|
||||||
# of the docker container.
|
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
source $(dirname $0)/common.sh
|
source $(dirname $0)/common.sh
|
||||||
|
|
||||||
|
verify-prereqs
|
||||||
build-image
|
build-image
|
||||||
run-build-command build/build-image/make-binaries.sh "integration"
|
run-build-command build/build-image/make-binaries.sh "integration"
|
||||||
run-build-command build/build-image/run-integration.sh
|
run-build-command build/build-image/run-integration.sh
|
||||||
|
@ -14,14 +14,12 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
# Make all of the Kubernetes binaries.
|
# Run all of the golang unit tests.
|
||||||
#
|
|
||||||
# This makes the docker build image, builds the binaries and copies them out
|
|
||||||
# of the docker container.
|
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
source $(dirname $0)/common.sh
|
source $(dirname $0)/common.sh
|
||||||
|
|
||||||
|
verify-prereqs
|
||||||
build-image
|
build-image
|
||||||
run-build-command build/build-image/run-tests.sh "$@"
|
run-build-command build/build-image/run-tests.sh "$@"
|
||||||
|
@ -14,16 +14,14 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
# Build the docker image necessary for building Kubernetes
|
# Run a bash script in the Docker build image.
|
||||||
#
|
#
|
||||||
# This script will package the parts of the repo that we need to build
|
# This container will have a snapshot of the current sources.
|
||||||
# Kubernetes into a tar file and put it in the right place in the output
|
|
||||||
# directory. It will then copy over the Dockerfile and build the kube-build
|
|
||||||
# image.
|
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
source $(dirname $0)/common.sh
|
source $(dirname $0)/common.sh
|
||||||
|
|
||||||
|
verify-prereqs
|
||||||
build-image
|
build-image
|
||||||
run-build-command bash
|
run-build-command bash
|
||||||
|
Loading…
Reference in New Issue
Block a user