Skip to content

Commit

Permalink
enable stsstack to also support non-openstack clouds #227
Browse files Browse the repository at this point in the history
In fact, stsstack can work well on lxd cloud as well. So this patch
is to enable stsstack to not only support underlying openstack cloud,
but also support underlying lxd and maas cloud.
  • Loading branch information
zhhuabj committed Sep 6, 2024
1 parent a30b681 commit 4b1bf47
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
14 changes: 10 additions & 4 deletions common/generate_bundle_base
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@ declare -a overlay_opts=()
# Catch any changes/additions to master opts
update_master_opts ${MOD_PASSTHROUGH_OPTS[@]}

type=$(get_cloud_type)
vip_start=${MASTER_OPTS[VIP_ADDR_START]}
cidr=""
if [[ -z $vip_start ]] && [[ -e ~/novarc ]]; then
# prodstack
cidr=$(source ~/novarc; openstack subnet show subnet_${OS_USERNAME}-psd -c cidr -f value 2>/dev/null)
if [[ $type = openstack ]]; then
# prodstack
cidr=$(source ~/novarc; openstack subnet show subnet_${OS_USERNAME}-psd -c cidr -f value 2>/dev/null)
fi
if [[ -z $cidr ]]; then
# stsstack
cidr=$(source ~/novarc; openstack subnet show ${OS_USERNAME}_admin_subnet -c cidr -f value 2>/dev/null)
if [[ $type = openstack ]]; then
# stsstack
cidr=$(source ~/novarc; openstack subnet show ${OS_USERNAME}_admin_subnet -c cidr -f value 2>/dev/null)
fi
if [[ -n $cidr ]]; then
vip_start=$(echo $cidr| sed -r 's/([0-9]+\.[0-9]+).+/\1/g').150.0
fi
Expand Down
10 changes: 8 additions & 2 deletions common/helpers
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ list_overlays ()
} | sort -u
}

get_cloud_type ()
{
local cloud=`juju show-model| sed -rn 's/.+cloud:\s*(.+).*/\1/p'| uniq`
local type=`juju show-cloud $cloud| sed -rn 's/^type:\s*(.+).*/\1/p'| uniq`
echo "$type"
}

_usage () {
cat << EOF
USAGE: `basename $0` OPTIONS [OVERLAYS] [MODULE_OPTS]
Expand Down Expand Up @@ -791,8 +798,7 @@ ensure_model
# Establish what cloud provider is in use and if it's MAAS, use unit placement.
# NOTE: this has to be done AFTER the model has been created and we have
# switched context.
cloud=`juju show-model| sed -rn 's/.+cloud:\s*(.+).*/\1/p'| uniq`
type=`juju show-cloud $cloud| sed -rn 's/^type:\s*(.+).*/\1/p'| uniq`
type=$(get_cloud_type)
if [[ $type = maas ]]; then
echo "INFO: maas provider detected - enabling hyperconverged deployment"
MASTER_OPTS[HYPERCONVERGED_DEPLOYMENT]=true
Expand Down

0 comments on commit 4b1bf47

Please sign in to comment.