Merge "Fix internal-* in identity service relation data" into main

This commit is contained in:
Zuul 2024-06-20 06:57:52 +00:00 committed by Gerrit Code Review
commit 3a5dc6b7c5
2 changed files with 14 additions and 5 deletions

View File

@ -40,6 +40,9 @@ from typing import (
Dict,
List,
)
from urllib.parse import (
urlparse,
)
import charms.keystone_k8s.v0.domain_config as sunbeam_dc_svc
import charms.keystone_k8s.v0.identity_credentials as sunbeam_cc_svc
@ -1252,6 +1255,12 @@ export OS_AUTH_VERSION=3
region=region,
may_exist=True,
)
parsed_internal_endpoint = urlparse(self.internal_endpoint)
internal_host = parsed_internal_endpoint.hostname
internal_protocol = parsed_internal_endpoint.scheme
internal_port = parsed_internal_endpoint.port
if not internal_port:
internal_port = 80 if internal_protocol == "http" else 443
self.id_svc.interface.set_identity_service_credentials(
relation_name,
relation_id,
@ -1259,9 +1268,9 @@ export OS_AUTH_VERSION=3
ingress_address,
self.default_public_ingress_port,
"http",
ingress_address,
self.default_public_ingress_port,
"http",
internal_host,
internal_port,
internal_protocol,
ingress_address,
self.default_public_ingress_port,
"http",

View File

@ -213,8 +213,8 @@ class TestKeystoneOperatorCharm(test_utils.CharmTestCase):
"auth-port": "5000",
"auth-protocol": "http",
"internal-auth-url": "http://internal-url/v3",
"internal-host": "10.0.0.10",
"internal-port": "5000",
"internal-host": "internal-url",
"internal-port": "80",
"internal-protocol": "http",
"public-auth-url": "http://public-url/v3",
"service-domain-id": "sdomain_id",