Skip to content
This repository has been archived by the owner on Jul 28, 2019. It is now read-only.

Commit

Permalink
Add k8s 1.13 and releases
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Shvedunov committed Dec 18, 2018
1 parent 3cde766 commit 96e9e6d
Show file tree
Hide file tree
Showing 27 changed files with 1,048 additions and 1,164 deletions.
854 changes: 170 additions & 684 deletions .circleci/config.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -3,10 +3,10 @@ services: docker
language: minimal

env:
- TEST_CASE=1.9
- TEST_CASE=1.10
- TEST_CASE=1.11
- TEST_CASE=1.12
- TEST_CASE=1.13

before_install:
- sudo apt-get -qq update
Expand Down
14 changes: 13 additions & 1 deletion Dockerfile
@@ -1,5 +1,7 @@
FROM mirantis/kubeadm-dind-cluster:bare-v4

LABEL mirantis.kubeadm_dind_cluster_final=1

# the following args should be set for derived images

#Todo: download prebuilt hyperkube (not kubectl!) & kubeadm into /k8s
Expand All @@ -8,6 +10,11 @@ ARG KUBEADM_URL
ARG KUBEADM_SHA1
ARG HYPERKUBE_URL
ARG HYPERKUBE_SHA1
ARG KUBECTL_VERSION
ARG KUBECTL_LINUX_URL
ARG KUBECTL_LINUX_SHA1
ARG KUBECTL_DARWIN_URL
ARG KUBECTL_DARWIN_SHA1

RUN if [ -n "${KUBEADM_URL}" ]; then \
mkdir -p /k8s && \
Expand All @@ -19,7 +26,12 @@ RUN if [ -n "${KUBEADM_URL}" ]; then \
curl -sSL "${HYPERKUBE_URL}" > /k8s/hyperkube && \
if [ -n "${HYPERKUBE_SHA1}" ]; then echo "${HYPERKUBE_SHA1} /k8s/hyperkube" | sha1sum -c; fi && \
chmod +x /k8s/hyperkube; \
fi
fi && \
( echo "export KUBECTL_VERSION=${KUBECTL_VERSION}" && \
echo "export KUBECTL_LINUX_SHA1=${KUBECTL_LINUX_SHA1}" && \
echo "export KUBECTL_LINUX_URL=${KUBECTL_LINUX_URL}" && \
echo "export KUBECTL_DARWIN_SHA1=${KUBECTL_DARWIN_SHA1}" && \
echo "export KUBECTL_DARWIN_URL=${KUBECTL_DARWIN_URL}" ) >/dind-env
COPY save.tar.lz4 /

ENTRYPOINT ["/sbin/dind_init"]
49 changes: 49 additions & 0 deletions build/build-all.sh
@@ -0,0 +1,49 @@
#!/bin/bash
# Copyright 2017 Mirantis
#
# 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
set -o errtrace

save_to_dir="${1:-}"

DIND_ROOT=$(dirname "${BASH_SOURCE}")/..
source "$DIND_ROOT/build/funcs.sh"

dind::build-base
images_to_save=(${BARE_IMAGE_NAME})
for v in ${K8S_VERSIONS}; do
version="${v//./_}"
eval "HYPERKUBE_URL=\${HYPERKUBE_URL_${version}}"
eval "HYPERKUBE_SHA1=\${HYPERKUBE_SHA1_${version}}"
eval "KUBEADM_URL=\${KUBEADM_URL_${version}}"
eval "KUBEADM_SHA1=\${KUBEADM_SHA1_${version}}"
eval "KUBECTL_LINUX_URL=\${KUBECTL_LINUX_URL_${version}}"
eval "KUBECTL_LINUX_SHA1=\${KUBECTL_LINUX_SHA1_${version}}"
eval "KUBECTL_DARWIN_URL=\${KUBECTL_DARWIN_URL_${version}}"
eval "KUBECTL_DARWIN_SHA1=\${KUBECTL_DARWIN_SHA1_${version}}"
commit="$(git rev-parse HEAD)"
tag="${commit}-v${v}"
cur_image="${IMAGE_NAME}:${tag}"
dind::build-image "${cur_image}"
images_to_save+=("${cur_image}")
done
if [[ ${save_to_dir} ]]; then
mkdir -p _save
docker save "${images_to_save[@]}" >_save/images.tar
else
echo "${images_to_save[*]}"
fi
2 changes: 1 addition & 1 deletion build/build-local.sh
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright 2017 Mirantis
# Copyright 2018 Mirantis
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
86 changes: 46 additions & 40 deletions build/buildconf.sh
@@ -1,45 +1,51 @@
# Version 1.9.11
KUBEADM_URL_1_9='https://storage.googleapis.com/kubernetes-release/release/v1.9.11/bin/linux/amd64/kubeadm'
KUBEADM_SHA1_1_9=152e1dd6261f5e1aeda982fb3a5d17255860a830
HYPERKUBE_URL_1_9='https://storage.googleapis.com/kubernetes-release/release/v1.9.11/bin/linux/amd64/hyperkube'
HYPERKUBE_SHA1_1_9=d23dc80fa2cd5f845912721afffba0e8fd9b1780
KUBECTL_URL_1_9='https://storage.googleapis.com/kubernetes-release/release/v1.9.11/bin/linux/amd64/kubectl'
KUBECTL_SHA1_1_9=3dedd41a077be12668c2ee322958dd3e9e554861
KUBECTL_DARWIN_URL_1_9='https://storage.googleapis.com/kubernetes-release/release/v1.9.11/bin/darwin/amd64/kubectl'
KUBECTL_DARWIN_SHA1_1_9=3b436f60ff0399b3f521d549044513358487ce20
# Version 1.10.11
KUBEADM_URL_1_10='https://storage.googleapis.com/kubernetes-release/release/v1.10.11/bin/linux/amd64/kubeadm'
KUBEADM_SHA1_1_10=d80c4d591ae61f60fb8c22dca2a9ef7dd6412dd9
HYPERKUBE_URL_1_10='https://storage.googleapis.com/kubernetes-release/release/v1.10.11/bin/linux/amd64/hyperkube'
HYPERKUBE_SHA1_1_10=13a9ebddd89332d5937cc9215bd1c446d4e663af
KUBECTL_LINUX_URL_1_10='https://storage.googleapis.com/kubernetes-release/release/v1.10.11/bin/linux/amd64/kubectl'
KUBECTL_LINUX_SHA1_1_10=9ee2f78491cbf8dc76d644c23cfc8c955c34d55d
KUBECTL_DARWIN_URL_1_10='https://storage.googleapis.com/kubernetes-release/release/v1.10.11/bin/darwin/amd64/kubectl'
KUBECTL_DARWIN_SHA1_1_10=1cfafe21222e7f5f809ba4e3e7a1471421998d37

# Version 1.10.9
KUBEADM_URL_1_10='https://storage.googleapis.com/kubernetes-release/release/v1.10.9/bin/linux/amd64/kubeadm'
KUBEADM_SHA1_1_10=5d300647b0512cc724248431211df92a4b6f987f
HYPERKUBE_URL_1_10='https://storage.googleapis.com/kubernetes-release/release/v1.10.9/bin/linux/amd64/hyperkube'
HYPERKUBE_SHA1_1_10=a1899c421d3192f647ee6fa3927207bffdffbb6b
KUBECTL_URL_1_10='https://storage.googleapis.com/kubernetes-release/release/v1.10.9/bin/linux/amd64/kubectl'
KUBECTL_SHA1_1_10=bf3914630fe45b4f9ec1bc5e56f10fb30047f958
KUBECTL_DARWIN_URL_1_10='https://storage.googleapis.com/kubernetes-release/release/v1.10.9/bin/darwin/amd64/kubectl'
KUBECTL_DARWIN_SHA1_1_10=6833874e0b24fa1857925423e4dc8aeaa322b7b3
# Version 1.11.5
KUBEADM_URL_1_11='https://storage.googleapis.com/kubernetes-release/release/v1.11.5/bin/linux/amd64/kubeadm'
KUBEADM_SHA1_1_11=daec1f0ddd654ab2b7553312548e545623037366
HYPERKUBE_URL_1_11='https://storage.googleapis.com/kubernetes-release/release/v1.11.5/bin/linux/amd64/hyperkube'
HYPERKUBE_SHA1_1_11=ddeddb33dfc581bdc3e101d7b17dc1dd2279657f
KUBECTL_LINUX_URL_1_11='https://storage.googleapis.com/kubernetes-release/release/v1.11.5/bin/linux/amd64/kubectl'
KUBECTL_LINUX_SHA1_1_11=feebec8e5649223e586fc45850d8659274c87797
KUBECTL_DARWIN_URL_1_11='https://storage.googleapis.com/kubernetes-release/release/v1.11.5/bin/darwin/amd64/kubectl'
KUBECTL_DARWIN_SHA1_1_11=450e6e17fe65e9d24cbbe39702ad7aa9103662d7

