ceph-container构建

使用官方ceph-container工程构建私人定制的ceph/daemon镜像。本文以mimic版本为例,在对mimic进行二次开发后,将生成的rpm包更新到yum源中,再生成新的ceph-release中使用该yum源。

获取官方ceph-container

1
git clone git@github.com:ceph/ceph-container.git

安装私有Ceph.repo

修改获取ceph-releaseRPM包地址,编辑文件./ceph-releases/ALL/centos/daemon-base/__DOCKERFILE_INSTALL__

eg:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
yum install -y epel-release && \
yum install -y jq && \
bash -c ' \
if [ -n "__GANESHA_PACKAGES__" ]; then \
echo "[ganesha]" > /etc/yum.repos.d/ganesha.repo ; \
echo "name=ganesha" >> /etc/yum.repos.d/ganesha.repo ; \
if [[ "${CEPH_VERSION}" =~ master|^wip* ]]; then \
REPO_URL=$(curl -s "https://shaman.ceph.com/api/search/?project=nfs-ganesha&distros=centos/__ENV_[BASEOS_TAG]__&flavor=ceph_master&ref=next&sha1=latest" | jq -a ".[0] | .url"); \
echo "baseurl=$REPO_URL/\$basearch/" >> /etc/yum.repos.d/ganesha.repo ; \
elif [[ "${CEPH_VERSION}" == nautilus ]]; then \
echo "baseurl=http://download.ceph.com/nfs-ganesha/rpm-V2.8-stable/$CEPH_VERSION/\$basearch/" >> /etc/yum.repos.d/ganesha.repo ; \
else \
echo "baseurl=http://download.ceph.com/nfs-ganesha/rpm-V2.7-stable/$CEPH_VERSION/\$basearch/" >> /etc/yum.repos.d/ganesha.repo ; \
fi ; \
echo "gpgcheck=0" >> /etc/yum.repos.d/ganesha.repo ; \
echo "enabled=1" >> /etc/yum.repos.d/ganesha.repo ; \
fi ; \
if [ -n "__ISCSI_PACKAGES__" ]; then \
for repo in tcmu-runner python-rtslib; do \
curl -s -L https://shaman.ceph.com/api/repos/$repo/master/latest/__ENV_[BASEOS_REPO]__/__ENV_[BASEOS_TAG]__/repo > /etc/yum.repos.d/$repo.repo ; \
done ; \
if [[ "${CEPH_VERSION}" =~ master|^wip* ]]; then \
curl -s -L https://shaman.ceph.com/api/repos/ceph-iscsi/master/latest/__ENV_[BASEOS_REPO]__/__ENV_[BASEOS_TAG]__/repo > /etc/yum.repos.d/ceph-iscsi.repo ; \
elif [[ "${CEPH_VERSION}" == nautilus ]]; then \
curl -s -L https://download.ceph.com/ceph-iscsi/3/rpm/el__ENV_[BASEOS_TAG]__/ceph-iscsi.repo -o /etc/yum.repos.d/ceph-iscsi.repo ; \
else \
curl -s -L https://download.ceph.com/ceph-iscsi/2/rpm/el__ENV_[BASEOS_TAG]__/ceph-iscsi.repo -o /etc/yum.repos.d/ceph-iscsi.repo ; \
fi ; \
fi' && \
yum update -y && \
rpm --import 'https://download.ceph.com/keys/release.asc' && \
bash -c ' \
if [[ "${CEPH_VERSION}" =~ master|^wip* ]] || ${CEPH_DEVEL}; then \
REPO_URL=$(curl -s "https://shaman.ceph.com/api/search/?project=ceph&distros=centos/__ENV_[BASEOS_TAG]__&flavor=default&ref=${CEPH_VERSION}&sha1=latest" | jq -a ".[0] | .url"); \
RELEASE_VER=0 ;\
else \
RELEASE_VER=1 ;\
REPO_URL="http://10.100.13.112/rpm-${CEPH_VERSION}/el__ENV_[BASEOS_TAG]__/"; \
fi && \
rpm -Uvh "$REPO_URL/noarch/ceph-release-1-${RELEASE_VER}.el__ENV_[BASEOS_TAG]__.noarch.rpm" ' && \
yum install -y __CEPH_BASE_PACKAGES__ && \
bash -c ' \
if [[ "${CEPH_VERSION}" =~ master|^wip* ]] || ${CEPH_DEVEL}; then \
yum install -y python-pip ; \
pip install -U remoto ; \
yum remove -y python-pip ; \
fi '

REPO_URL使用您指定的yum源。

指定版本构建镜像

1
make FLAVORS=mimic-13.2.6-1.gba13b2d.el7,centos,7 build

参考&鸣谢