Skip to content

Commit

Permalink
Merge pull request #16 from alexzhc/main
Browse files Browse the repository at this point in the history
Downgrade DRBD to v9.0.32 and Utils to v9.12.1 for compatibilty with Hwameistor
  • Loading branch information
alexzhc authored Sep 7, 2022
2 parents 27616a2 + 7b81432 commit aaad620
Show file tree
Hide file tree
Showing 19 changed files with 128 additions and 256 deletions.
24 changes: 6 additions & 18 deletions .github/workflows/release-chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,11 @@ jobs:
config: helm/.cr/config.yaml
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Set up yq
uses: mikefarah/yq@master
- name: Merge index.yaml
run: |
sleep 60
mkdir -vp /tmp/gh
curl https://raw.githubusercontent.com/${GIT_ORG}/hwameistor/gh-pages/index.yaml > /tmp/gh/hms.yaml
curl https://raw.githubusercontent.com/${GIT_ORG}/drbd-adapter/gh-pages/index.yaml > /tmp/gh/dra.yaml
yq eval-all '. as $item ireduce ({}; . * $item)' /tmp/gh/hms.yaml /tmp/gh/dra.yaml > /tmp/gh/index.yaml
cat /tmp/gh/index.yaml
- name: Pushes to hwameistor main repo
uses: cpina/github-action-push-to-another-repository@main
env:
SSH_DEPLOY_KEY: ${{ secrets.GH_PAGES_DEPLOY }}
with:
source-directory: /tmp/gh
destination-github-username: ${{ env.GIT_ORG }}
destination-repository-name: hwameistor
user-email: [email protected]
target-branch: gh-pages
sudo snap install yq
sleep 10
curl https://raw.githubusercontent.com/${GIT_ORG}/hwameistor/gh-pages/index.yaml > hms.yaml
curl https://raw.githubusercontent.com/${GIT_ORG}/drbd-adapter/gh-pages/index.yaml > dra.yaml
yq eval-all '. as $item ireduce ({}; . * $item)' hms.yaml dra.yaml > index.yaml
cat index.yaml
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
DRBD_VER ?= 9.1.10
DRBD_UTILS_VER ?= 9.21.4
DRBD_VER ?= 9.0.32-1
DRBD_UTILS_VER ?= 9.12.1
DRBD_HEADERS_SHA ?= c757cf357edef67751b8f45a6ea894d287180087
KVER := $(shell uname -r)
DIST ?= rhel7
ENTRY ?= /pkgs/entrypoint.adapter.sh
Expand Down Expand Up @@ -36,6 +37,7 @@ shipper:
--build-arg FTP_PROXY=${ftp_proxy} \
--build-arg DRBD_VER=$(DRBD_VER) \
--build-arg DRBD_UTILS_VER=$(DRBD_UTILS_VER) \
--build-arg DRBD_HEADERS_SHA=$(DRBD_HEADERS_SHA) \
-t drbd9-shipper:v$(DRBD_VER)

cleanup:
Expand Down
24 changes: 20 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,22 @@ LINBIT/drbd <https://github.com/LINBIT/drbd/tree/drbd-9.1/docker>

* x86_64

## DRBD Versions

* DRBD: v9.0.32-1
* DRBD Utils: v9.12.1

## OS Distro Support

* RHEL/CentOS 7
* RHEL/CentOS 7
* RHEL/CentOS 8
* Kylin V10
* Ubuntu 18 Bionic
* Ubuntu 20 Focal
* Ubuntu 22 Jammy

### Not Supported, but for test only

* Ubuntu 22 Jammy (will install DRBD v9.1.10 )

## Kubernetes Version

Expand All @@ -52,7 +60,7 @@ $ apt-get install -y linux-headers-$(uname -r)
### Deploy by Helm Charts
Deploy the below `DaemonSet`. It will bring up a pod on each kubernetes worker node to install DRBD modules and tools:

```
```console
$ helm repo add hwameistor https://hwameistor.io/hwameistor

