From 6083e52d6267a3a51e06c8fceb0a3cb4ec3dae60 Mon Sep 17 00:00:00 2001 From: Roman Vanicek Date: Tue, 24 Feb 2026 19:56:46 +0000 Subject: [PATCH] FIX Cluster join must use synthetic host name and CTDB must be running --- entrypoint.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index b6d0ce5..9347de8 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -64,11 +64,18 @@ if [ ! -f "$ETC_DIR/krb5.keytab" ]; then rm -f "$ETC_DIR/smb.conf" /etc/krb5.conf + if [ "$CTDB_ENABLED" = "true" ]; then + PREV_HOSTNAME=`hostname` + hostname -b "$CLUSTER_NAME.$DOMAIN" + fi # realm join is broken as it requires --privileged but difficult to add for swarm # so it can execute /usr/sbin/adcli. Therefore we execute it directly and create # the /etc/krb5.conf and /etc/sssd/sssd.conf manually # echo $ADMIN_PASSWORD|realm join -v $REALM --user=$ADMIN_ACCOUNT echo $ADMIN_PASSWORD|/usr/sbin/adcli join --verbose --domain $DOMAIN --domain-realm $REALM --login-type user --login-user $ADMIN_ACCOUNT --stdin-password + if [ "$CTDB_ENABLED" = "true" ]; then + hostname -b "$PREV_HOSTNAME" + fi mv /etc/krb5.keytab "$ETC_DIR/" fi @@ -117,7 +124,14 @@ if [ -z "$REAL_REALM" ]; then mkdir -p /var/lib/samba/private # Join + if [ "$CTDB_ENABLED" = "true" ]; then + ((/usr/sbin/ctdbd --interactive)&) + CTDB_PID=$! + fi net ads join --no-dns-updates -U"$ADMIN_ACCOUNT"%"$ADMIN_PASSWORD" + if [ "$CTDB_ENABLED" = "true" ]; then + kill $CTDB_PID + fi ((/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf -j /tmp/sp.pid)&) sleep 10