Merge pull request #6756 from lhuard1A/libvirt-coreos_etcd2
libvirt-coreos cluster: Fix etcd versions incompatibility issue
This commit is contained in:
commit
13b2243325
1
cluster/libvirt-coreos/.gitignore
vendored
1
cluster/libvirt-coreos/.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
/libvirt_storage_pool/
|
/libvirt_storage_pool/
|
||||||
/coreos_production_qemu_image.img.bz2
|
/coreos_production_qemu_image.img.bz2
|
||||||
|
/etcd-v2.0.9-linux-amd64.tar.gz
|
||||||
|
@ -35,6 +35,11 @@
|
|||||||
<target dir='kubernetes'/>
|
<target dir='kubernetes'/>
|
||||||
<readonly/>
|
<readonly/>
|
||||||
</filesystem>
|
</filesystem>
|
||||||
|
<filesystem type='mount' accessmode='squash'>
|
||||||
|
<source dir='${etcd_dir}'/>
|
||||||
|
<target dir='etcd'/>
|
||||||
|
<readonly/>
|
||||||
|
</filesystem>
|
||||||
<interface type='network'>
|
<interface type='network'>
|
||||||
<mac address='52:54:00:00:00:${i}'/>
|
<mac address='52:54:00:00:00:${i}'/>
|
||||||
<source network='kubernetes_global'/>
|
<source network='kubernetes_global'/>
|
||||||
|
@ -17,11 +17,22 @@ coreos:
|
|||||||
etcd:
|
etcd:
|
||||||
name: ${name}
|
name: ${name}
|
||||||
addr: ${public_ip}:4001
|
addr: ${public_ip}:4001
|
||||||
bind-addr: 0.0.0.0
|
# bind-addr: 0.0.0.0
|
||||||
peer-addr: ${public_ip}:7001
|
peer-addr: ${public_ip}:7001
|
||||||
# peers: {etcd_peers}
|
# peers: {etcd_peers}
|
||||||
discovery: ${discovery}
|
discovery: ${discovery}
|
||||||
units:
|
units:
|
||||||
|
- name: etcd.service
|
||||||
|
drop-ins:
|
||||||
|
- name: opt-etcd2.conf
|
||||||
|
content: |
|
||||||
|
[Unit]
|
||||||
|
After=opt-etcd.mount
|
||||||
|
Requires=opt-etcd.mount
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=
|
||||||
|
ExecStart=/opt/etcd/bin/etcd
|
||||||
- name: static.network
|
- name: static.network
|
||||||
command: start
|
command: start
|
||||||
content: |
|
content: |
|
||||||
@ -103,6 +114,17 @@ coreos:
|
|||||||
Where=/opt/kubernetes
|
Where=/opt/kubernetes
|
||||||
Options=ro,trans=virtio,version=9p2000.L
|
Options=ro,trans=virtio,version=9p2000.L
|
||||||
Type=9p
|
Type=9p
|
||||||
|
- name: opt-etcd.mount
|
||||||
|
command: start
|
||||||
|
content: |
|
||||||
|
[Unit]
|
||||||
|
ConditionVirtualization=|vm
|
||||||
|
|
||||||
|
[Mount]
|
||||||
|
What=etcd
|
||||||
|
Where=/opt/etcd
|
||||||
|
Options=ro,trans=virtio,version=9p2000.L
|
||||||
|
Type=9p
|
||||||
update:
|
update:
|
||||||
group: ${COREOS_CHANNEL:-alpha}
|
group: ${COREOS_CHANNEL:-alpha}
|
||||||
reboot-strategy: off
|
reboot-strategy: off
|
||||||
|
@ -25,6 +25,8 @@ export LIBVIRT_DEFAULT_URI=qemu:///system
|
|||||||
readonly POOL=kubernetes
|
readonly POOL=kubernetes
|
||||||
readonly POOL_PATH="$(cd $ROOT && pwd)/libvirt_storage_pool"
|
readonly POOL_PATH="$(cd $ROOT && pwd)/libvirt_storage_pool"
|
||||||
|
|
||||||
|
ETCD_VERSION=${ETCD_VERSION:-v2.0.9}
|
||||||
|
|
||||||
# join <delim> <list...>
|
# join <delim> <list...>
|
||||||
# Concatenates the list elements with the delimiter passed as first parameter
|
# Concatenates the list elements with the delimiter passed as first parameter
|
||||||
#
|
#
|
||||||
@ -93,6 +95,9 @@ function destroy-pool {
|
|||||||
virsh vol-delete $vol --pool $POOL
|
virsh vol-delete $vol --pool $POOL
|
||||||
done
|
done
|
||||||
|
|
||||||
|
rm -rf "$POOL_PATH"/etcd/*
|
||||||
|
virsh vol-delete etcd --pool $POOL || true
|
||||||
|
|
||||||
[[ "$1" == 'keep_base_image' ]] && return
|
[[ "$1" == 'keep_base_image' ]] && return
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
@ -140,6 +145,18 @@ function initialize-pool {
|
|||||||
render-template "$ROOT/skydns-rc.yaml" > "$POOL_PATH/kubernetes/addons/skydns-rc.yaml"
|
render-template "$ROOT/skydns-rc.yaml" > "$POOL_PATH/kubernetes/addons/skydns-rc.yaml"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
mkdir -p "$POOL_PATH/etcd"
|
||||||
|
if [[ ! -f "$ROOT/etcd-${ETCD_VERSION}-linux-amd64.tar.gz" ]]; then
|
||||||
|
wget -P "$ROOT" https://github.com/coreos/etcd/releases/download/${ETCD_VERSION}/etcd-${ETCD_VERSION}-linux-amd64.tar.gz
|
||||||
|
fi
|
||||||
|
if [[ "$ROOT/etcd-${ETCD_VERSION}-linux-amd64.tar.gz" -nt "$POOL_PATH/etcd/etcd" ]]; then
|
||||||
|
tar -x -C "$POOL_PATH/etcd" -f "$ROOT/etcd-${ETCD_VERSION}-linux-amd64.tar.gz" etcd-${ETCD_VERSION}-linux-amd64
|
||||||
|
rm -rf "$POOL_PATH/etcd/bin/*"
|
||||||
|
mkdir -p "$POOL_PATH/etcd/bin"
|
||||||
|
mv "$POOL_PATH"/etcd/etcd-${ETCD_VERSION}-linux-amd64/{etcd,etcdctl} "$POOL_PATH/etcd/bin"
|
||||||
|
rm -rf "$POOL_PATH/etcd/etcd-${ETCD_VERSION}-linux-amd64"
|
||||||
|
fi
|
||||||
|
|
||||||
virsh pool-refresh $POOL
|
virsh pool-refresh $POOL
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,6 +204,7 @@ function kube-up {
|
|||||||
|
|
||||||
readonly ssh_keys="$(cat ~/.ssh/id_*.pub | sed 's/^/ - /')"
|
readonly ssh_keys="$(cat ~/.ssh/id_*.pub | sed 's/^/ - /')"
|
||||||
readonly kubernetes_dir="$POOL_PATH/kubernetes"
|
readonly kubernetes_dir="$POOL_PATH/kubernetes"
|
||||||
|
readonly etcd_dir="$POOL_PATH/etcd"
|
||||||
readonly discovery=$(curl -s https://discovery.etcd.io/new)
|
readonly discovery=$(curl -s https://discovery.etcd.io/new)
|
||||||
|
|
||||||
readonly machines=$(join , "${KUBE_MINION_IP_ADDRESSES[@]}")
|
readonly machines=$(join , "${KUBE_MINION_IP_ADDRESSES[@]}")
|
||||||
|
Loading…
Reference in New Issue
Block a user