Skip to content

Commit

Permalink
Remove support for building "run containers".
Browse files Browse the repository at this point in the history
This was untested, broken and largely unused.

Related to kubernetes#12 and kubernetes#2455#issuecomment-68803245.
  • Loading branch information
jbeda committed Jan 6, 2015
1 parent 4432ba0 commit f1fed3b
Show file tree
Hide file tree
Showing 17 changed files with 0 additions and 459 deletions.
16 changes: 0 additions & 16 deletions build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ Env Variable | Default | Description
`KUBE_GCS_RELEASE_PREFIX` | `devel` | The path under the release bucket to put releases
`KUBE_GCS_MAKE_PUBLIC` | `y` | Make GCS links readable from anywhere
`KUBE_GCS_NO_CACHING` | `y` | Disable HTTP caching of GCS release artifacts. By default GCS will cache public objects for up to an hour. When doing "devel" releases this can cause problems.
`KUBE_BUILD_RUN_IMAGES` | `n` | *Experimental* Build Docker images for running most server components.
`KUBE_GCS_DOCKER_REG_PREFIX` | `docker-reg` | *Experimental* When uploading docker images, the bucket that backs the registry.

## Basic Flow
Expand All @@ -68,25 +67,10 @@ Everything in `build/build-image/` is meant to be run inside of the container.

When building final release tars, they are first staged into `_output/release-stage` before being tar'd up and put into `_output/release-tars`.

## Runtime Docker Images

This support is experimental and hasn't been used yet to deploy a cluster.

The files necessarily for the release Docker images are in `build/run-images/*`. All of this is staged into `_output/images` similar to build-image. The `base` image is used as a base for each of the specialized containers and is generally never pushed to a shared repository.

If the release script is set to upload to GCS, it'll do the following:
* Start up a local `google/docker-registry` registry that is backed by GCS.
* Rename/push the runtime images to that registry.

## TODOs

These are in no particular order

