diff --git a/devstack/lib/neutron-legacy b/devstack/lib/neutron-legacy index 565be866..dcbe1fa9 100644 --- a/devstack/lib/neutron-legacy +++ b/devstack/lib/neutron-legacy @@ -14,6 +14,48 @@ # License for the specific language governing permissions and limitations # under the License. +function configure_mutnauq { + _configure_neutron_common + + kubernetes_ensure_resource secret/neutron-rabbitmq + NEUTRON_RABBITMQ_USERNAME=$(get_data_from_secret neutron-rabbitmq openstack username) + NEUTRON_RABBITMQ_PASSWORD=$(get_data_from_secret neutron-rabbitmq openstack password) + iniset $NEUTRON_CONF DEFAULT transport_url "rabbit://$NEUTRON_RABBITMQ_USERNAME:$NEUTRON_RABBITMQ_PASSWORD@rabbitmq-neutron.openstack.svc.cluster.local:5672/" + + if is_service_enabled q-metering; then + _configure_neutron_metering + fi + if is_service_enabled q-agt q-svc; then + _configure_neutron_service + fi + if is_service_enabled q-agt; then + _configure_neutron_plugin_agent + fi + if is_service_enabled q-dhcp; then + _configure_neutron_dhcp_agent + fi + if is_service_enabled q-l3; then + _configure_neutron_l3_agent + fi + if is_service_enabled q-meta; then + _configure_neutron_metadata_agent + fi + + if [[ "$Q_DVR_MODE" != "legacy" ]]; then + _configure_dvr + fi + if is_service_enabled ceilometer; then + _configure_neutron_ceilometer_notifications + fi + + iniset $NEUTRON_CONF DEFAULT api_workers "$API_WORKERS" + # devstack is not a tool for running uber scale OpenStack + # clouds, therefore running without a dedicated RPC worker + # for state reports is more than adequate. + iniset $NEUTRON_CONF DEFAULT rpc_state_report_workers 0 +} +export -f configure_mutnauq + function init_mutnauq { echo noop } diff --git a/openstack_operator/neutron.py b/openstack_operator/neutron.py index 54b8d333..f5db5b36 100644 --- a/openstack_operator/neutron.py +++ b/openstack_operator/neutron.py @@ -33,8 +33,13 @@ def create_or_resume(spec, **_): start the service up for the first time. """ + if not utils.ensure_secret("openstack", "neutron-rabbitmq"): + utils.create_or_update('neutron/secret-rabbitmq.yml.j2', + password=utils.generate_password()) + database.ensure_mysql_cluster("neutron") + utils.create_or_update('neutron/rabbitmq.yml.j2') utils.create_or_update('neutron/daemonset.yml.j2', spec=spec) utils.create_or_update('neutron/service.yml.j2') diff --git a/openstack_operator/templates/neutron/rabbitmq.yml.j2 b/openstack_operator/templates/neutron/rabbitmq.yml.j2 new file mode 100644 index 00000000..5f272053 --- /dev/null +++ b/openstack_operator/templates/neutron/rabbitmq.yml.j2 @@ -0,0 +1,27 @@ +--- +# Copyright 2020 VEXXHOST, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: infrastructure.vexxhost.cloud/v1alpha1 +kind: Rabbitmq +metadata: + name: neutron + namespace: openstack +spec: + authSecret: neutron-rabbitmq + nodeSelector: + node-role.kubernetes.io/master: "" + tolerations: + - key: node-role.kubernetes.io/master + effect: NoSchedule diff --git a/openstack_operator/templates/neutron/secret-rabbitmq.yml.j2 b/openstack_operator/templates/neutron/secret-rabbitmq.yml.j2 new file mode 100644 index 00000000..b24ea6fc --- /dev/null +++ b/openstack_operator/templates/neutron/secret-rabbitmq.yml.j2 @@ -0,0 +1,8 @@ +apiVersion: v1 +metadata: + name: neutron-rabbitmq + namespace: openstack +stringData: + username: neutron + password: {{ password }} +kind: Secret