Skip to content

Commit

Permalink
chore: bump rock image to fix grpc client reconnection issues (#363)
Browse files Browse the repository at this point in the history
Signed-off-by: gatici <[email protected]>
  • Loading branch information
gatici authored Nov 7, 2024
1 parent 1a37904 commit c669555
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ resources:
udr-image:
type: oci-image
description: OCI image for SD-Core's UDR
upstream-source: ghcr.io/canonical/sdcore-udr:1.4.1
upstream-source: ghcr.io/canonical/sdcore-udr:1.6.1

storage:
config:
Expand Down
12 changes: 10 additions & 2 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
TLS_RELATION_NAME = "certificates"
UDR_CONFIG_FILE_NAME = "udrcfg.yaml"
UDR_SBI_PORT = 29504
CERTS_DIR_PATH = "/support/TLS" # Certificate paths are hardcoded in UDR code
CERTS_DIR_PATH = "/support/TLS"
PRIVATE_KEY_NAME = "udr.key"
CERTIFICATE_NAME = "udr.pem"
CERTIFICATE_COMMON_NAME = "udr.sdcore"
Expand Down Expand Up @@ -438,6 +438,8 @@ def _generate_udr_config_file(self) -> str:
nrf_url=self._nrf.nrf_url,
scheme="https",
webui_uri=self._webui_requires.webui_url,
tls_pem=f"{CERTS_DIR_PATH}/{CERTIFICATE_NAME}",
tls_key=f"{CERTS_DIR_PATH}/{PRIVATE_KEY_NAME}"
)

def _is_config_update_required(self, content: str) -> bool:
Expand Down Expand Up @@ -483,6 +485,8 @@ def _render_config_file(
nrf_url: str,
scheme: str,
webui_uri: str,
tls_pem: str,
tls_key: str,
) -> str:
"""Render the config file content.
Expand All @@ -496,6 +500,8 @@ def _render_config_file(
nrf_url (str): NRF URL.
scheme (str): SBI interface scheme ("http" or "https")
webui_uri (str) : URL of the Webui
tls_pem (str): TLS certificate file.
tls_key (str): TLS key file.
Returns:
str: Config file content.
Expand All @@ -512,6 +518,8 @@ def _render_config_file(
nrf_url=nrf_url,
scheme=scheme,
webui_uri=webui_uri,
tls_pem=tls_pem,
tls_key=tls_key,
)

def _config_file_is_written(self) -> bool:
Expand Down Expand Up @@ -616,7 +624,7 @@ def _pebble_layer(self) -> Layer:
"override": "replace",
"startup": "enabled",
"command": "/bin/udr "
f"-udrcfg {BASE_CONFIG_PATH}/{UDR_CONFIG_FILE_NAME}",
f"-cfg {BASE_CONFIG_PATH}/{UDR_CONFIG_FILE_NAME}",
"environment": self._environment_variables,
}
},
Expand Down
3 changes: 3 additions & 0 deletions src/templates/udrcfg.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ configuration:
registerIPv4: {{ udr_ip_address }}
bindingIPv4: 0.0.0.0
port: {{ udr_sbi_port }}
tls:
pem: {{ tls_pem }}
key: {{ tls_key }}
mongodb:
name: {{ common_database_name }}
url: {{ common_database_url }}
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/resources/expected_udrcfg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ configuration:
registerIPv4: 1.2.3.4
bindingIPv4: 0.0.0.0
port: 29504
tls:
pem: /support/TLS/udr.pem
key: /support/TLS/udr.key
mongodb:
name: free5gc
url: http://dummy
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_charm_configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def test_given_given_workload_ready_when_configure_then_pebble_plan_is_applied(
"udr": {
"startup": "enabled",
"override": "replace",
"command": "/bin/udr -udrcfg /free5gc/config/udrcfg.yaml",
"command": "/bin/udr -cfg /free5gc/config/udrcfg.yaml",
"environment": {
"GRPC_GO_LOG_VERBOSITY_LEVEL": "99",
"GRPC_GO_LOG_SEVERITY_LEVEL": "info",
Expand Down

0 comments on commit c669555

Please sign in to comment.