$ helm repo update hwameistor
Expand All @@ -62,6 +70,15 @@ $ helm pull hwameistor/drbd-adapter --untar
$ helm install drbd-adapter ./drbd-adapter -n hwameistor --create-namespace
```

Users in China may use daocloud.io/daocloud mirror to accelerate image pull:

```console
$ helm install drbd-adapter ./drbd-adapter \
-n hwameistor --create-namespace \
--set imagePullPolicy=Always \
--set registry=daocloud.io/daocloud
```

### Set OS Distros

By default, OS distros are auto-detected by helm `lookup` function.
Expand All @@ -78,7 +95,6 @@ distros:
- rhel8
- bionic
#- focal
#- jammy
```

### Post-installation Check
Expand Down
2 changes: 2 additions & 0 deletions docker-drbd9/Dockerfile.jammy
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ RUN chmod +x /entry.sh
ENTRYPOINT /entry.sh

ENV DRBD_VERSION 9.1.8

RUN apt-get update && apt-get install -y coccinelle --fix-missing && apt-get clean
2 changes: 1 addition & 1 deletion docker-drbd9/Dockerfile.rhel7
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ RUN yum -y update-minimal --security --sec-severity=Important --sec-severity=Cri
rm -rf python-lbdist-master master.tar.gz

# one can not comment copy
RUN wget https://pkg.linbit.com/downloads/drbd/9/drbd-${DRBD_VERSION}.tar.gz -O /drbd.tar.gz # !lbbuild
RUN wget https://pkg.linbit.com/downloads/drbd/"$([[ $DRBD_VERSION =~ ^9.0 ]] && echo 9.0 || echo 9 )"/drbd-${DRBD_VERSION}.tar.gz -O /drbd.tar.gz # !lbbuild
# =lbbuild COPY /drbd.tar.gz /

COPY /pkgs /pkgs
Expand Down
2 changes: 1 addition & 1 deletion docker-drbd9/Dockerfile.rhel8
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ RUN yum install -y /pkgs/*.rpm # !lbbuild
RUN rm -rf /pkgs

# one can not comment copy
RUN wget https://pkg.linbit.com/downloads/drbd/9/drbd-${DRBD_VERSION}.tar.gz -O /drbd.tar.gz # !lbbuild
RUN wget https://pkg.linbit.com/downloads/drbd/"$([[ $DRBD_VERSION =~ ^9.0 ]] && echo 9.0 || echo 9 )"/drbd-${DRBD_VERSION}.tar.gz -O /drbd.tar.gz # !lbbuild
# =lbbuild COPY /drbd.tar.gz /

# these are now the kmod pkgs:
Expand Down
2 changes: 1 addition & 1 deletion docker-drbd9/Dockerfile.rhel9
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ RUN dnf install -y /pkgs/*.rpm # !lbbuild
RUN rm -rf /pkgs

# one can not comment copy
RUN curl -fsSL https://pkg.linbit.com/downloads/drbd/9/drbd-${DRBD_VERSION}.tar.gz -o /drbd.tar.gz # !lbbuild
RUN curl -fsSL https://pkg.linbit.com/downloads/drbd/"$([[ $DRBD_VERSION =~ ^9.0 ]] && echo 9.0 || echo 9 )"/drbd-${DRBD_VERSION}.tar.gz -o /drbd.tar.gz # !lbbuild
# =lbbuild COPY /drbd.tar.gz /

# these are now the kmod pkgs:
Expand Down
4 changes: 2 additions & 2 deletions docker-drbd9/build.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash -x

DRBD_VER=${1:-9.1.10}
DRBD_VER=${1:-9.0.32-1}

[ -z "$DRBD_VER" ] && echo "Need a DRBD version !" && exit 1

sed -i "s/^ENV DRBD_VERSION.*/ENV DRBD_VERSION ${DRBD_VER}/" Dockerfile.*

[ -f ./drbd.tar.gz ] || wget https://pkg.linbit.com/downloads/drbd/9/drbd-${DRBD_VER}.tar.gz -O ./drbd.tar.gz
[ -f ./drbd.tar.gz ] || wget https://pkg.linbit.com/downloads/drbd/"$([[ $DRBD_VER =~ ^9.0 ]] && echo 9.0 || echo 9 )"/drbd-${DRBD_VER}.tar.gz -O ./drbd.tar.gz

