Commit b26c28d6 authored by Madhusudan.C.S's avatar Madhusudan.C.S

Default the version to the information in federation versions file if…

Default the version to the information in federation versions file if $KUBERNETES_RELEASE isn't set. Also, slightly unrelated fix: copy the output from the build container to the host filesystem while building hyperkube image. The recent change in the build scripts has caused the binaries to be not copied to the required locations. It must be explicitly copied by calling the build copy function.
parent 3ce49346
...@@ -37,16 +37,44 @@ FEDERATION_KUBE_CONTEXT="${FEDERATION_KUBE_CONTEXT:-e2e-federation}" ...@@ -37,16 +37,44 @@ FEDERATION_KUBE_CONTEXT="${FEDERATION_KUBE_CONTEXT:-e2e-federation}"
DNS_ZONE_NAME="${FEDERATION_DNS_ZONE_NAME:-}" DNS_ZONE_NAME="${FEDERATION_DNS_ZONE_NAME:-}"
HOST_CLUSTER_CONTEXT="${FEDERATION_HOST_CLUSTER_CONTEXT:-${1}}" HOST_CLUSTER_CONTEXT="${FEDERATION_HOST_CLUSTER_CONTEXT:-${1}}"
# get_version returns the version in KUBERNETES_RELEASE or defaults to the
# value in the federation `versions` file.
# TODO(madhusudancs): This is a duplicate of the function in
# federation/develop/develop.sh with a minor difference. This
# function tries to default to the version information in
# _output/federation/versions file where as the one in develop.sh
# tries to default to the version in the kubernetes versions file.
# These functions should be consolidated to read the version from
# kubernetes version defs file.
function get_version() {
local -r versions_file="${KUBE_ROOT}/_output/federation/versions"
if [[ -n "${KUBERNETES_RELEASE:-}" ]]; then
echo "${KUBERNETES_RELEASE//+/_}"
return
elif [[ ! -f "${versions_file}" ]]; then
echo "Couldn't determine the release version: neither the " \
"KUBERNETES_RELEASE environment variable is set, nor the " \
"versions file is provided"
exit 1
fi
# Read the version back from the versions file if no version is given.
local -r kube_version="$(cat "${versions_file}" | python -c '\
import json, sys;\
print json.load(sys.stdin)["KUBE_VERSION"]')"
echo "${kube_version//+/_}"
}
# Initializes the control plane. # Initializes the control plane.
# TODO(madhusudancs): Move this to federation/develop.sh. # TODO(madhusudancs): Move this to federation/develop.sh.
function init() { function init() {
: "${KUBERNETES_RELEASE?KUBERNETES_RELEASE environment variable must be set}"
kube::log::status "Deploying federation control plane for ${FEDERATION_NAME} in cluster ${HOST_CLUSTER_CONTEXT}" kube::log::status "Deploying federation control plane for ${FEDERATION_NAME} in cluster ${HOST_CLUSTER_CONTEXT}"
local -r project="${KUBE_PROJECT:-${PROJECT:-}}" local -r project="${KUBE_PROJECT:-${PROJECT:-}}"
local -r kube_registry="${KUBE_REGISTRY:-gcr.io/${project}}" local -r kube_registry="${KUBE_REGISTRY:-gcr.io/${project}}"
local -r kube_version="${KUBERNETES_RELEASE//+/_}" local -r kube_version="$(get_version)"
"${KUBE_ROOT}/federation/develop/kubefed.sh" init \ "${KUBE_ROOT}/federation/develop/kubefed.sh" init \
"${FEDERATION_NAME}" \ "${FEDERATION_NAME}" \
...@@ -76,6 +104,7 @@ function create_cluster_secrets() { ...@@ -76,6 +104,7 @@ function create_cluster_secrets() {
} }
USE_KUBEFED="${USE_KUBEFED:-}" USE_KUBEFED="${USE_KUBEFED:-}"
if [[ "${USE_KUBEFED}" == "true" ]]; then if [[ "${USE_KUBEFED}" == "true" ]]; then
init init
# TODO(madhusudancs): Call to create_cluster_secrets and the function # TODO(madhusudancs): Call to create_cluster_secrets and the function
...@@ -84,10 +113,6 @@ if [[ "${USE_KUBEFED}" == "true" ]]; then ...@@ -84,10 +113,6 @@ if [[ "${USE_KUBEFED}" == "true" ]]; then
# BeforeEach blocks of each e2e test to work. # BeforeEach blocks of each e2e test to work.
create_cluster_secrets create_cluster_secrets
else else
# Read the version back from the versions file if no version is given. export FEDERATION_IMAGE_TAG="$(get_version)"
readonly kube_version="$(cat ${KUBE_ROOT}/_output/federation/versions | python -c '\
import json, sys;\
print json.load(sys.stdin)["KUBE_VERSION"]')"
export FEDERATION_IMAGE_TAG="$(echo ${KUBERNETES_RELEASE:-${kube_version}} | tr + _)"
create-federation-api-objects create-federation-api-objects
fi fi
...@@ -84,6 +84,7 @@ function build_binaries() { ...@@ -84,6 +84,7 @@ function build_binaries() {
kube::build::verify_prereqs kube::build::verify_prereqs
kube::build::build_image kube::build::build_image
kube::build::run_build_command make WHAT="cmd/kubectl cmd/hyperkube" kube::build::run_build_command make WHAT="cmd/kubectl cmd/hyperkube"
kube::build::copy_output
} }
function build_image() { function build_image() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment