propagate config file

This commit is contained in:
He Simei 2015-12-11 14:43:16 +08:00
parent 23baca87b5
commit 1571edfb94
4 changed files with 28 additions and 20 deletions

View File

@ -72,5 +72,5 @@ grep -q "^${KUBE_VERSION}\$" binaries/.kubernetes 2>/dev/null || {
rm -rf flannel* kubernetes* etcd* rm -rf flannel* kubernetes* etcd*
echo "Done! All your commands locate in kubernetes/cluster/ubuntu/binaries dir" echo "Done! All your binaries locate in kubernetes/cluster/ubuntu/binaries directory"
popd popd

View File

@ -16,14 +16,13 @@
# reconfigure docker network setting # reconfigure docker network setting
source ~/kube/config-default.sh source "$HOME/kube/${KUBE_CONFIG_FILE##*/}"
if [ "$(id -u)" != "0" ]; then if [[ "$(id -u)" != "0" ]]; then
echo >&2 "Please run as root" echo >&2 "Please run as root"
exit 1 exit 1
fi fi
function config_etcd { function config_etcd {
attempt=0 attempt=0
while true; do while true; do
@ -72,4 +71,7 @@ elif [[ $1 == "ai" ]]; then
restart_docker restart_docker
elif [[ $1 == "a" ]]; then elif [[ $1 == "a" ]]; then
config_etcd config_etcd
fi else
echo "Another arguement is required."
exit 1
fi

View File

@ -268,7 +268,7 @@ EOF
# Vars set: # Vars set:
# KUBE_MASTER_IP # KUBE_MASTER_IP
function detect-master() { function detect-master() {
source "${KUBE_ROOT}/cluster/ubuntu/${KUBE_CONFIG_FILE:-config-default.sh}" source "${KUBE_CONFIG_FILE}"
setClusterInfo setClusterInfo
export KUBE_MASTER="${MASTER}" export KUBE_MASTER="${MASTER}"
export KUBE_MASTER_IP="${MASTER_IP}" export KUBE_MASTER_IP="${MASTER_IP}"
@ -282,7 +282,7 @@ function detect-master() {
# Vars set: # Vars set:
# KUBE_NODE_IP_ADDRESS (array) # KUBE_NODE_IP_ADDRESS (array)
function detect-nodes() { function detect-nodes() {
source "${KUBE_ROOT}/cluster/ubuntu/${KUBE_CONFIG_FILE:-config-default.sh}" source "${KUBE_CONFIG_FILE}"
KUBE_NODE_IP_ADDRESSES=() KUBE_NODE_IP_ADDRESSES=()
setClusterInfo setClusterInfo
@ -306,7 +306,8 @@ function detect-nodes() {
# Instantiate a kubernetes cluster on ubuntu # Instantiate a kubernetes cluster on ubuntu
function kube-up() { function kube-up() {
source "${KUBE_ROOT}/cluster/ubuntu/${KUBE_CONFIG_FILE:-config-default.sh}" export KUBE_CONFIG_FILE=${KUBE_CONFIG_FILE:-${KUBE_ROOT}/cluster/ubuntu/config-default.sh}
source "${KUBE_CONFIG_FILE}"
# downloading tarball release # downloading tarball release
"${KUBE_ROOT}/cluster/ubuntu/download-release.sh" "${KUBE_ROOT}/cluster/ubuntu/download-release.sh"
@ -357,7 +358,7 @@ function provision-master() {
scp -r $SSH_OPTS \ scp -r $SSH_OPTS \
saltbase/salt/generate-cert/make-ca-cert.sh \ saltbase/salt/generate-cert/make-ca-cert.sh \
ubuntu/reconfDocker.sh \ ubuntu/reconfDocker.sh \
ubuntu/${KUBE_CONFIG_FILE:-config-default.sh} \ "${KUBE_CONFIG_FILE}" \
ubuntu/util.sh \ ubuntu/util.sh \
ubuntu/master/* \ ubuntu/master/* \
ubuntu/binaries/master/ \ ubuntu/binaries/master/ \
@ -407,7 +408,7 @@ function provision-master() {
mkdir -p /opt/bin/ mkdir -p /opt/bin/
cp ~/kube/master/* /opt/bin/ cp ~/kube/master/* /opt/bin/
service etcd start service etcd start
FLANNEL_NET=\"${FLANNEL_NET}\" ~/kube/reconfDocker.sh a FLANNEL_NET=\"${FLANNEL_NET}\" KUBE_CONFIG_FILE=\"${KUBE_CONFIG_FILE}\" ~/kube/reconfDocker.sh a
'" || { '" || {
echo "Deploying master on machine ${MASTER_IP} failed" echo "Deploying master on machine ${MASTER_IP} failed"
exit 1 exit 1
@ -422,7 +423,7 @@ function provision-node() {
# copy the binaries and scripts to the ~/kube directory on the node # copy the binaries and scripts to the ~/kube directory on the node
scp -r $SSH_OPTS \ scp -r $SSH_OPTS \
ubuntu/${KUBE_CONFIG_FILE:-config-default.sh} \ "${KUBE_CONFIG_FILE}" \
ubuntu/util.sh \ ubuntu/util.sh \
ubuntu/reconfDocker.sh \ ubuntu/reconfDocker.sh \
ubuntu/minion/* \ ubuntu/minion/* \
@ -459,7 +460,7 @@ function provision-node() {
mkdir -p /opt/bin/ mkdir -p /opt/bin/
cp ~/kube/minion/* /opt/bin cp ~/kube/minion/* /opt/bin
service flanneld start service flanneld start
~/kube/reconfDocker.sh i KUBE_CONFIG_FILE=\"${KUBE_CONFIG_FILE}\" ~/kube/reconfDocker.sh i
'" || { '" || {
echo "Deploying node on machine ${1#*@} failed" echo "Deploying node on machine ${1#*@} failed"
exit 1 exit 1
@ -476,7 +477,7 @@ function provision-masterandnode() {
# scp order matters # scp order matters
scp -r $SSH_OPTS \ scp -r $SSH_OPTS \
saltbase/salt/generate-cert/make-ca-cert.sh \ saltbase/salt/generate-cert/make-ca-cert.sh \
ubuntu/${KUBE_CONFIG_FILE:-config-default.sh} \ "${KUBE_CONFIG_FILE}" \
ubuntu/util.sh \ ubuntu/util.sh \
ubuntu/minion/* \ ubuntu/minion/* \
ubuntu/master/* \ ubuntu/master/* \
@ -539,7 +540,7 @@ function provision-masterandnode() {
cp ~/kube/minion/* /opt/bin/ cp ~/kube/minion/* /opt/bin/
service etcd start service etcd start
FLANNEL_NET=\"${FLANNEL_NET}\" ~/kube/reconfDocker.sh ai FLANNEL_NET=\"${FLANNEL_NET}\" KUBE_CONFIG_FILE=\"${KUBE_CONFIG_FILE}\" ~/kube/reconfDocker.sh ai
'" || { '" || {
echo "Deploying master and node on machine ${MASTER_IP} failed" echo "Deploying master and node on machine ${MASTER_IP} failed"
exit 1 exit 1
@ -562,9 +563,11 @@ function check-pods-torn-down() {
# Delete a kubernetes cluster # Delete a kubernetes cluster
function kube-down() { function kube-down() {
export KUBECTL_PATH="${KUBE_ROOT}/cluster/ubuntu/binaries/kubectl" export KUBECTL_PATH="${KUBE_ROOT}/cluster/ubuntu/binaries/kubectl"
source "${KUBE_ROOT}/cluster/ubuntu/${KUBE_CONFIG_FILE:-config-default.sh}"
export KUBE_CONFIG_FILE=${KUBE_CONFIG_FILE:-${KUBE_ROOT}/cluster/ubuntu/config-default.sh}
source "${KUBE_CONFIG_FILE}"
source "${KUBE_ROOT}/cluster/common.sh" source "${KUBE_ROOT}/cluster/common.sh"
tear_down_alive_resources tear_down_alive_resources
@ -647,7 +650,8 @@ function prepare-push() {
# Update a kubernetes master with expected release # Update a kubernetes master with expected release
function push-master() { function push-master() {
source "${KUBE_ROOT}/cluster/ubuntu/${KUBE_CONFIG_FILE:-config-default.sh}" export KUBE_CONFIG_FILE=${KUBE_CONFIG_FILE:-${KUBE_ROOT}/cluster/ubuntu/config-default.sh}
source "${KUBE_CONFIG_FILE}"
if [[ ! -f "${KUBE_ROOT}/cluster/ubuntu/binaries/master/kube-apiserver" ]]; then if [[ ! -f "${KUBE_ROOT}/cluster/ubuntu/binaries/master/kube-apiserver" ]]; then
echo "There is no required release of kubernetes, please check first" echo "There is no required release of kubernetes, please check first"
@ -702,7 +706,8 @@ function push-master() {
# Update a kubernetes node with expected release # Update a kubernetes node with expected release
function push-node() { function push-node() {
source "${KUBE_ROOT}/cluster/ubuntu/${KUBE_CONFIG_FILE:-config-default.sh}" export KUBE_CONFIG_FILE=${KUBE_CONFIG_FILE:-${KUBE_ROOT}/cluster/ubuntu/config-default.sh}
source "${KUBE_CONFIG_FILE}"
if [[ ! -f "${KUBE_ROOT}/cluster/ubuntu/binaries/minion/kubelet" ]]; then if [[ ! -f "${KUBE_ROOT}/cluster/ubuntu/binaries/minion/kubelet" ]]; then
echo "There is no required release of kubernetes, please check first" echo "There is no required release of kubernetes, please check first"
@ -764,7 +769,8 @@ function push-node() {
# Update a kubernetes cluster with expected source # Update a kubernetes cluster with expected source
function kube-push() { function kube-push() {
prepare-push prepare-push
source "${KUBE_ROOT}/cluster/ubuntu/${KUBE_CONFIG_FILE:-config-default.sh}" export KUBE_CONFIG_FILE=${KUBE_CONFIG_FILE:-${KUBE_ROOT}/cluster/ubuntu/config-default.sh}
source "${KUBE_CONFIG_FILE}"
if [[ ! -f "${KUBE_ROOT}/cluster/ubuntu/binaries/master/kube-apiserver" ]]; then if [[ ! -f "${KUBE_ROOT}/cluster/ubuntu/binaries/master/kube-apiserver" ]]; then
echo "There is no required release of kubernetes, please check first" echo "There is no required release of kubernetes, please check first"

View File

@ -156,7 +156,7 @@ bring up the whole cluster.
`$ KUBERNETES_PROVIDER=ubuntu ./kube-up.sh` `$ KUBERNETES_PROVIDER=ubuntu ./kube-up.sh`
The scripts automatically `scp` binaries and config files to all the machines and start kubernetes The scripts automatically copy binaries and config files to all the machines via `scp` and start kubernetes
service on them. The only thing you need to do is to type the sudo password when promoted. service on them. The only thing you need to do is to type the sudo password when promoted.
```console ```console