feat: move rmq to operator
diff --git a/atmosphere/flows.py b/atmosphere/flows.py
index d0bd92d..c54c82e 100644
--- a/atmosphere/flows.py
+++ b/atmosphere/flows.py
@@ -112,6 +112,30 @@
name=constants.HELM_REPOSITORY_OPENSTACK_HELM,
url="https://tarballs.opendev.org/openstack/openstack-helm/",
),
+ openstack_helm.ApplyRabbitmqClusterTask(
+ name=constants.HELM_RELEASE_KEYSTONE_NAME,
+ ),
+ openstack_helm.ApplyRabbitmqClusterTask(
+ name=constants.HELM_RELEASE_BARBICAN_NAME,
+ ),
+ openstack_helm.ApplyRabbitmqClusterTask(
+ name=constants.HELM_RELEASE_GLANCE_NAME,
+ ),
+ openstack_helm.ApplyRabbitmqClusterTask(
+ name=constants.HELM_RELEASE_CINDER_NAME,
+ ),
+ openstack_helm.ApplyRabbitmqClusterTask(
+ name=constants.HELM_RELEASE_NEUTRON_NAME,
+ ),
+ openstack_helm.ApplyRabbitmqClusterTask(
+ name=constants.HELM_RELEASE_NOVA_NAME,
+ ),
+ openstack_helm.ApplyRabbitmqClusterTask(
+ name=constants.HELM_RELEASE_SENLIN_NAME,
+ ),
+ openstack_helm.ApplyRabbitmqClusterTask(
+ name=constants.HELM_RELEASE_HEAT_NAME,
+ ),
)
if CONF.memcached.enabled:
diff --git a/atmosphere/tasks/composite/openstack_helm.py b/atmosphere/tasks/composite/openstack_helm.py
index 76501cc..4a55fbe 100644
--- a/atmosphere/tasks/composite/openstack_helm.py
+++ b/atmosphere/tasks/composite/openstack_helm.py
@@ -118,3 +118,62 @@
},
},
)
+
+
+class RabbitmqCluster(pykube.objects.NamespacedAPIObject):
+ version = "rabbitmq.com/v1beta1"
+ endpoint = "rabbitmqclusters"
+ kind = "RabbitmqCluster"
+
+
+class ApplyRabbitmqClusterTask(base.ApplyKubernetesObjectTask):
+ def __init__(self, name: str):
+ super().__init__(
+ kind=RabbitmqCluster,
+ namespace=constants.NAMESPACE_OPENSTACK,
+ name=name,
+ requires=[
+ f"helm-release-{constants.NAMESPACE_OPENSTACK}-{constants.HELM_RELEASE_RABBITMQ_OPERATOR_NAME}",
+ "name",
+ ],
+ inject={"name": name},
+ )
+
+ def generate_object(self, namespace, name, **kwargs) -> RabbitmqCluster:
+ return RabbitmqCluster(
+ self.api,
+ {
+ "apiVersion": self._obj_kind.version,
+ "kind": self._obj_kind.kind,
+ "metadata": {
+ "name": f"rabbitmq-{name}",
+ "namespace": namespace.name,
+ },
+ "spec": {
+ "affinity": {
+ "nodeAffinity": {
+ "requiredDuringSchedulingIgnoredDuringExecution": {
+ "nodeSelectorTerms": [
+ {
+ "matchExpressions": [
+ {
+ "key": "openstack-control-plane",
+ "operator": "In",
+ "values": ["enabled"],
+ }
+ ]
+ }
+ ]
+ }
+ }
+ },
+ "rabbitmq": {
+ "additionalConfig": "vm_memory_high_watermark.relative = 0.9\n"
+ },
+ "resources": {
+ "requests": {"cpu": "500m", "memory": "1Gi"},
+ "limits": {"cpu": "1", "memory": "2Gi"},
+ },
+ },
+ },
+ )
diff --git a/atmosphere/tasks/constants.py b/atmosphere/tasks/constants.py
index 215d1e8..7794288 100644
--- a/atmosphere/tasks/constants.py
+++ b/atmosphere/tasks/constants.py
@@ -90,3 +90,19 @@
HELM_RELEASE_PXC_OPERATOR_VALUES = {
"nodeSelector": NODE_SELECTOR_CONTROL_PLANE,
}
+
+HELM_RELEASE_KEYSTONE_NAME = "keystone"
+
+HELM_RELEASE_BARBICAN_NAME = "barbican"
+
+HELM_RELEASE_GLANCE_NAME = "glance"
+
+HELM_RELEASE_CINDER_NAME = "cinder"
+
+HELM_RELEASE_NEUTRON_NAME = "neutron"
+
+HELM_RELEASE_NOVA_NAME = "nova"
+
+HELM_RELEASE_SENLIN_NAME = "senlin"
+
+HELM_RELEASE_HEAT_NAME = "heat"
diff --git a/roles/atmosphere/templates/role.yml b/roles/atmosphere/templates/role.yml
index 051775b..47a0361 100644
--- a/roles/atmosphere/templates/role.yml
+++ b/roles/atmosphere/templates/role.yml
@@ -11,3 +11,6 @@
- apiGroups: ["pxc.percona.com"]
resources: ["perconaxtradbclusters"]
verbs: ["get", "create", "patch"]
+ - apiGroups: ["rabbitmq.com"]
+ resources: ["rabbitmqclusters"]
+ verbs: ["get", "create", "patch"]
diff --git a/roles/openstack_helm_endpoints/tasks/main.yml b/roles/openstack_helm_endpoints/tasks/main.yml
index 4764ad7..c8dc0b4 100644
--- a/roles/openstack_helm_endpoints/tasks/main.yml
+++ b/roles/openstack_helm_endpoints/tasks/main.yml
@@ -19,17 +19,6 @@
when:
- openstack_helm_endpoints_list is not defined or openstack_helm_endpoints_list == None
-# NOTE(mnaser): Since we manage one-RabbitMQ per service, we create the RabbitMQ
-# cluster here and then append the necessary values to be used
-# inside the `oslo_messaging` section.
-- name: Create RabbitMQ cluster
- ansible.builtin.include_role:
- name: rabbitmq
- vars:
- rabbitmq_cluster_name: "{{ openstack_helm_endpoints_chart }}"
- when:
- - '"oslo_messaging" in openstack_helm_endpoints_list'
-
- name: Reset value for OpenStack_Helm endpoints
ansible.builtin.set_fact:
openstack_helm_endpoints: "{{ openstack_helm_endpoints_config }}"
diff --git a/roles/rabbitmq/README.md b/roles/rabbitmq/README.md
deleted file mode 100644
index 4a53859..0000000
--- a/roles/rabbitmq/README.md
+++ /dev/null
@@ -1 +0,0 @@
-# `rabbitmq`
diff --git a/roles/rabbitmq/meta/main.yml b/roles/rabbitmq/meta/main.yml
deleted file mode 100644
index ac177b0..0000000
--- a/roles/rabbitmq/meta/main.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (c) 2022 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.
-
-galaxy_info:
- author: VEXXHOST, Inc.
- description: Ansible role for RabbitMQ
- license: Apache-2.0
- min_ansible_version: 5.5.0
- standalone: false
- platforms:
- - name: Ubuntu
- versions:
- - focal
-
-dependencies:
- - role: atmosphere
diff --git a/roles/rabbitmq/tasks/main.yml b/roles/rabbitmq/tasks/main.yml
deleted file mode 100644
index b650123..0000000
--- a/roles/rabbitmq/tasks/main.yml
+++ /dev/null
@@ -1,55 +0,0 @@
-# Copyright (c) 2022 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.
-
-- name: Deploy cluster
- kubernetes.core.k8s:
- state: present
- definition:
- apiVersion: rabbitmq.com/v1beta1
- kind: RabbitmqCluster
- metadata:
- name: "rabbitmq-{{ rabbitmq_cluster_name }}"
- namespace: openstack
- spec:
- affinity:
- nodeAffinity:
- requiredDuringSchedulingIgnoredDuringExecution:
- nodeSelectorTerms:
- - matchExpressions:
- - key: openstack-control-plane
- operator: In
- values:
- - enabled
- rabbitmq:
- additionalConfig: |
- vm_memory_high_watermark.relative = 0.9
- resources:
- requests:
- cpu: 500m
- memory: 1Gi
- limits:
- cpu: "1"
- memory: 2Gi
- wait: true
- wait_timeout: 600
- wait_condition:
- type: ClusterAvailable
- status: "True"
- # NOTE(mnaser): Since we haven't moved to the operator pattern yet, we need to
- # keep retrying a few times as the CRDs might not be installed
- # yet.
- retries: 60
- delay: 5
- register: _result
- until: _result is not failed