Merge pull request #1562 from rneugeba/demo-up

demo: Update etcd to use the new mount container
This commit is contained in:
Justin Cormack 2017-04-09 21:00:26 +01:00 committed by GitHub
commit 82d960c604
2 changed files with 16 additions and 36 deletions

View File

@ -4,38 +4,7 @@
set -x
set -v
MOUNTPOINT=/var/etcd
mount_drive()
{
mkdir -p "$MOUNTPOINT"
# TODO fix for multiple disks, cdroms etc
DEVS="$(find /dev -maxdepth 1 -type b ! -name 'loop*' ! -name 'nbd*' | grep -v '[0-9]$' | sed 's@.*/dev/@@' | sort)"
for DEV in $DEVS
do
DRIVE="/dev/${DEV}"
# see if it has a partition table
if sfdisk -d "${DRIVE}" >/dev/null 2>/dev/null
then
# 83 is Linux partition identifier
DATA=$(sfdisk -J "$DRIVE" | jq -e -r '.partitiontable.partitions | map(select(.type=="83")) | .[0].node')
if [ $? -eq 0 ]
then
mount "$DATA" "$MOUNTPOINT" && return
fi
fi
done
echo "WARNING: Failed to mount a persistent volume (is there one?)"
# not sure if we want to fatally bail here, in some debug situations it is ok
# exit 1
}
mount_drive
DATADIR=/var/lib/etcd
# Wait till we have an IP address
IP=""
@ -63,7 +32,7 @@ INIT_CLUSTER="infra200=http://${PREFIX}.200:2380,infra201=http://${PREFIX}.201:2
--name ${NAME} \
--debug \
--log-package-levels etcdmain=DEBUG,etcdserver=DEBUG \
--data-dir $MOUNTPOINT \
--data-dir $DATADIR \
--initial-advertise-peer-urls http://${IP}:2380 \
--listen-peer-urls http://${IP}:2380 \
--listen-client-urls http://${IP}:2379,http://127.0.0.1:2379 \
@ -79,7 +48,7 @@ INIT_CLUSTER="infra200=http://${PREFIX}.200:2380,infra201=http://${PREFIX}.201:2
--name ${NAME} \
--debug \
--log-package-levels etcdmain=DEBUG,etcdserver=DEBUG \
--data-dir $MOUNTPOINT \
--data-dir $DATADIR \
--initial-advertise-peer-urls http://${IP}:2380 \
--listen-peer-urls http://${IP}:2380 \
--listen-client-urls http://${IP}:2379,http://127.0.0.1:2379 \

View File

@ -2,9 +2,10 @@ kernel:
image: "mobylinux/kernel:4.9.x"
cmdline: "console=ttyS0 console=tty0 page_poison=1"
init:
- mobylinux/init:925c88f42d92d57cd36b656db1f8757b152163a7
- mobylinux/init:4a731380d1d9b29472c7de165a1cdf93136ab1e7
- mobylinux/runc:b0fb122e10dbb7e4e45115177a61a3f8d68c19a9
- mobylinux/containerd:c7f6ecdcbcb615a53edee556ba03c7c873bc8488
- mobylinux/ca-certificates:eabc5a6e59f05aa91529d80e9a595b85b046f935
onboot:
- name: sysctl
image: "mobylinux/sysctl:2cf2f9d5b4d314ba1bfc22b2fe931924af666d8c"
@ -21,6 +22,15 @@ onboot:
capabilities:
- CAP_SYS_ADMIN
- CAP_MKNOD
- name: mount
image: "mobylinux/mount:d2669e7c8ddda99fa0618a414d44261eba6e299a"
binds:
- /dev:/dev
- /var:/var:rshared,rbind
capabilities:
- CAP_SYS_ADMIN
rootfsPropagation: shared
command: ["/mount.sh", "/var/lib/etcd"]
services:
- name: rngd
image: "mobylinux/rngd:3dad6dd43270fa632ac031e99d1947f20b22eec9@sha256:1c93c1db7196f6f71f8e300bc1d15f0376dd18e8891c8789d77c8ff19f3a9a92"
@ -50,7 +60,8 @@ services:
- CAP_MKNOD
net: host
binds:
- /dev:/dev
- /var/lib/etcd:/var/lib/etcd
outputs:
- format: kernel+initrd
# - format: gcp