Change:
We delete all of in the salt . This includes blowing away cluster- We shouldn't do that.

Discussion:
<ins> #!/bin/bash # Copyright 2014 Google Inc. All rights reserved. # # 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. # Create the overlay files for the salt tree.  We create these in a separate # place so that we can blow away the rest of the salt configs on a kube-push and # re-apply these. mkdir -p /srv/salt-overlay/pillar cat <<EOF >/srv/salt-overlay/pillar/cluster-params.sls node_instance_prefix: $NODE_INSTANCE_PREFIX EOF mkdir -p /srv/salt-overlay/salt/nginx echo $MASTER_HTPASSWD > /srv/salt-overlay/salt/nginx/htpasswd </ins>

echo "readonly SERVER_BINARY_TAR_URL='${SERVER_BINARY_TAR_URL}'" echo "readonly SALT_TAR_URL='${SALT_TAR_URL}'" echo "readonly MASTER_HTPASSWD='${htpasswd}'" <ins> grep -v "^#" "${KUBE_ROOT}/cluster/gce/templates/create-dynamic-salt-files.sh" </ins> grep -v "^#" "${KUBE_ROOT}/cluster/gce/templates/download-release.sh" grep -v "^#" "${KUBE_ROOT}/cluster/gce/templates/salt-master.sh" ) > "${KUBE_TEMP}/master-start.sh"

trap 'rm -rf "${KUBE_TEMP}"' EXIT # This file is meant to run on the master.  It will install the salt configs <del> # into the appropriate place on the master. </del> <ins> # into the appropriate place on the master.  We do this by creating a new set of # salt trees and then quickly mv'ing them where the old ones were. readonly SALTDIRS=(salt pillar reactor) echo "+++ Installing salt files into new trees" rm -rf /srv/salt-new mkdir -p /srv/salt-new </ins> <del> echo "+++ Installing salt files" mkdir -p /srv </del> # This bash voodoo will prepend $SALT_ROOT to the start of each item in the # $SALTDIRS array <del> readonly SALTDIRS=(salt pillar reactor) cp -R --preserve=mode "${SALTDIRS[@]/#/${SALT_ROOT}/}" /srv/ </del> <ins> cp -v -R --preserve=mode "${SALTDIRS[@]/#/${SALT_ROOT}/}" /srv/salt-new echo "+++ Installing salt overlay files" for dir in "${SALTDIRS[@]}"; do if [[ -d "/srv/salt-overlay/$dir" ]]; then cp -v -R --preserve=mode "/srv/salt-overlay/$dir" "/srv/salt-new/" fi done </ins> echo "+++ Install binaries from tar: $1" tar -xz -C "${KUBE_TEMP}" -f "$1" <del> mkdir -p /srv/salt/kube-bins cp "${KUBE_TEMP}/kubernetes/server/bin/"* /srv/salt/kube-bins/ </del> <ins> mkdir -p /srv/salt-new/salt/kube-bins cp -v "${KUBE_TEMP}/kubernetes/server/bin/"* /srv/salt-new/salt/kube-bins/ echo "+++ Swapping in new configs" for dir in "${SALTDIRS[@]}"; do if [[ -d "/srv/$dir" ]]; then rm -rf "/srv/$dir" fi mv -v "/srv/salt-new/$dir" "/srv/$dir" done rm -rf /srv/salt-new </ins>

fi <del> echo "Running release install script" rm -rf /kube-install mkdir -p /kube-install pushd /kube-install tar xzf "$salt_tar" cp "$server_binary_tar" . ./kubernetes/saltbase/install.sh "${server_binary_tar##*/}" popd </del> # Setup hosts file to support ping by hostname to each minion in the cluster from apiserver minion_ip_array=(${MINION_IPS//,/ }) for (( i=0; i<${#MINION_NAMES[@]}; i++)); do

# Configure nginx authorization mkdir -p "$KUBE_TEMP" <del> mkdir -p /srv/salt/nginx </del> <ins> mkdir -p /srv/salt-overlay/salt/nginx </ins> python "${KUBE_ROOT}/third_party/htpasswd/htpasswd.py" -b -c "${KUBE_TEMP}/htpasswd" "$MASTER_USER" "$MASTER_PASSWD" MASTER_HTPASSWD=$(cat "${KUBE_TEMP}/htpasswd") <del> echo $MASTER_HTPASSWD > /srv/salt/nginx/htpasswd </del> <ins> echo $MASTER_HTPASSWD > /srv/salt-overlay/salt/nginx/htpasswd echo "Running release install script" rm -rf /kube-install mkdir -p /kube-install pushd /kube-install tar xzf "$salt_tar" cp "$server_binary_tar" . ./kubernetes/saltbase/install.sh "${server_binary_tar##*/}" popd </ins> # we will run provision to update code each time we test, so we do not want to do salt installs each time if ! which salt-master >/dev/null 2>&1; then

# Install Salt minion curl -sS -L --connect-timeout 20 --retry 6 --retry-delay 10 https://bootstrap.saltstack.com | sh -s else # Only run highstate when updating the config.  In the first-run case, Salt is # set up to run highstate as new minions join for the first time.

local id num_running=0 <del> for id in "${pod_id_list[@]}"; do </del> <ins> for id in "${pod_id_list[@]+${pod_id_list[@]}}"; do </ins> local template_string current_status current_image host_ip template_string="{{and ((index .CurrentState.Info "${CONTROLLER_NAME}").State.Running) .CurrentState.Info.net.State.Running}}" current_status=$($KUBECFG -template="${template_string}" get "pods/$id")