mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-21 18:11:35 +00:00
demo: Update etcd to use the new mount container
Rolling updates still work Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
parent
9d1b120498
commit
baab60ea87
@ -4,38 +4,7 @@
|
|||||||
set -x
|
set -x
|
||||||
set -v
|
set -v
|
||||||
|
|
||||||
MOUNTPOINT=/var/etcd
|
DATADIR=/var/lib/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
|
|
||||||
|
|
||||||
# Wait till we have an IP address
|
# Wait till we have an IP address
|
||||||
IP=""
|
IP=""
|
||||||
@ -63,7 +32,7 @@ INIT_CLUSTER="infra200=http://${PREFIX}.200:2380,infra201=http://${PREFIX}.201:2
|
|||||||
--name ${NAME} \
|
--name ${NAME} \
|
||||||
--debug \
|
--debug \
|
||||||
--log-package-levels etcdmain=DEBUG,etcdserver=DEBUG \
|
--log-package-levels etcdmain=DEBUG,etcdserver=DEBUG \
|
||||||
--data-dir $MOUNTPOINT \
|
--data-dir $DATADIR \
|
||||||
--initial-advertise-peer-urls http://${IP}:2380 \
|
--initial-advertise-peer-urls http://${IP}:2380 \
|
||||||
--listen-peer-urls http://${IP}:2380 \
|
--listen-peer-urls http://${IP}:2380 \
|
||||||
--listen-client-urls http://${IP}:2379,http://127.0.0.1:2379 \
|
--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} \
|
--name ${NAME} \
|
||||||
--debug \
|
--debug \
|
||||||
--log-package-levels etcdmain=DEBUG,etcdserver=DEBUG \
|
--log-package-levels etcdmain=DEBUG,etcdserver=DEBUG \
|
||||||
--data-dir $MOUNTPOINT \
|
--data-dir $DATADIR \
|
||||||
--initial-advertise-peer-urls http://${IP}:2380 \
|
--initial-advertise-peer-urls http://${IP}:2380 \
|
||||||
--listen-peer-urls http://${IP}:2380 \
|
--listen-peer-urls http://${IP}:2380 \
|
||||||
--listen-client-urls http://${IP}:2379,http://127.0.0.1:2379 \
|
--listen-client-urls http://${IP}:2379,http://127.0.0.1:2379 \
|
||||||
|
@ -2,9 +2,10 @@ kernel:
|
|||||||
image: "mobylinux/kernel:4.9.x"
|
image: "mobylinux/kernel:4.9.x"
|
||||||
cmdline: "console=ttyS0 console=tty0 page_poison=1"
|
cmdline: "console=ttyS0 console=tty0 page_poison=1"
|
||||||
init:
|
init:
|
||||||
- mobylinux/init:925c88f42d92d57cd36b656db1f8757b152163a7
|
- mobylinux/init:4a731380d1d9b29472c7de165a1cdf93136ab1e7
|
||||||
- mobylinux/runc:b0fb122e10dbb7e4e45115177a61a3f8d68c19a9
|
- mobylinux/runc:b0fb122e10dbb7e4e45115177a61a3f8d68c19a9
|
||||||
- mobylinux/containerd:c7f6ecdcbcb615a53edee556ba03c7c873bc8488
|
- mobylinux/containerd:c7f6ecdcbcb615a53edee556ba03c7c873bc8488
|
||||||
|
- mobylinux/ca-certificates:eabc5a6e59f05aa91529d80e9a595b85b046f935
|
||||||
onboot:
|
onboot:
|
||||||
- name: sysctl
|
- name: sysctl
|
||||||
image: "mobylinux/sysctl:2cf2f9d5b4d314ba1bfc22b2fe931924af666d8c"
|
image: "mobylinux/sysctl:2cf2f9d5b4d314ba1bfc22b2fe931924af666d8c"
|
||||||
@ -21,6 +22,15 @@ onboot:
|
|||||||
capabilities:
|
capabilities:
|
||||||
- CAP_SYS_ADMIN
|
- CAP_SYS_ADMIN
|
||||||
- CAP_MKNOD
|
- 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:
|
services:
|
||||||
- name: rngd
|
- name: rngd
|
||||||
image: "mobylinux/rngd:3dad6dd43270fa632ac031e99d1947f20b22eec9@sha256:1c93c1db7196f6f71f8e300bc1d15f0376dd18e8891c8789d77c8ff19f3a9a92"
|
image: "mobylinux/rngd:3dad6dd43270fa632ac031e99d1947f20b22eec9@sha256:1c93c1db7196f6f71f8e300bc1d15f0376dd18e8891c8789d77c8ff19f3a9a92"
|
||||||
@ -50,7 +60,8 @@ services:
|
|||||||
- CAP_MKNOD
|
- CAP_MKNOD
|
||||||
net: host
|
net: host
|
||||||
binds:
|
binds:
|
||||||
- /dev:/dev
|
- /var/lib/etcd:/var/lib/etcd
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
- format: kernel+initrd
|
- format: kernel+initrd
|
||||||
# - format: gcp
|
# - format: gcp
|
||||||
|
Loading…
Reference in New Issue
Block a user