# Version 1.11.3
KUBEADM_URL_1_11='https://storage.googleapis.com/kubernetes-release/release/v1.11.3/bin/linux/amd64/kubeadm'
KUBEADM_SHA1_1_11=f127dccad906ee914af8b889bb60c07f402ed025
HYPERKUBE_URL_1_11='https://storage.googleapis.com/kubernetes-release/release/v1.11.3/bin/linux/amd64/hyperkube'
HYPERKUBE_SHA1_1_11=4510415132722eed1add98c3352d7fa171667739
KUBECTL_URL_1_11='https://storage.googleapis.com/kubernetes-release/release/v1.11.3/bin/linux/amd64/kubectl'
KUBECTL_SHA1_1_11=5a336ea470a0053b1893fda89a538b6197566137
KUBECTL_DARWIN_URL_1_11='https://storage.googleapis.com/kubernetes-release/release/v1.11.3/bin/darwin/amd64/kubectl'
KUBECTL_DARWIN_SHA1_1_11=4f519f6c225f2dd663a26c5c2390849324a577cb
# Version 1.12.3
KUBEADM_URL_1_12='https://storage.googleapis.com/kubernetes-release/release/v1.12.3/bin/linux/amd64/kubeadm'
KUBEADM_SHA1_1_12=24d78afbd6bb3dc90cd048a1925eccc7cb4b05db
HYPERKUBE_URL_1_12='https://storage.googleapis.com/kubernetes-release/release/v1.12.3/bin/linux/amd64/hyperkube'
HYPERKUBE_SHA1_1_12=c7ba79dff169b49beff3e8d2943a58adb6bcd7d1
KUBECTL_LINUX_URL_1_12='https://storage.googleapis.com/kubernetes-release/release/v1.12.3/bin/linux/amd64/kubectl'
KUBECTL_LINUX_SHA1_1_12=4248b9e621af7e902c9d23bf772a2ee8e50146c5
KUBECTL_DARWIN_URL_1_12='https://storage.googleapis.com/kubernetes-release/release/v1.12.3/bin/darwin/amd64/kubectl'
KUBECTL_DARWIN_SHA1_1_12=c7d4086fbdc58d81419f7643304de0bf356e11df

# Version 1.12.1
KUBEADM_URL_1_12='https://storage.googleapis.com/kubernetes-release/release/v1.12.1/bin/linux/amd64/kubeadm'
KUBEADM_SHA1_1_12=8f7de5a0236614bb89217b110368974dc19c78ec
HYPERKUBE_URL_1_12='https://storage.googleapis.com/kubernetes-release/release/v1.12.1/bin/linux/amd64/hyperkube'
HYPERKUBE_SHA1_1_12=2212a4ab6091cdd4205c9b716886619d79eb8daf
KUBECTL_URL_1_12='https://storage.googleapis.com/kubernetes-release/release/v1.12.1/bin/linux/amd64/kubectl'
KUBECTL_SHA1_1_12=2135356e8e205816829f612062e1b5b4e1c81a17
KUBECTL_DARWIN_URL_1_12='https://storage.googleapis.com/kubernetes-release/release/v1.12.1/bin/darwin/amd64/kubectl'
KUBECTL_DARWIN_SHA1_1_12=a99adb19c1fa0334ab9be37b3918e5de84436acd
# Version 1.13.0
KUBEADM_URL_1_13='https://storage.googleapis.com/kubernetes-release/release/v1.13.0/bin/linux/amd64/kubeadm'
KUBEADM_SHA1_1_13=c40dccc3d6fd0b7a903b0663c7ecd84f37105a2f
HYPERKUBE_URL_1_13='https://storage.googleapis.com/kubernetes-release/release/v1.13.0/bin/linux/amd64/hyperkube'
HYPERKUBE_SHA1_1_13=ce1d5c8a0d0f3afa506f624db7337452ac4c562f
KUBECTL_LINUX_URL_1_13='https://storage.googleapis.com/kubernetes-release/release/v1.13.0/bin/linux/amd64/kubectl'
KUBECTL_LINUX_SHA1_1_13=5c619006fa45afce6efc51db819aff7d5ba7ef0e
KUBECTL_DARWIN_URL_1_13='https://storage.googleapis.com/kubernetes-release/release/v1.13.0/bin/darwin/amd64/kubectl'
KUBECTL_DARWIN_SHA1_1_13=264df4722e8f70301dd150d455baeae4a855d2fc

