diff --git a/charms/aodh-k8s/metadata.yaml b/charms/aodh-k8s/metadata.yaml index 31f593fb..5b3aef36 100644 --- a/charms/aodh-k8s/metadata.yaml +++ b/charms/aodh-k8s/metadata.yaml @@ -34,23 +34,23 @@ resources: aodh-api-image: type: oci-image description: OCI image for OpenStack aodh - upstream-source: kolla/ubuntu-binary-aodh-notifier:yoga + upstream-source: ghcr.io/openstack-snaps/aodh-consolidated:2023.1 aodh-evaluator-image: type: oci-image description: OCI image for OpenStack aodh - upstream-source: kolla/ubuntu-binary-aodh-evaluator:yoga + upstream-source: ghcr.io/openstack-snaps/aodh-consolidated:2023.1 aodh-notifier-image: type: oci-image description: OCI image for OpenStack aodh - upstream-source: kolla/ubuntu-binary-aodh-notifier:yoga + upstream-source: ghcr.io/openstack-snaps/aodh-consolidated:2023.1 aodh-listener-image: type: oci-image description: OCI image for OpenStack aodh - upstream-source: kolla/ubuntu-binary-aodh-listener:yoga + upstream-source: ghcr.io/openstack-snaps/aodh-consolidated:2023.1 aodh-expirer-image: type: oci-image description: OCI image for OpenStack aodh - upstream-source: kolla/ubuntu-binary-aodh-expirer:yoga + upstream-source: ghcr.io/openstack-snaps/aodh-consolidated:2023.1 requires: database: diff --git a/charms/aodh-k8s/src/charm.py b/charms/aodh-k8s/src/charm.py index ca52c8a2..4290f02e 100755 --- a/charms/aodh-k8s/src/charm.py +++ b/charms/aodh-k8s/src/charm.py @@ -7,6 +7,7 @@ This charm provide Aodh services as part of an OpenStack deployment import logging from typing import List +import ops.pebble import ops_sunbeam.charm as sunbeam_charm import ops_sunbeam.container_handlers as sunbeam_chandlers import ops_sunbeam.core as sunbeam_core @@ -22,6 +23,19 @@ AODH_LISTENER_CONTAINER = "aodh-listener" AODH_EXPIRER_CONTAINER = "aodh-expirer" +class AODHWSGIPebbleHandler(sunbeam_chandlers.WSGIPebbleHandler): + """Pebble handler for AODH api service.""" + + def init_service(self, context) -> None: + """Initialise the container.""" + try: + self.execute(["a2dissite", "aodh-api"], exception_on_error=True) + except ops.pebble.ExecError: + logger.exception("Failed to disable aodh-api site in apache") + + super().init_service(context) + + class AODHEvaluatorPebbleHandler(sunbeam_chandlers.ServicePebbleHandler): """Pebble handler for AODH Evaluator.""" @@ -230,7 +244,7 @@ class AodhOperatorCharm(sunbeam_charm.OSBaseOperatorAPICharm): # else: # enable_expirer = False pebble_handlers = [ - sunbeam_chandlers.WSGIPebbleHandler( + AODHWSGIPebbleHandler( self, AODH_WSGI_CONTAINER, self.service_name, diff --git a/charms/aodh-k8s/tests/bundles/smoke.yaml b/charms/aodh-k8s/tests/bundles/smoke.yaml index 5d2219b3..4d3341a3 100644 --- a/charms/aodh-k8s/tests/bundles/smoke.yaml +++ b/charms/aodh-k8s/tests/bundles/smoke.yaml @@ -40,17 +40,26 @@ applications: storage: fernet-keys: 5M credential-keys: 5M - + gnocchi: + charm: gnocchi-k8s + channel: edge + scale: 1 + trust: true + ceilometer: + charm: ceilometer-k8s + channel: edge + scale: 1 + trust: true aodh: charm: ../../aodh-k8s.charm scale: 1 trust: true resources: - aodh-api-image: kolla/ubuntu-binary-aodh-notifier:yoga - aodh-evaluator-image: kolla/ubuntu-binary-aodh-evaluator:yoga - aodh-notifier-image: kolla/ubuntu-binary-aodh-notifier:yoga - aodh-listener-image: kolla/ubuntu-binary-aodh-listener:yoga - aodh-expirer-image: kolla/ubuntu-binary-aodh-expirer:yoga + aodh-api-image: ghcr.io/openstack-snaps/aodh-consolidated:2023.1 + aodh-evaluator-image: ghcr.io/openstack-snaps/aodh-consolidated:2023.1 + aodh-notifier-image: ghcr.io/openstack-snaps/aodh-consolidated:2023.1 + aodh-listener-image: ghcr.io/openstack-snaps/aodh-consolidated:2023.1 + aodh-expirer-image: ghcr.io/openstack-snaps/aodh-consolidated:2023.1 relations: - - traefik:ingress @@ -72,3 +81,17 @@ relations: - - traefik-public:ingress - aodh:ingress-public +- - mysql:database + - gnocchi:database +- - traefik:ingress + - gnocchi:ingress-internal +- - traefik-public:ingress + - gnocchi:ingress-public +- - keystone:identity-service + - gnocchi:identity-service + +- - rabbitmq:amqp + - ceilometer:amqp +- - keystone:identity-credentials + - ceilometer:identity-credentials + diff --git a/charms/aodh-k8s/tests/unit/test_charm.py b/charms/aodh-k8s/tests/unit/test_charm.py index e82130ee..a90d1106 100644 --- a/charms/aodh-k8s/tests/unit/test_charm.py +++ b/charms/aodh-k8s/tests/unit/test_charm.py @@ -89,7 +89,11 @@ class TestAodhOperatorCharm(test_utils.CharmTestCase): self.harness.set_leader() test_utils.set_all_pebbles_ready(self.harness) - app_setup_cmds = [["a2ensite", "wsgi-aodh-api"], ["aodh-dbsync"]] + app_setup_cmds = [ + ["a2ensite", "wsgi-aodh-api"], + ["aodh-dbsync"], + ["a2dissite", "aodh-api"], + ] for cmd in app_setup_cmds: self.assertIn(cmd, self.container_calls.execute["aodh-api"])