Ensure rabbitmq

Change-Id: I3549a251fd2f9c9c4908598f9ed256776bc120a7
This commit is contained in:
okozachenko 2020-08-20 20:06:44 +03:00 committed by Oleksandr Kozachenko
parent 15ebfa1cf7
commit 40f7d28bb0
16 changed files with 26 additions and 182 deletions

View File

@ -35,10 +35,7 @@ def create_or_resume(name, spec, **_):
database.ensure_mysql_cluster("cinder", spec=spec["mysql"])
# deploy rabbitmq
if not utils.ensure_secret("openstack", "cinder-rabbitmq"):
utils.create_or_update('cinder/secret-rabbitmq.yml.j2',
password=utils.generate_password())
utils.create_or_update('cinder/rabbitmq.yml.j2', spec=spec)
utils.deploy_rabbitmq("cinder")
# deploy cinder
config_hash = utils.generate_hash(spec)

View File

@ -34,10 +34,7 @@ def create_or_resume(name, spec, **_):
database.ensure_mysql_cluster("heat", spec=spec["mysql"])
# 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)
utils.deploy_rabbitmq("heat")
# deploy heat
config_hash = utils.generate_hash(spec)

View File

@ -36,10 +36,7 @@ def create_or_resume(name, spec, **_):
database.ensure_mysql_cluster("magnum", spec=spec["mysql"])
# 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', spec=spec)
utils.deploy_rabbitmq("magnum")
# deploy magnum
config_hash = utils.generate_hash(spec)

View File

@ -33,13 +33,9 @@ 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", spec=spec["mysql"])
utils.create_or_update('neutron/rabbitmq.yml.j2')
utils.deploy_rabbitmq("neutron")
utils.create_or_update('neutron/daemonset-server.yml.j2', spec=spec)
utils.create_or_update('neutron/daemonset-openvswitch-agent.yml.j2',
spec=spec)

View File

@ -55,11 +55,7 @@ def create_or_resume(spec, **_):
# NOTE(mnaser): cell0 does not need a message queue
if cell != 'cell0':
if not utils.ensure_secret("openstack", "nova-%s-rabbitmq" % cell):
utils.create_or_update('nova/secret-rabbitmq.yml.j2',
component=cell,
password=utils.generate_password())
utils.create_or_update('nova/rabbitmq.yml.j2', component=cell)
utils.deploy_rabbitmq("nova-%s" % cell)
utils.create_or_update('nova/conductor/daemonset.yml.j2', spec=spec)
utils.create_or_update('nova/scheduler/daemonset.yml.j2', spec=spec)

View File

@ -1,27 +0,0 @@
---
# 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: cinder
namespace: openstack
spec:
authSecret: cinder-rabbitmq
nodeSelector:
node-role.kubernetes.io/master: ""
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule

View File

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

View File

@ -1,30 +0,0 @@
---
# 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: heat
namespace: openstack
spec:
authSecret: heat-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

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

View File

@ -1,30 +0,0 @@
---
# 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

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

View File

@ -1,10 +0,0 @@
apiVersion: v1
metadata:
name: neutron-rabbitmq
namespace: openstack
labels:
{{ labels("neutron") | indent(4) }}
stringData:
username: neutron
password: {{ password }}
kind: Secret

View File

@ -1,29 +0,0 @@
---
# 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: nova-{{ component }}
namespace: openstack
labels:
{{ labels("nova", component=component) | indent(4) }}
spec:
authSecret: nova-{{ component }}-rabbitmq
nodeSelector:
node-role.kubernetes.io/master: ""
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule

View File

@ -16,12 +16,12 @@
apiVersion: infrastructure.vexxhost.cloud/v1alpha1
kind: Rabbitmq
metadata:
name: neutron
name: {{ name }}
namespace: openstack
labels:
{{ labels("neutron") | indent(4) }}
{{ labels(name) | indent(4) }}
spec:
authSecret: neutron-rabbitmq
authSecret: {{ name }}-rabbitmq
nodeSelector:
node-role.kubernetes.io/master: ""
tolerations:

View File

@ -15,11 +15,9 @@
apiVersion: v1
metadata:
name: nova-{{ component }}-rabbitmq
name: {{ name }}-rabbitmq
namespace: openstack
labels:
{{ labels("neutron", component=component) | indent(4) }}
stringData:
username: nova-{{ component }}
username: {{ name }}
password: {{ password }}
kind: Secret

View File

@ -292,7 +292,7 @@ def deploy_memcached(name, **_):
Deploy a generic instance of Memcached
This function deploys a generic instance of Memcached with sane defaults,
it's meant to be here to be consumed/called by the serices.
it's meant to be here to be consumed/called by the services.
"""
create_or_update('operator/memcached.yml.j2', name=name)
@ -303,3 +303,18 @@ def deploy_uwsgi_config():
This function deploys a default configmap for uwsgi apps."""
create_or_update('operator/uwsgidefaultconfig.yml.j2')
def deploy_rabbitmq(name, **_):
"""
Deploy a generic instance of rabbitmq
This function deploys a generic instance of Rabbitmq with a secret,
it's meant to be here to be consumed/called by the services.
The secret should include user and password.
"""
if not ensure_secret("openstack", name + "-rabbitmq"):
create_or_update('operator/secret-rabbitmq.yml.j2',
name=name, password=generate_password())
create_or_update('operator/rabbitmq.yml.j2', name=name)