# url and sha1sum of hyperkube binary -- only used for prebuilt hyperkube
KUBEADM_URL=${KUBEADM_URL:-${KUBEADM_URL_1_12}}
KUBEADM_SHA1=${KUBEADM_SHA1:-${KUBEADM_SHA1_1_12}}
HYPERKUBE_URL=${HYPERKUBE_URL:-${HYPERKUBE_URL_1_12}}
HYPERKUBE_SHA1=${HYPERKUBE_SHA1:-${HYPERKUBE_SHA1_1_12}}
KUBEADM_URL=${KUBEADM_URL:-${KUBEADM_URL_1_13}}
KUBEADM_SHA1=${KUBEADM_SHA1:-${KUBEADM_SHA1_1_13}}
HYPERKUBE_URL=${HYPERKUBE_URL:-${HYPERKUBE_URL_1_13}}
HYPERKUBE_SHA1=${HYPERKUBE_SHA1:-${HYPERKUBE_SHA1_1_13}}
KUBECTL_LINUX_URL=${KUBECTL_LINUX_URL:-${KUBECTL_LINUX_URL_1_13}}
KUBECTL_LINUX_SHA1=${KUBECTL_LINUX_SHA1:-${KUBECTL_LINUX_SHA1_1_13}}
KUBECTL_DARWIN_URL=${KUBECTL_DARWIN_URL:-${KUBECTL_DARWIN_URL_1_13}}
KUBECTL_DARWIN_SHA1=${KUBECTL_DARWIN_SHA1:-${KUBECTL_DARWIN_SHA1_1_13}}

K8S_VERSIONS="1.10 1.11 1.12 1.13"
82 changes: 81 additions & 1 deletion build/funcs.sh
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright 2017 Mirantis
# Copyright 2018 Mirantis
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -16,11 +16,15 @@
source "${DIND_ROOT}/build/buildconf.sh"

IMAGE_CACHE_DIR="${IMAGE_CACHE_DIR:-}"
IMAGE_NAME="${IMAGE_NAME:-mirantis/kubeadm-dind-cluster}"

KUBEADM_URL="${KUBEADM_URL:-}"
HYPERKUBE_URL="${HYPERKUBE_URL:-}"
KUBEADM_SHA1=${KUBEADM_SHA1:-}
HYPERKUBE_SHA1=${HYPERKUBE_SHA1:-}
GH_RELEASE_USER="kubernetes-sigs"
GH_REPO="kubeadm-dind-cluster"
GH_RELEASE_TEST_USER="ivan4th"

# FIXME: use k8s version specific list of images to pre-pull
# prepull_images=(gcr.io/google_containers/etcd-amd64:3.0.17
Expand Down Expand Up @@ -109,11 +113,87 @@ function dind::build-image {
dind::build-hypokube
images+=("${hypokube_base_image}")

if [[ ${KUBECTL_LINUX_URL} =~ /(v[0-9.]*)/ ]]; then
kubectl_version="${BASH_REMATCH[1]}"
else
echo >&2 "can't get kubectl version from url: ${KUBECTL_LINUX_URL}"
exit 1
fi

dind::copy-saved-images save.tar.lz4 "${images[@]}"
docker build -t "${name}" \
--build-arg KUBEADM_URL="${KUBEADM_URL}" \
--build-arg KUBEADM_SHA1="${KUBEADM_SHA1}" \
--build-arg HYPERKUBE_URL="${HYPERKUBE_URL}" \
--build-arg HYPERKUBE_SHA1="${HYPERKUBE_SHA1}" \
--build-arg KUBECTL_VERSION=${kubectl_version} \
--build-arg KUBECTL_LINUX_SHA1="${KUBECTL_LINUX_SHA1}" \
--build-arg KUBECTL_LINUX_URL="${KUBECTL_LINUX_URL}" \
--build-arg KUBECTL_DARWIN_SHA1="${KUBECTL_DARWIN_SHA1}" \
--build-arg KUBECTL_DARWIN_URL="${KUBECTL_DARWIN_URL}" \
.
}

