diff --git a/build/common.sh b/build/common.sh index f4aaebc7da9..abee5f8c3c6 100755 --- a/build/common.sh +++ b/build/common.sh @@ -131,12 +131,6 @@ kube::build::get_docker_wrapped_binaries() { echo "${targets[@]}" } -# The set of addons images that should be prepopulated on linux/amd64 -readonly KUBE_ADDON_PATHS=( - gcr.io/google_containers/pause:2.0 - gcr.io/google_containers/kube-registry-proxy:0.3 -) - # --------------------------------------------------------------------------- # Basic setup functions @@ -760,11 +754,6 @@ function kube::release::package_server_tarballs() { kube::release::create_docker_images_for_server "${release_stage}/server/bin" "${arch}" - # Only release addon images for linux/amd64. These addon images aren't necessary for other architectures - if [[ ${platform} == "linux/amd64" ]]; then - kube::release::write_addon_docker_images_for_server "${release_stage}/addons" - fi - # Include the client binaries here too as they are useful debugging tools. local client_bins=("${KUBE_CLIENT_BINARIES[@]}") if [[ "${platform%/*}" == "windows" ]]; then @@ -869,40 +858,6 @@ function kube::release::create_docker_images_for_server() { } -# This will pull and save docker images for addons which need to placed -# on the nodes directly. -function kube::release::write_addon_docker_images_for_server() { - # Create a sub-shell so that we don't pollute the outer environment - ( - local addon_path - for addon_path in "${KUBE_ADDON_PATHS[@]}"; do - ( - kube::log::status "Pulling and writing Docker image for addon: ${addon_path}" - - local dest_name="${addon_path//\//\~}" - if [[ -z $("${DOCKER[@]}" images | awk '{print ($1":"$2)}' | grep "${addon_path}") ]]; then - kube::log::status "Addon image ${addon_path} does not exist, pulling it..." - "${DOCKER[@]}" pull "${addon_path}" - fi - "${DOCKER[@]}" save "${addon_path}" > "${1}/${dest_name}.tar" - ) & - done - - if [[ ! -z "${BUILD_PYTHON_IMAGE:-}" ]]; then - ( - kube::log::status "Building Docker python image" - - local img_name=python:2.7-slim-pyyaml - "${DOCKER[@]}" build -t "${img_name}" "${KUBE_ROOT}/cluster/addons/python-image" - "${DOCKER[@]}" save "${img_name}" > "${1}/${img_name}.tar" - ) & - fi - - kube::util::wait-for-jobs || { kube::log::error "unable to pull or write addon image"; return 1; } - kube::log::status "Addon images done" - ) -} - # Package up the salt configuration tree. This is an optional helper to getting # a cluster up and running. function kube::release::package_salt_tarball() { diff --git a/cluster/addons/python-image/Makefile b/cluster/addons/python-image/Makefile new file mode 100644 index 00000000000..0f378363d8b --- /dev/null +++ b/cluster/addons/python-image/Makefile @@ -0,0 +1,25 @@ +# Copyright 2016 The Kubernetes Authors 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. + +IMAGE=gcr.io/google_containers/python +VERSION=v1 + +.PHONY: build push + +build: + docker build -t "$(IMAGE):$(VERSION)" . + +push: + gcloud docker push "$(IMAGE):$(VERSION)" + diff --git a/cluster/saltbase/install.sh b/cluster/saltbase/install.sh index b5679097711..5a3f5e29f98 100755 --- a/cluster/saltbase/install.sh +++ b/cluster/saltbase/install.sh @@ -65,10 +65,8 @@ done echo "+++ Install binaries from tar: $1" tar -xz -C "${KUBE_TEMP}" -f "$1" mkdir -p /srv/salt-new/salt/kube-bins -mkdir -p /srv/salt-new/salt/kube-addons-images mkdir -p /srv/salt-new/salt/kube-docs cp -v "${KUBE_TEMP}/kubernetes/server/bin/"* /srv/salt-new/salt/kube-bins/ -cp -v "${KUBE_TEMP}/kubernetes/addons/"* /srv/salt-new/salt/kube-addons-images/ cp -v "${KUBE_TEMP}/kubernetes/LICENSES" /srv/salt-new/salt/kube-docs/ kube_bin_dir="/srv/salt-new/salt/kube-bins"; diff --git a/cluster/saltbase/salt/kube-addons/kube-addons.sh b/cluster/saltbase/salt/kube-addons/kube-addons.sh index 2ff129a67db..24db74af53e 100644 --- a/cluster/saltbase/salt/kube-addons/kube-addons.sh +++ b/cluster/saltbase/salt/kube-addons/kube-addons.sh @@ -27,7 +27,7 @@ trusty_master=${TRUSTY_MASTER:-false} function ensure_python() { if ! python --version > /dev/null 2>&1; then echo "No python on the machine, will use a python image" - local -r PYTHON_IMAGE=python:2.7-slim-pyyaml + local -r PYTHON_IMAGE=gcr.io/google_containers/python:v1 export PYTHON="docker run --interactive --rm --net=none ${PYTHON_IMAGE} python" else export PYTHON=python @@ -69,39 +69,11 @@ function create-resource-from-string() { return 1; } -# $1 is the directory containing all of the docker images -function load-docker-images() { - local success - local restart_docker - while true; do - success=true - restart_docker=false - for image in "$1/"*; do - timeout 30 docker load -i "${image}" &>/dev/null - rc=$? - if [[ "$rc" == 124 ]]; then - restart_docker=true - elif [[ "$rc" != 0 ]]; then - success=false - fi - done - if [[ "$success" == "true" ]]; then break; fi - if [[ "$restart_docker" == "true" ]]; then service docker restart; fi - sleep 15 - done -} - # The business logic for whether a given object should be created # was already enforced by salt, and /etc/kubernetes/addons is the # managed result is of that. Start everything below that directory. echo "== Kubernetes addon manager started at $(date -Is) with ADDON_CHECK_INTERVAL_SEC=${ADDON_CHECK_INTERVAL_SEC} ==" -# Load any images that we may need. This is not needed for trusty master and -# the way it restarts docker daemon does not work for trusty. -if [[ "${trusty_master}" == "false" ]]; then - load-docker-images /srv/salt/kube-addons-images -fi - ensure_python # Load the kube-env, which has all the environment variables we care