opennebula-docker: 0.2.3 with more ceph/libvirtd support

This commit is contained in:
Nico Schottelius 2026-05-30 17:16:30 +02:00
commit 7d891eeeb0
4 changed files with 48 additions and 3 deletions

View file

@ -3,7 +3,7 @@
set -exu
if [ $# -lt 1 ]; then
echo "$0 <container> [push]" >&2
echo "$0 <container> [push] [version]" >&2
exit 1
fi
container=$1; shift
@ -12,14 +12,28 @@ container=$1; shift
push=""
if [ $# -ge 1 ]; then
push=yes
shift
fi
version=""
if [ $# -ge 1 ]; then
version="$1"
shift
fi
cd $container
for upstream in harbor.k8s.ungleich.ch/ungleich-public docker.io/ungleich;
do
name=${upstream}/${container}
for df in Dockerfile_*; do
if [ "$version" ]; then
dockerfiles=Dockerfile_${version}
else
dockerfiles=Dockerfile_*
fi
for df in $dockerfiles; do
version=$(echo $df | cut -d_ -f 2)
tag=${name}:${version}

View file

@ -0,0 +1 @@
Dockerfile_0.2.2

View file

@ -1,3 +1,6 @@
* 0.2.3, 2026-05-30
- Add support for libvirtd secret
- Set rbd format to version 2
* 0.2.2, 2026-04-04
- Fix syntax error
* 0.2.1, 2026-04-04

View file

@ -4,11 +4,36 @@
set -e
set -u
pidfile=/tmp/libvirtd.pid
# Add SSH key & start sshd
su - oneadmin -c "umask 077; mkdir -p ~/.ssh; echo ${ONEADMIN_SSH_KEY} > ~/.ssh/authorized_keys"
/etc/init.d/ssh start
# Setup libvirtd secret
if [ -z "$SKIP_LIBVIRTD" -e /ceph-secret/uuid ]; then
echo "Creating libvirtd/ceph secret ... "
libvirtd_tmp_secret=/tmp/libvirtd-secret.xml
/usr/sbin/libvirtd --daemon --pid-file $pidfile
cat > "$libvirtd_tmp_secret" <<EOF
<secret ephemeral='no' private='no'>
<uuid>$(cat /ceph-secret/uuid)</uuid>
<usage type='ceph'>
<name>$(cat /ceph-secret/name)</name>
</usage>
</secret>
EOF
virsh -c qemu:///system secret-define "$libvirtd_tmp_secret"
virsh -c qemu:///system secret-set-value \
--secret "$(cat /ceph-secret/uuid)" \
--base64 "$(cat /ceph-secret/key)"
rm "$libvirtd_tmp_secret"
fi
while true; do
######################################################################
# /etc/hosts logic
@ -17,7 +42,8 @@ while true; do
# get clean /etc/hosts without our generated content
grep -v rook-ceph-mon /etc/hosts > /tmp/hosts
# Add ceph hosts to /etc/hosts for opennebula
# Add ceph hosts to /etc/hosts for opennebula:
# rook-ceph-1, rook-ceph-2, ...
i=1
while read ip; do
echo $ip rook-ceph-$i >> /tmp/hosts
@ -32,6 +58,7 @@ while true; do
# Re-generate ceph.conf (might needs this if we are a bridge host)
cat > /etc/ceph/ceph.conf <<EOF
[global]
rbd_default_format = 2
mon_host = $mon_hosts
$ceph_keyring