Azure review fixes.

pull/6/head
Jeff Mendoza 2014-11-20 16:40:35 -08:00
parent 5d62ac1a56
commit d0586ed066
5 changed files with 38 additions and 45 deletions

View File

@ -53,7 +53,6 @@ install-salt() {
dpkg -i "${tar}" dpkg -i "${tar}"
done done
# This will install any of the unmet dependencies from above. # This will install any of the unmet dependencies from above.
apt-get install -f -y apt-get install -f -y
} }

View File

@ -66,4 +66,3 @@ install-salt --master
echo "Sleeping 180" echo "Sleeping 180"
sleep 180 sleep 180
salt-call state.highstate || true salt-call state.highstate || true

View File

@ -31,17 +31,8 @@ log_level: debug
log_level_logfile: debug log_level_logfile: debug
EOF EOF
# Our minions will have a pool role to distinguish them from the master.
#cat <<EOF >/etc/salt/minion.d/grains.conf
#grains:
# roles:
# - kubernetes-pool
# cbr-cidr: $MINION_IP_RANGE
# cloud: gce
#EOF
hostnamef=$(hostname -f) hostnamef=$(hostname -f)
sudo apt-get install ipcalc apt-get install -y ipcalc
netmask=$(ipcalc $MINION_IP_RANGE | grep Netmask | awk '{ print $2 }') netmask=$(ipcalc $MINION_IP_RANGE | grep Netmask | awk '{ print $2 }')
network=$(ipcalc $MINION_IP_RANGE | grep Address | awk '{ print $2 }') network=$(ipcalc $MINION_IP_RANGE | grep Address | awk '{ print $2 }')
cbrstring="$network $netmask" cbrstring="$network $netmask"

View File