* [X] Harmonize with scripts in `hack/`. How much do we support building outside of Docker and these scripts?
* [ ] Get a cluster up and running with the Docker images. Perhaps start with a local cluster and move up to a GCE cluster.
* [ ] Implement (#186)[https://github.com/GoogleCloudPlatform/kubernetes/issues/186]. This will make it easier to develop Kubernetes.
* [X] Deprecate/replace most of the stuff in the hack/
* [ ] Create an install script that'll let us do a `curl https://[URL] | bash` to get that tarball down and ensure that other dependencies (cloud SDK?) are installed and configured correctly.
* [ ] Support/test Windows as a client.
* [ ] Finish support for the Dockerized runtime. Issue (#19)[https://github.com/GoogleCloudPlatform/kubernetes/issues/19]. A key issue here is to make this fast/light enough that we can use it for development workflows.
* [ ] Support uploading to the Docker index instead of the GCS bucket. This'll allow easier installs for those not running on GCE
97 changes: 0 additions & 97 deletions build/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ source hack/lib/init.sh
# Incoming options
#
readonly KUBE_SKIP_CONFIRMATIONS="${KUBE_SKIP_CONFIRMATIONS:-n}"
readonly KUBE_BUILD_RUN_IMAGES="${KUBE_BUILD_RUN_IMAGES:-n}"
readonly KUBE_GCS_UPLOAD_RELEASE="${KUBE_GCS_UPLOAD_RELEASE:-n}"
readonly KUBE_GCS_NO_CACHING="${KUBE_GCS_NO_CACHING:-y}"
readonly KUBE_GCS_MAKE_PUBLIC="${KUBE_GCS_MAKE_PUBLIC:-y}"
Expand Down Expand Up @@ -86,18 +85,6 @@ readonly DOCKER_DATA_MOUNT_ARGS=(
--volume "${REMOTE_GODEP_GOPATH}"
)


readonly KUBE_RUN_IMAGE_BASE="kubernetes"
readonly KUBE_RUN_IMAGES=(
kube-apiserver
kube-controller-manager
kube-proxy
kube-scheduler
kubelet
bootstrap
)


# This is where the final release artifacts are created locally
readonly RELEASE_STAGE="${LOCAL_OUTPUT_ROOT}/release-stage"
readonly RELEASE_DIR="${LOCAL_OUTPUT_ROOT}/release-tars"
Expand Down Expand Up @@ -317,30 +304,6 @@ function kube::build::build_image_cross() {
kube::build::docker_build "${KUBE_BUILD_IMAGE_CROSS}" "${build_context_dir}"
}

# Builds the runtime image. Assumes that the appropriate binaries are already
# built and in $LOCAL_OUTPUT_BINPATH.
function kube::build::run_image() {
[[ ${KUBE_BUILD_RUN_IMAGES} =~ ^[yY]$ ]] || return 0

local -r build_context_base="${LOCAL_OUTPUT_IMAGE_STAGING}/${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 "${LOCAL_OUTPUT_BINPATH}/linux/amd64" \
"${KUBE_RUN_IMAGES[@]}"
cp -R build/run-images/base/* "${build_context_base}/"
kube::build::docker_build "${KUBE_RUN_IMAGE_BASE}" "${build_context_base}"

local b
for b in "${KUBE_RUN_IMAGES[@]}" ; do
local sub_context_dir="${build_context_base}-$b"
mkdir -p "${sub_context_dir}"
cp -R build/run-images/$b/* "${sub_context_dir}/"
kube::build::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.
Expand Down Expand Up @@ -376,13 +339,6 @@ function kube::build::clean_image() {
function kube::build::clean_images() {
kube::build::clean_image "${KUBE_BUILD_IMAGE}"

kube::build::clean_image "${KUBE_RUN_IMAGE_BASE}"

local b
for b in "${KUBE_RUN_IMAGES[@]}" ; do
kube::build::clean_image "${KUBE_RUN_IMAGE_BASE}-${b}"
done

echo "+++ Cleaning all other untagged docker images"
"${DOCKER[@]}" rmi $("${DOCKER[@]}" images -q --filter 'dangling=true') 2> /dev/null || true
}
Expand Down Expand Up @@ -734,59 +690,6 @@ function kube::release::gcs::ensure_release_bucket() {
fi
}

function kube::release::gcs::ensure_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 refresh_token
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 -ra docker_cmd=(
"${DOCKER[@]}" run -d "--name=${reg_container_name}"
-e "GCS_BUCKET=${KUBE_GCS_RELEASE_BUCKET}"
-e "STORAGE_PATH=${KUBE_GCS_DOCKER_REG_PREFIX}"
-e "GCP_OAUTH2_REFRESH_TOKEN=${refresh_token}"
-p 127.0.0.1:5000:5000
google/docker-registry
)

"${docker[@]}"

# Give it time to spin up before we start throwing stuff at it
sleep 5
}

function kube::release::gcs::push_images() {
[[ ${KUBE_BUILD_RUN_IMAGES} =~ ^[yY]$ ]] || return 0

kube::release::gcs::ensure_docker_registry

# Tag each of our run binaries with the right registry and push
local b image_name
for b in "${KUBE_RUN_IMAGES[@]}" ; do
image_name="${KUBE_RUN_IMAGE_BASE}-${b}"
echo "+++ Tagging and pushing ${image_name} to GCS bucket ${KUBE_GCS_RELEASE_BUCKET}"
"${DOCKER[@]}" tag "${KUBE_RUN_IMAGE_BASE}-$b" "localhost:5000/${image_name}"
"${DOCKER[@]}" push "localhost:5000/${image_name}"
"${DOCKER[@]}" rmi "localhost:5000/${image_name}"
done
}

function kube::release::gcs::copy_release_artifacts() {
# TODO: This isn't atomic. There will be points in time where there will be
# no active release. Also, if something fails, the release could be half-
Expand Down
34 changes: 0 additions & 34 deletions build/make-run-images.sh

This file was deleted.

1 change: 0 additions & 1 deletion build/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,5 @@ if [[ $KUBE_RELEASE_RUN_TESTS =~ ^[yY]$ ]]; then
fi

kube::build::copy_output
kube::build::run_image
kube::release::package_tarballs
kube::release::gcs::release
25 changes: 0 additions & 25 deletions build/run-images/apiserver/Dockerfile

This file was deleted.

17 changes: 0 additions & 17 deletions build/run-images/apiserver/run.sh

This file was deleted.

23 changes: 0 additions & 23 deletions build/run-images/base/Dockerfile

This file was deleted.

22 changes: 0 additions & 22 deletions build/run-images/bootstrap/Dockerfile

This file was deleted.

56 changes: 0 additions & 56 deletions build/run-images/bootstrap/run.sh

This file was deleted.

24 changes: 0 additions & 24 deletions build/run-images/controller-manager/Dockerfile

This file was deleted.

Loading

0 comments on commit f1fed3b

Please sign in to comment.