# function dind::kubectl-build-var {
# local version="${1/v/}"
# local platform_suffix=""
# if [[ ${2} = darwin ]]; then
# platform_suffix="_DARWIN"
# fi
# local what="${3}"
# eval "echo \${KUBECTL${platform_suffix}_${what}_${version//./_}}"
# }

function release_description {
local -a tag="${1}"
shift
git tag -l --format='%(contents:body)' "${tag}"
echo
echo "SHA256 sums for the files:"
echo '```'
(cd fixed && sha256sum "$@")
echo '```'
}

function release {
local tag="${1}"
shift
local gh_user="${GH_RELEASE_USER}"
if [[ ${tag} =~ test ]]; then
gh_user="${GH_RELEASE_TEST_USER}"
fi
local -a opts=(--user "${gh_user}" --repo "${GH_REPO}" --tag "${tag}")
local -a files=($(cd fixed && ls dind-cluster-v*.sh))
local description="$(release_description "${tag}" "${files[@]}")"
local pre_release=
if [[ ${tag} =~ -(test|pre).*$ ]]; then
pre_release="--pre-release"
fi
if github-release --quiet delete "${opts[@]}"; then
echo >&2 "Replacing the old release"
fi
github-release release "${opts[@]}" \
--name "$(git tag -l --format='%(contents:subject)' "${tag}")" \
--description "${description}" \
${pre_release}
for filename in "${files[@]}"; do
echo >&2 "Uploading: ${filename}"
github-release upload "${opts[@]}" \
--name "${filename}" \
--replace \
--file "fixed/${filename}"
done
}

# function circle_image_tag_prefix {
# image_tag_prefix=
# if [[ ${image_tag} ]]; then
# tag="$(echo "${CIRCLE_TAG:-${CIRCLE_BRANCH}}"|tr / _)"
# fi
# }

function image_tag_for_version {
local k8s_version="${1}" # vX.Y
local commit_id="$(git rev-parse HEAD)"
echo "${commit_id}-${k8s_version}"
}
17 changes: 15 additions & 2 deletions build/genfixed.sh
Expand Up @@ -19,12 +19,25 @@ set -o pipefail
set -o errtrace

DIND_ROOT=$(dirname "${BASH_SOURCE}")/..
source "$DIND_ROOT/build/funcs.sh"

image_tag_prefix=
if [[ ${1:-} ]]; then
image_tag_prefix="${1}-"
fi

fixed_dir="${DIND_ROOT}/fixed"
mkdir -p "${fixed_dir}"
for tag in v1.9 v1.10 v1.11 v1.12 stable; do

for tag in v1.10 v1.11 v1.12 v1.13; do
dest="${fixed_dir}/dind-cluster-${tag}.sh"
sed "s@#%CONFIG%@EMBEDDED_CONFIG=y;DIND_IMAGE=mirantis/kubeadm-dind-cluster:${tag}@" \
# $(grep '^[^#]*=' "${DIND_ROOT}/build/buildconf.sh")
vars=(EMBEDDED_CONFIG=y
DOWNLOAD_KUBECTL=y
DIND_K8S_VERSION="${tag}"
DIND_COMMIT="$(cd "${DIND_ROOT}" && git rev-parse HEAD)")
var_str=$(IFS=';'; echo "${vars[*]}")
sed "s@#%CONFIG%@${var_str}@" \
"${DIND_ROOT}/dind-cluster.sh" >"${dest}"
chmod +x "${dest}"
done
4 changes: 2 additions & 2 deletions build/genvars.sh
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright 2017 Mirantis
# Copyright 2018 Mirantis
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -17,7 +17,7 @@ set -o errexit
set -o nounset
set -o pipefail
set -o errtrace
VERSIONS=(1.9.11 1.10.9 1.11.3 1.12.1)
VERSIONS=(1.10.11 1.11.5 1.12.3 1.13.0)

first=1
for version in ${VERSIONS[@]}; do
Expand Down
23 changes: 23 additions & 0 deletions build/release.sh
@@ -0,0 +1,23 @@
#!/bin/bash
# Copyright 2018 Mirantis
#
# 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
set -o errtrace

DIND_ROOT=$(dirname "${BASH_SOURCE}")/..
source "$DIND_ROOT/build/funcs.sh"

release "$@"

0 comments on commit 96e9e6d

Please sign in to comment.