-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ceph#60017 from rhcs-dashboard/kcli-quick-install
mgr/dashboard: improve the kcli bootstrap process Reviewed-by: Afreen Misbah <[email protected]>
- Loading branch information
Showing
7 changed files
with
154 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,12 +23,25 @@ bootstrap_extra_options='--allow-fqdn-hostname --dashboard-password-noupdate' | |
# {% if expanded_cluster is not defined %} | ||
# bootstrap_extra_options+=" ${bootstrap_extra_options_not_expanded}" | ||
# {% endif %} | ||
quick_install_options='' | ||
{% if quick_install is defined %} | ||
quick_install_options="--image localhost:5000/ceph" | ||
{% endif %} | ||
|
||
{% if nodes < 3 %} | ||
bootstrap_extra_options+=" --config /root/initial-ceph.conf" | ||
{% endif %} | ||
|
||
$CEPHADM bootstrap --mon-ip $mon_ip --initial-dashboard-password {{ admin_password }} --shared_ceph_folder /mnt/{{ ceph_dev_folder }} ${bootstrap_extra_options} | ||
{% if ceph_dev_folder is defined %} | ||
bootstrap_extra_options+=" --shared_ceph_folder /mnt/{{ ceph_dev_folder }}" | ||
{% endif %} | ||
|
||
$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" | ||
|
||
|
||
{% for number in range(1, nodes) %} | ||
ssh-copy-id -f -i /etc/ceph/ceph.pub -o StrictHostKeyChecking=no [email protected]{{ number }} | ||
{% if expanded_cluster is defined %} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[main] | ||
fastestmirror=true | ||
max_parallel_downloads=10 | ||
metadata_expire=1h | ||
clean_requirements_on_remove=true | ||
assumeyes=true | ||
gpgcheck=1 | ||
keepcache=0 | ||
plugins=1 | ||
installonly_limit=3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[global] | ||
osd_pool_default_min_size=1 | ||
osd_pool_default_size=1 | ||
|
||
[mon] | ||
mon_allow_pool_size_one=true | ||
mon_allow_pool_delete=true | ||
mon_data_avail_crit=1 | ||
mon_data_avail_warn=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo -e "[registries.insecure]\n\ | ||
registries = ['localhost:5000']" | sudo tee /etc/containers/registries.conf | ||
|
||
podman run -d -p 5000:5000 --name my-registry registry:2 | ||
# Load the image and capture the output | ||
output=$(podman load -i /root/ceph_image.tar) | ||
|
||
# Extract image name from output | ||
image_name=$(echo "$output" | grep -oP '(?<=^Loaded image: ).*') | ||
|
||
if [[ -n "$image_name" ]]; then | ||
echo "Image loaded: $image_name" | ||
podman tag "$image_name" localhost:5000/ceph | ||
echo "Tagged image as localhost:5000/ceph" | ||
else | ||
echo "Failed to load image or extract image name." | ||
exit 1 | ||
fi | ||
|
||
podman push localhost:5000/ceph | ||
rm -f /root/ceph_image.tar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#!/usr/bin/env bash | ||
|
||
source bootstrap-cluster.sh > /dev/null 2>&1 | ||
|
||
set +x | ||
|
||
show_help() { | ||
echo "Usage: ./quick-bootstrap.sh [OPTIONS]" | ||
echo "" | ||
echo "Options:" | ||
echo " -u, --use-cached-image Uses the existing podman image in local. Only use this if there is such an image present." | ||
echo " -dir, --ceph-dir Use this to provide the local ceph directory. eg. --ceph-dir=/path/to/ceph" | ||
echo " -e, --expanded-cluster To add all the hosts and deploy OSDs on top of it." | ||
echo " -h, --help Display this help message." | ||
echo "" | ||
echo "Example:" | ||
echo " ./quick-bootstrap.sh --use-cached-image" | ||
} | ||
|
||
use_cached_image=false | ||
extra_args="-P quick_install=True" | ||
|
||
for arg in "$@"; do | ||
case "$arg" in | ||
-u|--use-cached-image) | ||
use_cached_image=true | ||
;; | ||
-dir=*|--ceph-dir=*) | ||
extra_args+=" -P ceph_dev_folder=${arg#*=}" | ||
;; | ||
-e|--expanded-cluster) | ||
extra_args+=" -P expanded_cluster=True" | ||
;; | ||
-h|--help) | ||
show_help | ||
exit 0 | ||
;; | ||
*) | ||
echo "Unknown option: $arg" | ||
show_help | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
image_name=$(echo "$CEPHADM_IMAGE") | ||
ceph_cluster_yml='ceph_cluster.yml' | ||
node_count=$(awk '/nodes:/ {print $2}' "${ceph_cluster_yml}") | ||
|
||
if [[ ${use_cached_image} == false ]]; then | ||
printf "Pulling the image: %s\n" "$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 quay.ceph.io/ceph-ci/ceph:main | ||
|
||
printf "Creating the plan\n" | ||
kcli create plan -f ceph_cluster.yml ${extra_args} ceph | ||
|
||
attempt=0 | ||
|
||
MAX_ATTEMPTS=10 | ||
SLEEP_INTERVAL=5 | ||
|
||
printf "Waiting for the host to be reachable\n" | ||
while [[ ${attempt} -lt ${MAX_ATTEMPTS} ]]; do | ||
if ssh -o StrictHostKeyChecking=no -o BatchMode=yes -o ConnectTimeout=10 [email protected] exit; then | ||
break | ||
else | ||
echo "Waiting for ssh connection to be available..., attempt: ${attempt}" | ||
((attempt++)) | ||
sleep ${SLEEP_INTERVAL} | ||
fi | ||
done | ||
|
||
printf "Copying the image to the hosts\n" | ||
|
||
for node in $(seq 0 $((node_count - 1))); do | ||
scp -o StrictHostKeyChecking=no ceph_image.tar [email protected]"${node}":/root/ | ||
done | ||
|
||
rm -f ceph_image.tar | ||
kcli ssh -u root -- ceph-node-00 'journalctl -n all -ft cloud-init' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters