Skip to content

Commit

Permalink
Removing quoting of the PROXY_SETTING value.
Browse files Browse the repository at this point in the history
When PROXY_SETTING is empty, you end up an empty
command of "", as witnessed by this bash debug
output when +x is enabled:

    + '' /home/ubuntu/kube/make-ca-cert.sh 10.0.0.232 IP:10.0.0.232,IP:192.168.3.1,DNS:kubernetes,DNS:kubernetes.default,DNS:kubernetes.default.svc,DNS:kubernetes.default.svc.cluster.local

Given the example:

    PROXY_SETTING="http_proxy=http://server:port https_proxy=https://server:port"

You would not want this quoted on the script executed
on the remote master or minion node.

Enabling +e, for additional tracing and to
abort on any failure in the remote SSH session.

Adding a DEBUG parameter into config-default.sh allowing additional
debug information to be present in the logs during node rollout, using
bash's "set -x" when DEBUG=true
  • Loading branch information
Robert Roland committed Dec 8, 2015
1 parent 6698ac6 commit ebeb7bc
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 9 deletions.
2 changes: 2 additions & 0 deletions cluster/ubuntu/config-default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,5 @@ ENABLE_CLUSTER_UI="${KUBE_ENABLE_CLUSTER_UI:-true}"
# Add envitonment variable separated with blank space like "http_proxy=http://10.x.x.x:8080 https_proxy=https://10.x.x.x:8443"
PROXY_SETTING=${PROXY_SETTING:-""}

DEBUG=${DEBUG:-"false"}

8 changes: 2 additions & 6 deletions cluster/ubuntu/reconfDocker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@

# reconfigure docker network setting

source ~/kube/config-default.sh

if [ "$(id -u)" != "0" ]; then
echo >&2 "Please run as root"
exit 1
fi


function config_etcd {

source ~/kube/config-default.sh

attempt=0
while true; do
/opt/bin/etcdctl get /coreos.com/network/config
Expand All @@ -46,9 +45,6 @@ function config_etcd {
}

function restart_docker {

source ~/kube/config-default.sh

attempt=0
while [[ ! -f /run/flannel/subnet.env ]]; do
if (( attempt > 200 )); then
Expand Down
31 changes: 28 additions & 3 deletions cluster/ubuntu/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,15 @@ function provision-master() {

EXTRA_SANS=$(echo "${EXTRA_SANS[@]}" | tr ' ' ,)

BASH_DEBUG_FLAGS=""
if [[ "$DEBUG" == "true" ]] ; then
BASH_DEBUG_FLAGS="set -x"
fi

# remote login to MASTER and configue k8s master
ssh $SSH_OPTS -t "${MASTER}" "
set +e
${BASH_DEBUG_FLAGS}
source ~/kube/util.sh
setClusterInfo
Expand All @@ -386,7 +393,9 @@ function provision-master() {
create-kube-controller-manager-opts '${NODE_IPS}'
create-kube-scheduler-opts
create-flanneld-opts '127.0.0.1' '${MASTER_IP}'
sudo -E -p '[sudo] password to start master: ' -- /bin/bash -c '
sudo -E -p '[sudo] password to start master: ' -- /bin/bash -ce '
${BASH_DEBUG_FLAGS}
cp ~/kube/default/* /etc/default/
cp ~/kube/init_conf/* /etc/init/
cp ~/kube/init_scripts/* /etc/init.d/
Expand Down Expand Up @@ -418,8 +427,15 @@ function provision-node() {
ubuntu/binaries/minion \
"${1}:~/kube"

BASH_DEBUG_FLAGS=""
if [[ "$DEBUG" == "true" ]] ; then
BASH_DEBUG_FLAGS="set -x"
fi

# remote login to node and configue k8s node
ssh $SSH_OPTS -t "$1" "
set +e
${BASH_DEBUG_FLAGS}
source ~/kube/util.sh
setClusterInfo
Expand All @@ -433,7 +449,8 @@ function provision-node() {
'${MASTER_IP}'
create-flanneld-opts '${MASTER_IP}' '${1#*@}'
sudo -E -p '[sudo] password to start node: ' -- /bin/bash -c '
sudo -E -p '[sudo] password to start node: ' -- /bin/bash -ce '
${BASH_DEBUG_FLAGS}
cp ~/kube/default/* /etc/default/
cp ~/kube/init_conf/* /etc/init/
cp ~/kube/init_scripts/* /etc/init.d/
Expand Down Expand Up @@ -477,8 +494,15 @@ function provision-masterandnode() {

EXTRA_SANS=$(echo "${EXTRA_SANS[@]}" | tr ' ' ,)

BASH_DEBUG_FLAGS=""
if [[ "$DEBUG" == "true" ]] ; then
BASH_DEBUG_FLAGS="set -x"
fi

# remote login to the master/node and configue k8s
ssh $SSH_OPTS -t "$MASTER" "
set +e
${BASH_DEBUG_FLAGS}
source ~/kube/util.sh
setClusterInfo
Expand All @@ -499,7 +523,8 @@ function provision-masterandnode() {
'${MASTER_IP}'
create-flanneld-opts '127.0.0.1' '${MASTER_IP}'
sudo -E -p '[sudo] password to start master: ' -- /bin/bash -c '
sudo -E -p '[sudo] password to start master: ' -- /bin/bash -ce '
${BASH_DEBUG_FLAGS}
cp ~/kube/default/* /etc/default/
cp ~/kube/init_conf/* /etc/init/
cp ~/kube/init_scripts/* /etc/init.d/
Expand Down

0 comments on commit ebeb7bc

Please sign in to comment.