@ -23,22 +23,26 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
source "${KUBE_ROOT}/cluster/azure/${KUBE_CONFIG_FILE-"config-default.sh"}" source "${KUBE_ROOT}/cluster/azure/${KUBE_CONFIG_FILE-"config-default.sh"}"
function azure_call { function azure_call {
params="" local -a params=()
for param in "$@" local param
do # the '... in "$@"' is implicit on a for, so doesn't need to be stated.
params="${params} \"${param}\"" for param; do
params+=("${param}")
done done
rv=1 local rc=0
stderr="getaddrinfo ENOTFOUND" local stderr
while [ $rv -ne 0 -a -n "$(echo $stderr | grep "getaddrinfo ENOTFOUND")" ]; do local count=0
set +e while [[ count -lt 10 ]]; do
{ stderr=$(bash -c "azure $params" 2>&1 1>&3-) ;} 3>&1 stderr=$(azure "${params[@]}" 2>&1 >&3) && break
rv=$? rc=$?
set -e if [[ "${stderr}" != *"getaddrinfo ENOTFOUND"* ]]; then
done break
if [ $rv -ne 0 ]; then fi
echo $stderr 1>&2 count=$(($count + 1))
exit done 3>&1
if [[ "${rc}" -ne 0 ]]; then
echo "${stderr}" >&2
return "${rc}"
fi fi
} }
@ -48,13 +52,13 @@ function json_val () {
# Verify prereqs # Verify prereqs
function verify-prereqs { function verify-prereqs {
if [ -z "$(which azure)" ]; then if [[ -z "$(which azure)" ]]; then
echo "Couldn't find azure in PATH" echo "Couldn't find azure in PATH"
echo " please install with 'npm install azure-cli'" echo " please install with 'npm install azure-cli'"
exit 1 exit 1
fi fi
if [ -z "$(azure_call account list | grep true)" ]; then if [[ -z "$(azure_call account list | grep true)" ]]; then
echo "Default azure account not set" echo "Default azure account not set"
echo " please set with 'azure account set'" echo " please set with 'azure account set'"
exit 1 exit 1
@ -142,8 +146,8 @@ function upload-server-tars() {
echo "==> SALT_TAR_URL: $SALT_TAR_URL" echo "==> SALT_TAR_URL: $SALT_TAR_URL"
echo "--> Checking storage exsists..." echo "--> Checking storage exsists..."
if [ -z "$(azure_call storage account show $AZ_STG 2>/dev/null | \ if [[ -z "$(azure_call storage account show $AZ_STG 2>/dev/null | \
grep data)" ]; then grep data)" ]]; then
echo "--> Creating storage..." echo "--> Creating storage..."
azure_call storage account create -l "$AZ_LOCATION" $AZ_STG azure_call storage account create -l "$AZ_LOCATION" $AZ_STG
fi fi
@ -153,8 +157,8 @@ function upload-server-tars() {
json_val '["primaryKey"]') json_val '["primaryKey"]')
echo "--> Checking storage container exsists..." echo "--> Checking storage container exsists..."
if [ -z "$(azure_call storage container show -a $AZ_STG -k "$stg_key" \ if [[ -z "$(azure_call storage container show -a $AZ_STG -k "$stg_key" \
$CONTAINER 2>/dev/null | grep data)" ]; then $CONTAINER 2>/dev/null | grep data)" ]]; then
echo "--> Creating storage container..." echo "--> Creating storage container..."
azure_call storage container create \ azure_call storage container create \
-a $AZ_STG \ -a $AZ_STG \
@ -164,8 +168,8 @@ function upload-server-tars() {
fi fi
echo "--> Checking server binary exists in the container..." echo "--> Checking server binary exists in the container..."
if [ -n "$(azure_call storage blob show -a $AZ_STG -k "$stg_key" \ if [[ -n "$(azure_call storage blob show -a $AZ_STG -k "$stg_key" \
$CONTAINER $server_binary_url 2>/dev/null | grep data)" ]; then $CONTAINER $server_binary_url 2>/dev/null | grep data)" ]]; then
echo "--> Deleting server binary in the container..." echo "--> Deleting server binary in the container..."
azure_call storage blob delete \ azure_call storage blob delete \
-a $AZ_STG \ -a $AZ_STG \
@ -183,8 +187,8 @@ function upload-server-tars() {
$server_binary_url $server_binary_url
echo "--> Checking salt data exists in the container..." echo "--> Checking salt data exists in the container..."
if [ -n "$(azure_call storage blob show -a $AZ_STG -k "$stg_key" \ if [[ -n "$(azure_call storage blob show -a $AZ_STG -k "$stg_key" \
$CONTAINER $salt_url 2>/dev/null | grep data)" ]; then $CONTAINER $salt_url 2>/dev/null | grep data)" ]]; then
echo "--> Deleting salt data in the container..." echo "--> Deleting salt data in the container..."
azure_call storage blob delete \ azure_call storage blob delete \
-a $AZ_STG \ -a $AZ_STG \
@ -210,7 +214,7 @@ function upload-server-tars() {
# Vars set: # Vars set:
# #
function detect-minions () { function detect-minions () {
if [ -z "$AZ_CS" ]; then if [[ -z "$AZ_CS" ]]; then
verify-prereqs verify-prereqs
fi fi
ssh_ports=($(eval echo "2200{1..$NUM_MINIONS}")) ssh_ports=($(eval echo "2200{1..$NUM_MINIONS}"))
@ -228,7 +232,7 @@ function detect-minions () {
# KUBE_MASTER # KUBE_MASTER
# KUBE_MASTER_IP # KUBE_MASTER_IP
function detect-master () { function detect-master () {
if [ -z "$AZ_CS" ]; then if [[ -z "$AZ_CS" ]]; then
verify-prereqs verify-prereqs
fi fi
@ -350,16 +354,16 @@ function kube-up {
grep -v "^#" "${KUBE_ROOT}/cluster/azure/templates/salt-master.sh" grep -v "^#" "${KUBE_ROOT}/cluster/azure/templates/salt-master.sh"
) > "${KUBE_TEMP}/master-start.sh" ) > "${KUBE_TEMP}/master-start.sh"
if [ ! -f $AZ_SSH_KEY ]; then if [[ ! -f $AZ_SSH_KEY ]]; then
ssh-keygen -f $AZ_SSH_KEY -N '' ssh-keygen -f $AZ_SSH_KEY -N ''
fi fi
if [ ! -f $AZ_SSH_CERT ]; then if [[ ! -f $AZ_SSH_CERT ]]; then
openssl req -new -x509 -days 1095 -key $AZ_SSH_KEY -out $AZ_SSH_CERT \ openssl req -new -x509 -days 1095 -key $AZ_SSH_KEY -out $AZ_SSH_CERT \
-subj "/CN=azure-ssh-key" -subj "/CN=azure-ssh-key"
fi fi
if [ -z "$(azure_call network vnet show $AZ_VNET 2>/dev/null | grep data)" ]; then if [[ -z "$(azure_call network vnet show $AZ_VNET 2>/dev/null | grep data)" ]]; then
#azure network vnet create with $AZ_SUBNET #azure network vnet create with $AZ_SUBNET
#FIXME not working #FIXME not working
echo error create vnet $AZ_VNET with subnet $AZ_SUBNET echo error create vnet $AZ_VNET with subnet $AZ_SUBNET

View File

@ -9,8 +9,8 @@
### Prerequisites for your workstation ### Prerequisites for your workstation
1. Be running a Linux or Mac OS X. 1. Be running a Linux or Mac OS X.
5. Get or build a [binary release](binary_release.md) 2. Get or build a [binary release](binary_release.md)
4. If you want to build your own release, you need to have [Docker 3. If you want to build your own release, you need to have [Docker
installed](https://docs.docker.com/installation/). On Mac OS X you can use installed](https://docs.docker.com/installation/). On Mac OS X you can use
boot2docker. boot2docker.