Add mysql cluster to heat deployment

Change-Id: Ib1b616ec44d0b1b75134139dd9eb88f257a2c75f
This commit is contained in:
okozachenko 2020-07-30 12:28:26 +03:00
parent 2c39f82cd2
commit ad11d0ef8a
4 changed files with 28 additions and 22 deletions

View File

@ -22,7 +22,8 @@ configMap:
mysql:
size: 10Gi
heat:
configDir: /etc/heat
mysql:
size: 10Gi
magnum:
mysql:
size: 10Gi

View File

@ -10,11 +10,6 @@ data:
ingress:
host: "horizon.vexxhost.com"
keystone: {}
heat:
configDir: /etc/heat
ingress:
host:
api: "h-api.vexxhost.com"
api-cfn: "h-api-cfn.vexxhost.com"
heat: {}
magnum: {}
chronyd: {}

View File

@ -115,7 +115,12 @@ function configure_heat {
iniset $HEAT_CONF DEFAULT heat_metadata_server_url http://$HEAT_API_CFN_HOST/heat-api-cfn
iniset $HEAT_CONF DEFAULT heat_waitcondition_server_url http://$HEAT_API_CFN_HOST/heat-api-cfn/v1/waitcondition
iniset $HEAT_CONF database connection `database_connection_url heat`
# Get mysql password
HEAT_DATABASE_USER=$(get_data_from_secret heat-mysql openstack USER)
HEAT_DATABASE_PASSWORD=$(get_data_from_secret heat-mysql openstack PASSWORD)
HEAT_DATABASE_NAME=$(get_data_from_secret heat-mysql openstack DATABASE)
iniset $HEAT_CONF database connection "mysql+pymysql://$HEAT_DATABASE_USER:$HEAT_DATABASE_PASSWORD@heat-mysql/$HEAT_DATABASE_NAME?charset=utf8"
# we are using a hardcoded auth_encryption_key as it has to be the same for
# multinode deployment.
iniset $HEAT_CONF DEFAULT auth_encryption_key "767c3ed056cbaa3b9dfedb8c6f825bf0"
@ -214,18 +219,12 @@ function configure_heat {
[ $err_count -eq 0 ] || die $LINENO "$err_count of the requested Heat plugins could not be installed."
}
# init_heat() - Initialize database - override
# init_heat()
function init_heat {
kubectl create secret generic heat-config --from-file=/etc/heat/heat.conf --from-file=/etc/heat/api-paste.ini -n openstack
# NOTE: Permissions here are bad but it's temporary so we don't care as much.
sudo chmod -Rv 777 /etc/heat
# recreate db only if one of the db services is enabled
if is_service_enabled $DATABASE_BACKENDS; then
# (re)create heat database
recreate_database heat
fi
}
# install_heatclient() - Collect source and prepare

View File

@ -20,6 +20,7 @@ server for the installation.
"""
from openstack_operator import database
from openstack_operator import utils
@ -30,6 +31,22 @@ def create_or_resume(name, spec, **_):
start the service up for the first time.
"""
# deploy mysql
if "mysql" not in spec:
database.ensure_mysql_cluster("heat", {})
else:
database.ensure_mysql_cluster("heat", spec["mysql"])
# deploy memcached
utils.create_or_update('heat/memcached.yml.j2', spec=spec)
# deploy rabbitmq
if not utils.ensure_secret("openstack", "heat-rabbitmq"):
utils.create_or_update('heat/secret-rabbitmq.yml.j2',
password=utils.generate_password())
utils.create_or_update('heat/rabbitmq.yml.j2', spec=spec)
# deploy heat
config_hash = utils.generate_hash(spec)
for component in ("api", "api-cfn"):
utils.create_or_update('heat/daemonset.yml.j2',
@ -44,13 +61,7 @@ def create_or_resume(name, spec, **_):
name=name, spec=spec, component='engine',
config_hash=config_hash)
utils.create_or_update('heat/memcached.yml.j2', spec=spec)
# deploy rabbitmq
if not utils.ensure_secret("openstack", "heat-rabbitmq"):
utils.create_or_update('heat/secret-rabbitmq.yml.j2',
password=utils.generate_password())
utils.create_or_update('heat/rabbitmq.yml.j2', spec=spec)
# deploy clean jobs
utils.create_or_update('heat/cronjob-service-clean.yml.j2',
name=name, spec=spec)
utils.create_or_update('heat/cronjob-purge-deleted.yml.j2',