for i in rhel7 rhel8 bionic focal jammy; do
df="Dockerfile.${i}"
Expand Down
8 changes: 4 additions & 4 deletions docker-shipper/Dockerfile.compiler.centos7
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ RUN yum install -y wget kernel-abi-whitelists
COPY kernel-devels.centos7 .
RUN cat ./kernel-devels.centos7 | grep -v ^# | awk '{print $1}' | xargs -tI % mkdir -vp /pkgs/%
RUN cat ./kernel-devels.centos7 | grep -v ^# | awk '{print $3}' | xargs -tI % wget % --no-check-certificate
RUN rpm -ivh *.rpm
RUN ls *.rpm | xargs -tI % rpm -ivh % --force

# Compile kmod-drbd for each CentOS 7 major release
ARG DRBD_VER
RUN wget --no-check-certificate https://pkg.linbit.com//downloads/drbd/9/drbd-${DRBD_VER}.tar.gz && \
RUN wget --no-check-certificate https://pkg.linbit.com//downloads/drbd/"$([[ $DRBD_VER =~ ^9.0 ]] && echo 9.0 || echo 9 )"/drbd-${DRBD_VER}.tar.gz && \
tar -zxf drbd-${DRBD_VER}.tar.gz
RUN cd drbd-${DRBD_VER} && \
RUN mkdir -vp /root/rpmbuild/SOURCES && cd drbd-${DRBD_VER} && \
ls -1 /usr/src/kernels | grep -v debug | xargs -tI % make kmp-rpm KDIR=/usr/src/kernels/%

RUN while read -r line; do \
[[ "$line" =~ ^# ]] && continue; \
dir=$( echo "$line" | awk '{print $1}' ); \
ker=$( echo "$line" | awk '{print $2}' ); \
mv -vf "/root/rpmbuild/RPMS/x86_64/kmod-drbd-${DRBD_VER}_${ker/-/_}"*.rpm "/pkgs/${dir}/"; \
mv -vf "/root/rpmbuild/RPMS/x86_64/kmod-drbd-${DRBD_VER%-[1-9]}_${ker/-/_}"*.rpm "/pkgs/${dir}/"; \
done < ./kernel-devels.centos7
8 changes: 4 additions & 4 deletions docker-shipper/Dockerfile.compiler.centos8
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ RUN yum install -y wget elfutils-libelf-devel kernel-rpm-macros kernel-abi-white
COPY kernel-devels.centos8 .
RUN cat ./kernel-devels.centos8 | grep -v ^# | awk '{print $1}' | xargs -tI % mkdir -vp /pkgs/%
RUN cat ./kernel-devels.centos8 | grep -v ^# | awk '{print $3}' | xargs -tI % wget % --no-check-certificate
RUN rpm -ivh *.rpm
RUN ls *.rpm | xargs -tI % rpm -ivh % --force

# Compile kmod-drbd for each CentOS 7 major release
ARG DRBD_VER
RUN wget --no-check-certificate https://pkg.linbit.com//downloads/drbd/9/drbd-${DRBD_VER}.tar.gz && \
RUN wget --no-check-certificate https://pkg.linbit.com//downloads/drbd/"$([[ $DRBD_VER =~ ^9.0 ]] && echo 9.0 || echo 9 )"/drbd-${DRBD_VER}.tar.gz && \
tar -zxf drbd-${DRBD_VER}.tar.gz
RUN set -m && cd drbd-${DRBD_VER} && \
RUN mkdir -vp /root/rpmbuild/SOURCES && cd drbd-${DRBD_VER} && \
ls -1 /usr/src/kernels | grep -v debug | xargs -tI % make kmp-rpm KDIR=/usr/src/kernels/%

RUN while read -r line; do \
[[ "$line" =~ ^# ]] && continue; \
dir=$( echo "$line" | awk '{print $1}' ); \
ker=$( echo "$line" | awk '{print $2}' ); \
mv -vf "/root/rpmbuild/RPMS/x86_64/kmod-drbd-${DRBD_VER}_${ker/-/_}"*.rpm "/pkgs/${dir}/"; \
mv -vf "/root/rpmbuild/RPMS/x86_64/kmod-drbd-${DRBD_VER%-[1-9]}_${ker//-/_}"*.rpm "/pkgs/${dir}/"; \
done < ./kernel-devels.centos8
67 changes: 51 additions & 16 deletions docker-shipper/Dockerfile.shipper
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,60 @@ ARG DRBD_VER
FROM ubuntu:focal as compiler-utils

RUN apt-get update && \
apt-get install -y build-essential wget flex automake
apt-get install -y build-essential wget flex automake git

# Compile drbd-utils statically for all Linux distros
ARG DRBD_UTILS_VER

RUN wget --no-check-certificate https://pkg.linbit.com//downloads/drbd/utils/drbd-utils-${DRBD_UTILS_VER}.tar.gz && \
tar -zxf drbd-utils-${DRBD_UTILS_VER}.tar.gz

RUN cd drbd-utils-${DRBD_UTILS_VER} && \
./configure \
--with-prebuiltman \
--with-drbdmon \
--without-manual \
--without-xen \
--without-heartbeat \
CFLAGS="-static" LDFLAGS="-static" && \
make tools && \
mkdir /drbd-utils && \
find ./user -type f -executable -name 'drbd[a-z]*' -exec mv -v {} /drbd-utils/ \;
ARG DRBD_HEADERS_SHA

## For latest utils
# RUN wget --no-check-certificate https://pkg.linbit.com//downloads/drbd/utils/drbd-utils-${DRBD_UTILS_VER}.tar.gz && \
# tar -zxf drbd-utils-${DRBD_UTILS_VER}.tar.gz

# RUN cd drbd-utils-${DRBD_UTILS_VER} && \
# ./configure \
# --with-prebuiltman \
# --with-drbdmon \
# --without-manual \
# --without-xen \
# --without-heartbeat \
# CFLAGS="-static" LDFLAGS="-static" && \
# make tools && \
# mkdir /drbd-utils && \
# find ./user -type f -executable -name 'drbd[a-z]*' -exec mv -v {} /drbd-utils/ \;

RUN set -x && \
git clone -n https://github.com/LINBIT/drbd-utils.git && \
cd drbd-utils/ && \
git checkout v${DRBD_UTILS_VER} && \
cd ..

RUN set -x && \
git clone -n https://github.com/LINBIT/drbd-headers.git && \
cd drbd-headers/ && \
git checkout ${DRBD_HEADERS_SHA} && \
cd ..

RUN set -x && \
mv drbd-headers drbd-utils/ && \
cd drbd-utils/ && \
./autogen.sh && \
./configure \
--with-prebuiltman \
-with-drbdmon \
--without-manual \
--without-xen \
--without-heartbeat \
CFLAGS="-static" \
LDFLAGS="-static" && \
make tools && \
mkdir -v /utils && \
find ./user -type f -executable -name 'drbd[a-z]*' -exec mv -v {} /utils/ \;

RUN ls -1 /utils/

RUN /utils/drbdadm --version

FROM drbd9-compiler-centos7:v${DRBD_VER} AS compiler-centos7

Expand All @@ -32,7 +67,7 @@ FROM busybox

ARG DRBD_VER

COPY --from=compiler-utils /drbd-utils /files/drbd-utils
COPY --from=compiler-utils /utils /files/utils

COPY --from=compiler-centos7 /pkgs/ /files/

Expand Down
2 changes: 1 addition & 1 deletion docker-shipper/drbd.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# You can find an example in /usr/share/doc/drbd.../drbd.conf.example

include "/etc/drbd.d/global_common.conf";
include "/etc/drbd.d/*.res";
include "/etc/drbd.d/*.res";
3 changes: 1 addition & 2 deletions docker-shipper/drbd.modules-load.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# DRBD modules
drbd
drbd_transport_tcp
drbd_transport_tcp
3 changes: 2 additions & 1 deletion docker-shipper/entrypoint.adapter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@ if [[ $LB_DROP == yes ]]; then
cp -vf /pkgs/drbd.modules-load.conf /etc/modules-load.d/drbd.conf

# drop drbd utils and set up conf directories
cp -vf /pkgs/drbd-utils/* /usr-local/bin/
cp -vf /pkgs/utils/* /usr-local/bin/
cat /pkgs/drbd.conf > /etc/drbd.conf
cp -vf /pkgs/global_common.conf /etc/drbd.d/

for i in etc var; do
mv -vf /usr-local/$i /usr-local/$i.bak
ln -svf /$i /usr-local/$i
Expand Down
Loading

0 comments on commit aaad620

Please sign in to comment.