From 7d891eeeb052df3b6d99f99eacb2399a63417042 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 30 May 2026 17:16:30 +0200 Subject: [PATCH] opennebula-docker: 0.2.3 with more ceph/libvirtd support --- build-version-via-dockerfile.sh | 18 ++++++++++++++++-- opennebula-docker/Dockerfile_0.2.3 | 1 + opennebula-docker/README.org | 3 +++ opennebula-docker/entrypoint.sh | 29 ++++++++++++++++++++++++++++- 4 files changed, 48 insertions(+), 3 deletions(-) create mode 120000 opennebula-docker/Dockerfile_0.2.3 diff --git a/build-version-via-dockerfile.sh b/build-version-via-dockerfile.sh index 66a5b9d..b073b6e 100755 --- a/build-version-via-dockerfile.sh +++ b/build-version-via-dockerfile.sh @@ -3,7 +3,7 @@ set -exu if [ $# -lt 1 ]; then - echo "$0 [push]" >&2 + echo "$0 [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} diff --git a/opennebula-docker/Dockerfile_0.2.3 b/opennebula-docker/Dockerfile_0.2.3 new file mode 120000 index 0000000..94aaeb3 --- /dev/null +++ b/opennebula-docker/Dockerfile_0.2.3 @@ -0,0 +1 @@ +Dockerfile_0.2.2 \ No newline at end of file diff --git a/opennebula-docker/README.org b/opennebula-docker/README.org index 67cf6ae..0d0a926 100644 --- a/opennebula-docker/README.org +++ b/opennebula-docker/README.org @@ -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 diff --git a/opennebula-docker/entrypoint.sh b/opennebula-docker/entrypoint.sh index abe0704..1b45215 100755 --- a/opennebula-docker/entrypoint.sh +++ b/opennebula-docker/entrypoint.sh @@ -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" < + $(cat /ceph-secret/uuid) + + $(cat /ceph-secret/name) + + +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 <