diff --git a/cluster/common.sh b/cluster/common.sh index f3553fafa29..9c82259039e 100755 --- a/cluster/common.sh +++ b/cluster/common.sh @@ -337,7 +337,7 @@ function find-release-tars() { # This tarball is only used by Ubuntu Trusty. KUBE_MANIFESTS_TAR= - if [[ "${KUBE_OS_DISTRIBUTION:-}" == "trusty" ]]; then + if [[ "${KUBE_OS_DISTRIBUTION:-}" == "trusty" || "${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" diff --git a/cluster/gce/coreos/helper.sh b/cluster/gce/coreos/helper.sh index 4e86f16e399..15bd768194c 100755 --- a/cluster/gce/coreos/helper.sh +++ b/cluster/gce/coreos/helper.sh @@ -16,17 +16,49 @@ # A library of helper functions and constant for coreos os distro -# By sourcing debian's helper.sh, we use the same create-master-instance -# functions as debian. But we overwrite the create-node-instance-template -# function to use coreos. -source "${KUBE_ROOT}/cluster/gce/debian/helper.sh" - # TODO(dawnchen): Check $CONTAINER_RUNTIME to decide which # cloud_config yaml file should be passed # $1: template name (required) -function create-node-instance-template { +function create-node-instance-template() { local template_name="$1" create-node-template "$template_name" "${scope_flags}" \ "kube-env=${KUBE_TEMP}/node-kube-env.yaml" \ - "user-data=${KUBE_ROOT}/cluster/gce/coreos/node.yaml" + "user-data=${KUBE_ROOT}/cluster/gce/coreos/node.yaml" \ + "configure-node=${KUBE_ROOT}/cluster/gce/coreos/configure-node.sh" \ + "configure-kubelet=${KUBE_ROOT}/cluster/gce/coreos/configure-kubelet.sh" +} + + +# create-master-instance creates the master instance. If called with +# an argument, the argument is used as the name to a reserved IP +# address for the master. (In the case of upgrade/repair, we re-use +# the same IP.) +# +# It requires a whole slew of assumed variables, partially due to to +# the call to write-master-env. Listing them would be rather +# futile. Instead, we list the required calls to ensure any additional +# variables are set: +# ensure-temp-dir +# detect-project +# get-bearer-token +# +function create-master-instance() { + local address_opt="" + [[ -n ${1:-} ]] && address_opt="--address ${1}" + + write-master-env + gcloud compute instances create "${MASTER_NAME}" \ + ${address_opt} \ + --project "${PROJECT}" \ + --zone "${ZONE}" \ + --machine-type "${MASTER_SIZE}" \ + --image-project="${MASTER_IMAGE_PROJECT}" \ + --image "${MASTER_IMAGE}" \ + --tags "${MASTER_TAG}" \ + --network "${NETWORK}" \ + --scopes "storage-ro,compute-rw,monitoring,logging-write" \ + --can-ip-forward \ + --metadata-from-file \ + "kube-env=${KUBE_TEMP}/master-kube-env.yaml,user-data=${KUBE_ROOT}/cluster/gce/coreos/master.yaml,configure-node=${KUBE_ROOT}/cluster/gce/coreos/configure-node.sh,configure-kubelet=${KUBE_ROOT}/cluster/gce/coreos/configure-kubelet.sh" \ + --disk "name=${MASTER_NAME}-pd,device-name=master-pd,mode=rw,boot=no,auto-delete=no" } diff --git a/cluster/gce/util.sh b/cluster/gce/util.sh index f57f953e598..9f2966d37cb 100755 --- a/cluster/gce/util.sh +++ b/cluster/gce/util.sh @@ -216,7 +216,7 @@ function upload-server-tars() { SERVER_BINARY_TAR_URL="${server_binary_gs_url/gs:\/\//https://storage.googleapis.com/}" SALT_TAR_URL="${salt_gs_url/gs:\/\//https://storage.googleapis.com/}" - if [[ "${OS_DISTRIBUTION}" == "trusty" ]]; then + if [[ "${OS_DISTRIBUTION}" == "trusty" || "${OS_DISTRIBUTION}" == "coreos" ]]; then local kube_manifests_gs_url="${staging_path}/${KUBE_MANIFESTS_TAR##*/}" KUBE_MANIFESTS_TAR_HASH=$(sha1sum-file "${KUBE_MANIFESTS_TAR}") copy-if-not-staged "${staging_path}" "${kube_manifests_gs_url}" "${KUBE_MANIFESTS_TAR}" "${KUBE_MANIFESTS_TAR_HASH}" @@ -1484,6 +1484,8 @@ EOF if [[ "${OS_DISTRIBUTION}" == "coreos" ]]; then # CoreOS-only env vars. TODO(yifan): Make them available on other distros. cat >>$file <