Skip to content

Commit

Permalink
Merge pull request kubernetes#24936 from andyzheng0831/automated-cher…
Browse files Browse the repository at this point in the history
…ry-pick-of-#24893-upstream-release-1.2

Automatic merge from submit-queue

Automated cherry pick of kubernetes#24893

Cherry pick of kubernetes#24893 on release-1.2.
  • Loading branch information
k8s-merge-robot committed Apr 28, 2016
2 parents c6d3276 + a6e018c commit 9a1063e
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 36 deletions.
34 changes: 18 additions & 16 deletions build/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -926,35 +926,36 @@ function kube::release::package_salt_tarball() {
}

# This will pack kube-system manifests files for distros without using salt
# such as Ubuntu Trusty. For Trusty, we directly copy manifests from cluster/addons
# and cluster/saltbase/salt. The script of cluster initialization will remove
# the salt configuration and evaluate the variables in the manifests.
# such as GCI and Ubuntu Trusty. We directly copy manifests from
# cluster/addons and cluster/saltbase/salt. The script of cluster initialization
# will remove the salt configuration and evaluate the variables in the manifests.
function kube::release::package_kube_manifests_tarball() {
kube::log::status "Building tarball: manifests"

local release_stage="${RELEASE_STAGE}/manifests/kubernetes"
rm -rf "${release_stage}"
mkdir -p "${release_stage}/trusty"
local dst_dir="${release_stage}/gci-trusty"
mkdir -p "${dst_dir}"

local salt_dir="${KUBE_ROOT}/cluster/saltbase/salt"
cp "${salt_dir}/fluentd-es/fluentd-es.yaml" "${release_stage}/"
cp "${salt_dir}/fluentd-gcp/fluentd-gcp.yaml" "${release_stage}/"
cp "${salt_dir}/kube-registry-proxy/kube-registry-proxy.yaml" "${release_stage}/"
cp "${salt_dir}/kube-proxy/kube-proxy.manifest" "${release_stage}/"
cp "${salt_dir}/etcd/etcd.manifest" "${release_stage}/trusty"
cp "${salt_dir}/kube-scheduler/kube-scheduler.manifest" "${release_stage}/trusty"
cp "${salt_dir}/kube-apiserver/kube-apiserver.manifest" "${release_stage}/trusty"
cp "${salt_dir}/kube-controller-manager/kube-controller-manager.manifest" "${release_stage}/trusty"
cp "${salt_dir}/kube-addons/namespace.yaml" "${release_stage}/trusty"
cp "${salt_dir}/kube-addons/kube-addons.sh" "${release_stage}/trusty"
cp "${salt_dir}/kube-addons/kube-addon-update.sh" "${release_stage}/trusty"
cp "${KUBE_ROOT}/cluster/gce/trusty/configure-helper.sh" "${release_stage}/trusty"
cp -r "${salt_dir}/kube-admission-controls/limit-range" "${release_stage}/trusty"
cp "${salt_dir}/etcd/etcd.manifest" "${dst_dir}"
cp "${salt_dir}/kube-scheduler/kube-scheduler.manifest" "${dst_dir}"
cp "${salt_dir}/kube-apiserver/kube-apiserver.manifest" "${dst_dir}"
cp "${salt_dir}/kube-controller-manager/kube-controller-manager.manifest" "${dst_dir}"
cp "${salt_dir}/kube-addons/namespace.yaml" "${dst_dir}"
cp "${salt_dir}/kube-addons/kube-addons.sh" "${dst_dir}"
cp "${salt_dir}/kube-addons/kube-addon-update.sh" "${dst_dir}"
cp "${KUBE_ROOT}/cluster/gce/trusty/configure-helper.sh" "${dst_dir}"
cp -r "${salt_dir}/kube-admission-controls/limit-range" "${dst_dir}"
local objects
objects=$(cd "${KUBE_ROOT}/cluster/addons" && find . \( -name \*.yaml -or -name \*.yaml.in -or -name \*.json \) | grep -v demo)
tar c -C "${KUBE_ROOT}/cluster/addons" ${objects} | tar x -C "${release_stage}/trusty"
tar c -C "${KUBE_ROOT}/cluster/addons" ${objects} | tar x -C "${dst_dir}"

# This is for coreos only. ContainerVM or Trusty does not use it.
# This is for coreos only. ContainerVM, GCI, or Trusty does not use it.
cp -r "${KUBE_ROOT}/cluster/gce/coreos/kube-manifests"/* "${release_stage}/"

kube::release::clean_cruft
Expand Down Expand Up @@ -1145,8 +1146,9 @@ function kube::release::gcs::copy_release_artifacts() {
# Stage everything in release directory
kube::release::gcs::stage_and_hash "${RELEASE_DIR}"/* . || return 1

# Having the configure-vm.sh script and and trusty code from the GCE cluster
# Having the configure-vm.sh script and trusty code from the GCE cluster
# deploy hosted with the release is useful for GKE.
# TODO(andyzheng0831): Replace the trusty path with GCI after finshing the GCI code.
kube::release::gcs::stage_and_hash "${RELEASE_STAGE}/full/kubernetes/cluster/gce/configure-vm.sh" extra/gce || return 1
kube::release::gcs::stage_and_hash "${RELEASE_STAGE}/full/kubernetes/cluster/gce/trusty/node.yaml" extra/gce || return 1
kube::release::gcs::stage_and_hash "${RELEASE_STAGE}/full/kubernetes/cluster/gce/trusty/master.yaml" extra/gce || return 1
Expand Down
6 changes: 3 additions & 3 deletions cluster/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,9 @@ function find-release-tars() {
exit 1
fi

# This tarball is only used by Ubuntu Trusty.
# This tarball is used by GCI, Ubuntu Trusty, and CoreOS.
KUBE_MANIFESTS_TAR=
if [[ "${KUBE_OS_DISTRIBUTION:-}" == "trusty" || "${KUBE_OS_DISTRIBUTION:-}" == "coreos" ]]; then
if [[ "${KUBE_OS_DISTRIBUTION:-}" == "trusty" || "${KUBE_OS_DISTRIBUTION:-}" == "gci" || "${KUBE_OS_DISTRIBUTION:-}" == "coreos" ]]; then
KUBE_MANIFESTS_TAR="${KUBE_ROOT}/server/kubernetes-manifests.tar.gz"
if [[ ! -f "${KUBE_MANIFESTS_TAR}" ]]; then
KUBE_MANIFESTS_TAR="${KUBE_ROOT}/_output/release-tars/kubernetes-manifests.tar.gz"
Expand Down Expand Up @@ -519,7 +519,7 @@ EOF
TERMINATED_POD_GC_THRESHOLD: $(yaml-quote ${TERMINATED_POD_GC_THRESHOLD})
EOF
fi
if [[ "${OS_DISTRIBUTION}" == "trusty" ]]; then
if [[ "${OS_DISTRIBUTION}" == "trusty" || "${OS_DISTRIBUTION}" == "gci" ]]; then
cat >>$file <<EOF
KUBE_MANIFESTS_TAR_URL: $(yaml-quote ${KUBE_MANIFESTS_TAR_URL})
KUBE_MANIFESTS_TAR_HASH: $(yaml-quote ${KUBE_MANIFESTS_TAR_HASH})
Expand Down
2 changes: 1 addition & 1 deletion cluster/gce/config-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ KUBE_UP_AUTOMATIC_CLEANUP=${KUBE_UP_AUTOMATIC_CLEANUP:-false}
# Optional: setting it to true denotes this is a testing cluster,
# so that we can use pulled kubernetes binaries, even if binaries
# are pre-installed in the image. Note that currently this logic
# is only supported in trusty nodes.
# is only supported in trusty or GCI.
TEST_CLUSTER="${TEST_CLUSTER:-true}"

# OpenContrail networking plugin specific settings
Expand Down
12 changes: 6 additions & 6 deletions cluster/gce/trusty/configure-helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ create_master_kubelet_auth() {
# $5: pod name, which should be either etcd or etcd-events
prepare_etcd_manifest() {
etcd_temp_file="/tmp/$5"
cp /home/kubernetes/kube-manifests/kubernetes/trusty/etcd.manifest "${etcd_temp_file}"
cp /home/kubernetes/kube-manifests/kubernetes/gci-trusty/etcd.manifest "${etcd_temp_file}"
sed -i -e "s@{{ *suffix *}}@$1@g" "${etcd_temp_file}"
sed -i -e "s@{{ *port *}}@$2@g" "${etcd_temp_file}"
sed -i -e "s@{{ *server_port *}}@$3@g" "${etcd_temp_file}"
Expand Down Expand Up @@ -459,7 +459,7 @@ start_kube_apiserver() {
fi
readonly kube_apiserver_docker_tag=$(cat /home/kubernetes/kube-docker-files/kube-apiserver.docker_tag)

src_file="/home/kubernetes/kube-manifests/kubernetes/trusty/kube-apiserver.manifest"
src_file="/home/kubernetes/kube-manifests/kubernetes/gci-trusty/kube-apiserver.manifest"
remove_salt_config_comments "${src_file}"
# Evaluate variables
sed -i -e "s@{{params}}@${params}@g" "${src_file}"
Expand Down Expand Up @@ -518,7 +518,7 @@ start_kube_controller_manager() {
fi
readonly kube_rc_docker_tag=$(cat /home/kubernetes/kube-docker-files/kube-controller-manager.docker_tag)

src_file="/home/kubernetes/kube-manifests/kubernetes/trusty/kube-controller-manager.manifest"
src_file="/home/kubernetes/kube-manifests/kubernetes/gci-trusty/kube-controller-manager.manifest"
remove_salt_config_comments "${src_file}"
# Evaluate variables
sed -i -e "s@{{srv_kube_path}}@/etc/srv/kubernetes@g" "${src_file}"
Expand Down Expand Up @@ -558,7 +558,7 @@ start_kube_scheduler() {
readonly kube_scheduler_docker_tag=$(cat "${kube_home}/kube-docker-files/kube-scheduler.docker_tag")

# Remove salt comments and replace variables with values
src_file="${kube_home}/kube-manifests/kubernetes/trusty/kube-scheduler.manifest"
src_file="${kube_home}/kube-manifests/kubernetes/gci-trusty/kube-scheduler.manifest"
remove_salt_config_comments "${src_file}"
sed -i -e "s@{{params}}@${params}@g" "${src_file}"
sed -i -e "s@{{pillar\['kube_docker_registry'\]}}@${DOCKER_REGISTRY}@g" "${src_file}"
Expand All @@ -582,7 +582,7 @@ start_fluentd() {
# $1: addon category under /etc/kubernetes
# $2: manifest source dir
setup_addon_manifests() {
src_dir="/home/kubernetes/kube-manifests/kubernetes/trusty/$2"
src_dir="/home/kubernetes/kube-manifests/kubernetes/gci-trusty/$2"
dst_dir="/etc/kubernetes/$1/$2"
if [ ! -d "${dst_dir}" ]; then
mkdir -p "${dst_dir}"
Expand All @@ -606,7 +606,7 @@ setup_addon_manifests() {

# Prepares the manifests of k8s addons static pods.
prepare_kube_addons() {
addon_src_dir="/home/kubernetes/kube-manifests/kubernetes/trusty"
addon_src_dir="/home/kubernetes/kube-manifests/kubernetes/gci-trusty"
addon_dst_dir="/etc/kubernetes/addons"
# Set up manifests of other addons.
if [ "${ENABLE_CLUSTER_MONITORING:-}" = "influxdb" ] || \
Expand Down
2 changes: 1 addition & 1 deletion cluster/gce/trusty/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ install_kube_binary_config() {
find "${dst_dir}" -name \*.manifest -or -name \*.json | \
xargs sed -ri "s@(image\":\s+\")gcr.io/google_containers@\1${kube_addon_registry}@"
fi
cp "${dst_dir}/kubernetes/trusty/configure-helper.sh" /etc/kube-configure-helper.sh
cp "${dst_dir}/kubernetes/gci-trusty/configure-helper.sh" /etc/kube-configure-helper.sh

# Clean up.
rm -rf "${kube_home}/kubernetes"
Expand Down
24 changes: 17 additions & 7 deletions cluster/gce/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ source "${KUBE_ROOT}/cluster/lib/util.sh"

if [[ "${OS_DISTRIBUTION}" == "debian" || "${OS_DISTRIBUTION}" == "coreos" || "${OS_DISTRIBUTION}" == "trusty" ]]; then
source "${KUBE_ROOT}/cluster/gce/${OS_DISTRIBUTION}/helper.sh"
elif [[ "${OS_DISTRIBUTION}" == "gci" ]]; then
# TODO(andyzheng0831): Switch to use the GCI specific code.
source "${KUBE_ROOT}/cluster/gce/trusty/helper.sh"
MASTER_IMAGE_PROJECT="google-containers"
# If choosing "gci" disto, at least the cluster master needs to run on GCI image.
# If the user does not set a GCI image for master, we run both master and nodes
# using the latest GCI dev image.
if [[ "${MASTER_IMAGE}" != gci* ]]; then
MASTER_IMAGE=$(gcloud compute images list | grep "gci-dev" | cut -d ' ' -f1)
NODE_IMAGE="${MASTER_IMAGE}"
NODE_IMAGE_PROJECT="${MASTER_IMAGE_PROJECT}"
fi
else
echo "Cannot operate on cluster using os distro: ${OS_DISTRIBUTION}" >&2
exit 1
Expand Down Expand Up @@ -169,8 +181,6 @@ function set-preferred-region() {

# Take the local tar files and upload them to Google Storage. They will then be
# downloaded by the master as part of the start up script for the master.
# If running on Ubuntu trusty, we also pack the dir cluster/gce/trusty/kube-manifest
# and upload it to Google Storage.
#
# Assumed vars:
# PROJECT
Expand Down Expand Up @@ -208,7 +218,7 @@ function upload-server-tars() {

SERVER_BINARY_TAR_HASH=$(sha1sum-file "${SERVER_BINARY_TAR}")
SALT_TAR_HASH=$(sha1sum-file "${SALT_TAR}")
if [[ "${OS_DISTRIBUTION}" == "trusty" || "${OS_DISTRIBUTION}" == "coreos" ]]; then
if [[ "${OS_DISTRIBUTION}" == "trusty" || "${OS_DISTRIBUTION}" == "gci" || "${OS_DISTRIBUTION}" == "coreos" ]]; then
KUBE_MANIFESTS_TAR_HASH=$(sha1sum-file "${KUBE_MANIFESTS_TAR}")
fi

Expand Down Expand Up @@ -241,7 +251,7 @@ function upload-server-tars() {
server_binary_tar_urls+=("${server_binary_gs_url/gs:\/\//https://storage.googleapis.com/}")
salt_tar_urls+=("${salt_gs_url/gs:\/\//https://storage.googleapis.com/}")

if [[ "${OS_DISTRIBUTION}" == "trusty" || "${OS_DISTRIBUTION}" == "coreos" ]]; then
if [[ "${OS_DISTRIBUTION}" == "trusty" || "${OS_DISTRIBUTION}" == "gci" || "${OS_DISTRIBUTION}" == "coreos" ]]; then
local kube_manifests_gs_url="${staging_path}/${KUBE_MANIFESTS_TAR##*/}"
copy-to-staging "${staging_path}" "${kube_manifests_gs_url}" "${KUBE_MANIFESTS_TAR}" "${KUBE_MANIFESTS_TAR_HASH}"
# Convert from gs:// URL to an https:// URL
Expand All @@ -257,7 +267,7 @@ function upload-server-tars() {
else
SERVER_BINARY_TAR_URL=$(join_csv "${server_binary_tar_urls[@]}")
SALT_TAR_URL=$(join_csv "${salt_tar_urls[@]}")
if [[ "${OS_DISTRIBUTION}" == "trusty" ]]; then
if [[ "${OS_DISTRIBUTION}" == "trusty" || "${OS_DISTRIBUTION}" == "gci" ]]; then
KUBE_MANIFESTS_TAR_URL=$(join_csv "${kube_manifests_tar_urls[@]}")
fi
fi
Expand Down Expand Up @@ -692,8 +702,8 @@ function create-nodes-template() {

local template_name="${NODE_INSTANCE_PREFIX}-template"

# For master on trusty, we support running nodes on ContainerVM or trusty.
if [[ "${OS_DISTRIBUTION}" == "trusty" ]] && \
# For master on GCI or trusty, we support the hybrid mode with nodes on ContainerVM.
if [[ "${OS_DISTRIBUTION}" == "trusty" || "${OS_DISTRIBUTION}" == "gci" ]] && \
[[ "${NODE_IMAGE}" == container* ]]; then
source "${KUBE_ROOT}/cluster/gce/debian/helper.sh"
fi
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/addon_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ var _ = Describe("Addon update", func() {
switch testContext.OSDistro {
case "debian":
sshExecAndVerify(sshClient, "sudo TEST_ADDON_CHECK_INTERVAL_SEC=1 /etc/init.d/kube-addons restart")
case "trusty":
case "trusty", "gci":
sshExecAndVerify(sshClient, "sudo initctl restart kube-addons TEST_ADDON_CHECK_INTERVAL_SEC=1")
default:
Failf("Unsupported OS distro type %s", testContext.OSDistro)
Expand All @@ -226,7 +226,7 @@ var _ = Describe("Addon update", func() {
switch testContext.OSDistro {
case "debian":
sshExec(sshClient, "sudo /etc/init.d/kube-addons restart")
case "trusty":
case "trusty", "gci":
sshExec(sshClient, "sudo initctl restart kube-addons")
default:
Failf("Unsupported OS distro type %s", testContext.OSDistro)
Expand Down

0 comments on commit 9a1063e

Please sign in to comment.