Add rabbitmq to magnum

Change-Id: Ib1908f371b362aaa092e7391c4faf8cf2e7a4ccc
This commit is contained in:
okozachenko 2020-07-13 19:18:26 +03:00
parent 1e55b9c28b
commit e4dc3cda9b
5 changed files with 60 additions and 10 deletions

View File

@ -133,7 +133,12 @@ function create_magnum_conf {
rm -f $MAGNUM_CONF
HOSTNAME=`hostname`
iniset $MAGNUM_CONF DEFAULT debug "$ENABLE_DEBUG_LOG_LEVEL"
iniset $MAGNUM_CONF DEFAULT transport_url $(get_transport_url)
# Get rabbitmq password
MAGNUM_RABBITMQ_PASSWORD=$(get_data_from_secret magnum-rabbitmq openstack password)
MAGNUM_RABBITMQ_USERNAME=$(get_data_from_secret magnum-rabbitmq openstack username)
iniset $MAGNUM_CONF DEFAULT transport_url "rabbit://$MAGNUM_RABBITMQ_USERNAME:$MAGNUM_RABBITMQ_PASSWORD@rabbitmq-magnum:5672/"
iniset $MAGNUM_CONF DEFAULT host "$HOSTNAME"
iniset $MAGNUM_CONF database connection `database_connection_url magnum`

View File

@ -39,6 +39,12 @@ def create_or_resume(name, spec, **_):
utils.create_or_update('magnum/service.yml.j2',
name=name)
# deploy rabbitmq
if not utils.ensure_secret("openstack", "magnum-rabbitmq"):
utils.create_or_update('magnum/secret-rabbitmq.yml.j2',
password=utils.generate_password())
utils.create_or_update('magnum/rabbitmq.yml.j2')
if "ingress" in spec:
utils.create_or_update('magnum/ingress.yml.j2',
name=name, spec=spec)

View File

@ -60,14 +60,6 @@ class PodMonitor(NamespacedAPIObject):
kind = "PodMonitor"
class Rabbitmq(NamespacedAPIObject):
"""Rabbitmq Kubernetes object"""
version = "infrastructure.vexxhost.cloud/v1alpha1"
endpoint = "rabbitmqs"
kind = "Rabbitmq"
class PrometheusRule(NamespacedAPIObject):
"""PrometheusRule Kubernetes object"""
@ -76,6 +68,14 @@ class PrometheusRule(NamespacedAPIObject):
kind = "PrometheusRule"
class Rabbitmq(NamespacedAPIObject):
"""Rabbitmq Kubernetes object"""
version = "infrastructure.vexxhost.cloud/v1alpha1"
endpoint = "rabbitmqs"
kind = "Rabbitmq"
MAPPING = {
"v1": {
"ConfigMap": ConfigMap,
@ -101,7 +101,7 @@ MAPPING = {
"infrastructure.vexxhost.cloud/v1alpha1": {
"Mcrouter": Mcrouter,
"Memcached": Memcached,
"Rabbitmq": Rabbitmq,
"Rabbitmq": Rabbitmq
},
"monitoring.coreos.com/v1": {
"PodMonitor": PodMonitor,

View File

@ -0,0 +1,30 @@
---
# 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: magnum
namespace: openstack
spec:
authSecret: magnum-rabbitmq
{% if 'nodeSelector' in spec %}
nodeSelector:
{{ spec.nodeSelector | to_yaml | indent(4) }}
{% endif %}
{% if 'tolerations' in spec %}
tolerations:
{{ spec.tolerations | to_yaml | indent(4) }}
{% endif %}

View File

@ -0,0 +1,9 @@
apiVersion: v1
metadata:
name: keystone-rabbitmq
namespace: openstack
stringData:
username: magnum
password: {{ password }}
kind: Secret