diff --git a/chart/test-values.yaml b/chart/test-values.yaml index aaf1d590..1a01526a 100644 --- a/chart/test-values.yaml +++ b/chart/test-values.yaml @@ -22,7 +22,8 @@ configMap: mysql: size: 10Gi heat: - configDir: /etc/heat + mysql: + size: 10Gi magnum: mysql: size: 10Gi diff --git a/config/samples/operator-config.yaml b/config/samples/operator-config.yaml index 3bd957d4..f4928cee 100644 --- a/config/samples/operator-config.yaml +++ b/config/samples/operator-config.yaml @@ -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: {} diff --git a/devstack/lib/heat b/devstack/lib/heat index c7d3c14b..4f601876 100644 --- a/devstack/lib/heat +++ b/devstack/lib/heat @@ -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 diff --git a/openstack_operator/heat.py b/openstack_operator/heat.py index e8fdb0a9..f1d49ba1 100644 --- a/openstack_operator/heat.py +++ b/openstack_operator/heat.py @@ -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',