diff options
Diffstat (limited to 'docker/ceph/ceph-osd')
| -rw-r--r-- | docker/ceph/ceph-osd/Dockerfile.j2 | 7 | ||||
| -rw-r--r-- | docker/ceph/ceph-osd/config-external.sh | 10 | ||||
| -rw-r--r-- | docker/ceph/ceph-osd/start.sh | 35 |
3 files changed, 52 insertions, 0 deletions
diff --git a/docker/ceph/ceph-osd/Dockerfile.j2 b/docker/ceph/ceph-osd/Dockerfile.j2 new file mode 100644 index 000000000..e9d47fc70 --- /dev/null +++ b/docker/ceph/ceph-osd/Dockerfile.j2 @@ -0,0 +1,7 @@ +FROM {{ namespace }}/{{ base_distro }}-{{ install_type }}-ceph-base:{{ tag }} +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +COPY start.sh / +COPY config-external.sh /opt/kolla/ + +CMD ["/start.sh"] diff --git a/docker/ceph/ceph-osd/config-external.sh b/docker/ceph/ceph-osd/config-external.sh new file mode 100644 index 000000000..8e17487ed --- /dev/null +++ b/docker/ceph/ceph-osd/config-external.sh @@ -0,0 +1,10 @@ +#!/bin/bash +SOURCE="/opt/kolla/ceph-osd/ceph.conf" +TARGET="/etc/ceph/ceph.conf" +OWNER="ceph" + +if [[ -f "$SOURCE" ]]; then + cp $SOURCE $TARGET + chown ${OWNER}: $TARGET + chmod 0644 $TARGET +fi diff --git a/docker/ceph/ceph-osd/start.sh b/docker/ceph/ceph-osd/start.sh new file mode 100644 index 000000000..cf9114a62 --- /dev/null +++ b/docker/ceph/ceph-osd/start.sh @@ -0,0 +1,35 @@ +#!/bin/bash +set -o errexit + +CMD="/usr/bin/ceph-osd" +ARGS="-f -d -i ${OSD_ID} --osd-journal ${OSD_DIR}/journal -k ${OSD_DIR}/keyring" + +# Loading common functions. +source /opt/kolla/kolla-common.sh + +# Execute config strategy +set_configs + +# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases +# of the KOLLA_BOOTSTRAP variable being set, including empty. +if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then + # Creating a new label for the disk + parted "${OSD_DEV}" -s -- mklabel gpt + + # Preparing the OSD for use with Ceph + ceph-disk prepare "${OSD_DEV}" + OSD_ID="$(ceph osd create)" + OSD_DIR="/var/lib/ceph/osd/ceph-${OSD_ID}" + mkdir -p "${OSD_DIR}" + mount "${OSD_DEV}1" "${OSD_DIR}" + ceph-osd -i "${OSD_ID}" --mkfs --mkkey + ceph auth add "osd.${OSD_ID}" osd 'allow *' mon 'allow proflie osd' -i "${OSD_DIR}/keyring" + + # Adding osd to crush map + ceph osd crush add-bucket "$(hostname)" host + ceph osd crush move "$(hostname)" root=default + ceph osd crush add "${OSD_ID}" "${OSD_INITIAL_WEIGHT}" host="$(hostname)" + exit 0 +fi + +exec $CMD $ARGS |
