Add mandatory relations

Add mandatory relations to charm
Use ingress_public in templates instead of
ingress_internal as later is optional relation.

Depends-On: https://review.opendev.org/c/openstack/charm-ops-sunbeam/+/854508
Change-Id: Iae140bcd7f1e631f4fe79b3dcf76541a3b2a7e7d
This commit is contained in:
Hemanth Nakkina 2022-09-21 18:17:06 +05:30
parent f466346c70
commit 1db78897bc
4 changed files with 21 additions and 6 deletions

View File

@ -41,10 +41,10 @@ requires:
limit: 1
ingress-internal:
interface: ingress
optional: true
limit: 1
ingress-public:
interface: ingress
optional: true
limit: 1
identity-service:
interface: keystone
@ -55,6 +55,7 @@ requires:
interface: cinder-backend
image-service:
interface: glance
optional: true
provides:
ceph-access:

View File

@ -141,6 +141,14 @@ class CinderOperatorCharm(sunbeam_charm.OSBaseOperatorAPICharm):
wsgi_admin_script = "/usr/bin/cinder-wsgi-admin"
wsgi_public_script = "/usr/bin/cinder-wsgi-public"
mandatory_relations = {
'database',
'amqp',
'storage-backend',
'identity-service',
'ingress-public',
}
def __init__(self, framework):
super().__init__(framework)
self._state.set_default(admin_domain_name="admin_domain")
@ -155,7 +163,10 @@ class CinderOperatorCharm(sunbeam_charm.OSBaseOperatorAPICharm):
handlers = handlers or []
if self.can_add_handler("storage-backend", handlers):
self.sb_svc = StorageBackendRequiresHandler(
self, "storage-backend", self.configure_charm
self,
"storage-backend",
self.configure_charm,
"storage-backend" in self.mandatory_relations,
)
handlers.append(self.sb_svc)
handlers = super().get_relation_handlers(handlers)

View File

@ -3,9 +3,9 @@ use = call:cinder.api:root_app_factory
/: apiversions
/healthcheck: healthcheck
/v3: openstack_volume_api_v3
{% if ingress_internal.ingress_path -%}
{{ ingress_internal.ingress_path }}: apiversions
{{ ingress_internal.ingress_path }}/v3: openstack_volume_api_v3
{% if ingress_public.ingress_path -%}
{{ ingress_public.ingress_path }}: apiversions
{{ ingress_public.ingress_path }}/v3: openstack_volume_api_v3
{% endif -%}
[composite:openstack_volume_api_v3]

View File

@ -3,7 +3,10 @@ Listen 8776
WSGIDaemonProcess cinder processes=4 threads=1 user=cinder group=cinder \
display-name=%{GROUP}
WSGIProcessGroup cinder
WSGIScriptAlias / /usr/bin/cinder-wsgi
{% if ingress_public and ingress_public.ingress_path -%}
WSGIScriptAlias {{ ingress_public.ingress_path }} {{ wsgi_config.wsgi_public_script }}
{% endif -%}
WSGIScriptAlias / {{ wsgi_config.wsgi_public_script }}
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
<IfVersion >= 2.4>