From d558a93eb27d245e381a4647163b6d4284c727d3 Mon Sep 17 00:00:00 2001 From: Afreen Misbah Date: Mon, 20 Apr 2026 20:21:47 +0530 Subject: [PATCH] mgr/dashboard: Allow quick bootstrap script to use custom images - if no image provided default image will be used - the -i flag was added but its not working. so this commit fixes that. - exporting the CEPHADM_IMAGE in cpeh_cluster.yaml so that bootstrap script can utilize that - passing image in cephadm shell Signed-off-by: Afreen Misbah --- .../dashboard/ci/cephadm/bootstrap-cluster.sh | 19 +++++++++++++++---- .../mgr/dashboard/ci/cephadm/ceph_cluster.yml | 3 +++ .../dashboard/ci/cephadm/quick-bootstrap.sh | 9 +++++---- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/pybind/mgr/dashboard/ci/cephadm/bootstrap-cluster.sh b/src/pybind/mgr/dashboard/ci/cephadm/bootstrap-cluster.sh index 89332210bf35..5ffb9fe7ef19 100755 --- a/src/pybind/mgr/dashboard/ci/cephadm/bootstrap-cluster.sh +++ b/src/pybind/mgr/dashboard/ci/cephadm/bootstrap-cluster.sh @@ -5,7 +5,7 @@ set -x export PATH=/root/bin:$PATH mkdir /root/bin -export CEPHADM_IMAGE='quay.ceph.io/ceph-ci/ceph:main' +export CEPHADM_IMAGE="${CEPHADM_IMAGE:-quay.ceph.io/ceph-ci/ceph:main}" CEPHADM="/root/bin/cephadm" CEPHADM_SRC="/mnt/{{ ceph_dev_folder }}/src/cephadm/cephadm" @@ -28,9 +28,15 @@ bootstrap_extra_options='--allow-fqdn-hostname --dashboard-password-noupdate' # {% if expanded_cluster is not defined %} # bootstrap_extra_options+=" ${bootstrap_extra_options_not_expanded}" # {% endif %} + +shell_image='' + quick_install_options='' {% if quick_install is defined %} - quick_install_options="--image localhost:5000/ceph" + export CEPHADM_IMAGE="${CEPHADM_IMAGE:-quay.ceph.io/ceph-ci/ceph:main}" + quick_install_options="--image localhost:5000/ceph" + shell_image="--image localhost:5000/ceph" + {% endif %} if [[ ${NODES} -lt 2 ]]; then @@ -49,8 +55,13 @@ fi $CEPHADM ${quick_install_options} bootstrap --mon-ip $mon_ip --initial-dashboard-password {{ admin_password }} ${bootstrap_extra_options} -fsid=$(cat /etc/ceph/ceph.conf | grep fsid | awk '{ print $3}') -cephadm_shell="$CEPHADM shell --fsid ${fsid} -c /etc/ceph/ceph.conf -k /etc/ceph/ceph.client.admin.keyring" +fsid=$(awk '/fsid/ {print $3}' /etc/ceph/ceph.conf) +cephadm_shell="$CEPHADM ${shell_image} shell --fsid ${fsid} -c /etc/ceph/ceph.conf -k /etc/ceph/ceph.client.admin.keyring" + +{% if quick_install is defined %} + ${cephadm_shell} ceph config set global container_image localhost:5000/ceph +{% endif %} + for number in $(seq 1 $((NODES - 1))); do LAST_OCTET=$((NODE_IP_OFFSET + $number)) diff --git a/src/pybind/mgr/dashboard/ci/cephadm/ceph_cluster.yml b/src/pybind/mgr/dashboard/ci/cephadm/ceph_cluster.yml index 17ebe38968c7..2b2ffafe5f0f 100755 --- a/src/pybind/mgr/dashboard/ci/cephadm/ceph_cluster.yml +++ b/src/pybind/mgr/dashboard/ci/cephadm/ceph_cluster.yml @@ -47,6 +47,9 @@ parameters: {% if quick_install is defined %} - /root/load-podman-image.sh {% endif %} + {% if custom_image is defined %} + - export CEPHADM_IMAGE={{custom_image}} + {% endif %} - sed -i "s/SELINUX=enforcing/SELINUX=permissive/" /etc/selinux/config - setenforce 0 {% if number == 0 %} diff --git a/src/pybind/mgr/dashboard/ci/cephadm/quick-bootstrap.sh b/src/pybind/mgr/dashboard/ci/cephadm/quick-bootstrap.sh index 853ceae346b5..1cd532a8263d 100755 --- a/src/pybind/mgr/dashboard/ci/cephadm/quick-bootstrap.sh +++ b/src/pybind/mgr/dashboard/ci/cephadm/quick-bootstrap.sh @@ -49,6 +49,8 @@ for arg in "$@"; do ;; -i=*|--ceph-image=*) CEPHADM_IMAGE="${arg#*=}" + echo "Using custom Ceph image: $CEPHADM_IMAGE" + extra_args+=" -P custom_image=${CEPHADM_IMAGE}" ;; -h|--help) show_help @@ -62,19 +64,18 @@ for arg in "$@"; do esac done -image_name=$(echo "$CEPHADM_IMAGE") - +image_name="${CEPHADM_IMAGE:-quay.ceph.io/ceph-ci/ceph:main}" extra_args+=" -P nodes=${NODES}" if [[ ${use_cached_image} == false ]]; then printf "Pulling the image: %s\n" "$image_name" - podman pull "${image_name}" + podman pull "$image_name" fi rm -f ceph_image.tar printf "Saving the image: %s\n" "$image_name" -podman save -o ceph_image.tar "${image_name}" +podman save -o ceph_image.tar "$image_name" # build cephadm binary if it does not exist printf "\nChecking for cephadm binary...\n" -- 2.47.3