@@ -6,6 +6,7 @@ REMOTE_PORT=${REMOTE_PORT:-22}
66CLUSTER_DIR=${CLUSTER_DIR:- cluster}
77IDENT=${IDENT:- ${HOME} / .ssh/ id_rsa}
88SSH_OPTS=${SSH_OPTS:- }
9+ SELF_HOST_ETCD=${SELF_HOST_ETCD:- false}
910
1011BOOTKUBE_REPO=${BOOTKUBE_REPO:- quay.io/ coreos/ bootkube}
1112BOOTKUBE_VERSION=${BOOTKUBE_VERSION:- v0.3.9}
@@ -37,16 +38,25 @@ function init_master_node() {
3738 systemctl daemon-reload
3839 systemctl stop update-engine; systemctl mask update-engine
3940
41+ etcd_render_flags=" "
42+ etcd_start_flags=" "
43+
4044 # Start etcd.
41- configure_etcd
42- systemctl enable etcd-member; sudo systemctl start etcd-member
45+ if [ " $SELF_HOST_ETCD " = true ] ; then
46+ echo " WARNING: THIS IS NOT YET FULLY WORKING - merely here to make ongoing testing easier"
47+ etcd_render_flags=" --etcd-servers=http://10.3.0.15:2379 --experimental-self-hosted-etcd"
48+ etcd_start_flags=" --etcd-server=http://${COREOS_PRIVATE_IPV4} :12379 --experimental-self-hosted-etcd"
49+ else
50+ configure_etcd
51+ systemctl enable etcd-member; sudo systemctl start etcd-member
52+ fi
4353
4454 # Render cluster assets
4555 /usr/bin/rkt run \
4656 --volume home,kind=host,source=/home/core \
4757 --mount volume=home,target=/core \
4858 --trust-keys-from-https --net=host ${BOOTKUBE_REPO} :${BOOTKUBE_VERSION} --exec \
49- /bootkube -- render --asset-dir=/core/assets --api-servers=https://${COREOS_PUBLIC_IPV4} :443,https://${COREOS_PRIVATE_IPV4} :443
59+ /bootkube -- render --asset-dir=/core/assets --api-servers=https://${COREOS_PUBLIC_IPV4} :443,https://${COREOS_PRIVATE_IPV4} :443 ${etcd_render_flags}
5060
5161 # Move the local kubeconfig into expected location
5262 chown -R core:core /home/core/assets
@@ -61,8 +71,10 @@ function init_master_node() {
6171 /usr/bin/rkt run \
6272 --volume home,kind=host,source=/home/core \
6373 --mount volume=home,target=/core \
74+ --volume manifests,kind=host,source=/etc/kubernetes/manifests \
75+ --mount volume=manifests,target=/etc/kubernetes/manifests \
6476 --net=host ${BOOTKUBE_REPO} :${BOOTKUBE_VERSION} --exec \
65- /bootkube -- start --asset-dir=/core/assets
77+ /bootkube -- start --asset-dir=/core/assets ${etcd_start_flags}
6678}
6779
6880[ " $# " == 1 ] || usage
@@ -81,7 +93,7 @@ if [ "${REMOTE_HOST}" != "local" ]; then
8193
8294 # Copy self to remote host so script can be executed in "local" mode
8395 scp -i ${IDENT} -P ${REMOTE_PORT} ${SSH_OPTS} ${BASH_SOURCE[0]} core@${REMOTE_HOST} :/home/core/init-master.sh
84- ssh -i ${IDENT} -p ${REMOTE_PORT} ${SSH_OPTS} core@${REMOTE_HOST} " sudo BOOTKUBE_REPO=${BOOTKUBE_REPO} BOOTKUBE_VERSION=${BOOTKUBE_VERSION} /home/core/init-master.sh local"
96+ ssh -i ${IDENT} -p ${REMOTE_PORT} ${SSH_OPTS} core@${REMOTE_HOST} " sudo BOOTKUBE_REPO=${BOOTKUBE_REPO} BOOTKUBE_VERSION=${BOOTKUBE_VERSION} SELF_HOST_ETCD= ${SELF_HOST_ETCD} /home/core/init-master.sh local"
8597
8698 # Copy assets from remote host to a local directory. These can be used to launch additional nodes & contain TLS assets
8799 mkdir ${CLUSTER_DIR}
0 commit comments