Skip to content

Commit

Permalink
chore: Rename SD-Core charms by adding -k8s as a suffix (#57)
Browse files Browse the repository at this point in the history
Signed-off-by: gatici <[email protected]>
  • Loading branch information
gatici authored Dec 11, 2023
1 parent 810cd0f commit f7e71dd
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 29 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
integration-test:
uses: canonical/sdcore-github-workflows/.github/workflows/integration-test.yaml@main
with:
charm-file-name: "sdcore-nrf_ubuntu-22.04-amd64.charm"
charm-file-name: "sdcore-nrf-k8s_ubuntu-22.04-amd64.charm"

publish-charm:
name: Publish Charm
Expand All @@ -39,7 +39,7 @@ jobs:
if: ${{ github.ref_name == 'main' }}
uses: canonical/sdcore-github-workflows/.github/workflows/publish-charm.yaml@main
with:
charm-file-name: "sdcore-nrf_ubuntu-22.04-amd64.charm"
charm-file-name: "sdcore-nrf-k8s_ubuntu-22.04-amd64.charm"
secrets: inherit

lib-needs-publishing:
Expand All @@ -53,7 +53,7 @@ jobs:
with:
filters: |
fiveg_nrf:
- 'lib/charms/sdcore_nrf/v0/fiveg_nrf.py'
- 'lib/charms/sdcore_nrf_k8s/v0/fiveg_nrf.py'
publish-lib:
name: Publish Lib
Expand All @@ -63,5 +63,5 @@ jobs:
if: ${{ github.ref_name == 'main' }} && ${{ needs.changes.outputs.needs-publishing == 'true' }}
uses: canonical/sdcore-github-workflows/.github/workflows/publish-lib.yaml@main
with:
lib-name: "charms.sdcore_nrf.v0.fiveg_nrf"
lib-name: "charms.sdcore_nrf_k8s.v0.fiveg_nrf"
secrets: inherit
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# SD-Core NRF Operator (k8s)
[![CharmHub Badge](https://charmhub.io/sdcore-nrf/badge.svg)](https://charmhub.io/sdcore-nrf)
[![CharmHub Badge](https://charmhub.io/sdcore-nrf-k8s/badge.svg)](https://charmhub.io/sdcore-nrf-k8s)

Charmed Operator for the SD-Core Network Repository Function (NRF).
Charmed Operator for the SD-Core Network Repository Function (NRF) for K8s.

# Usage

```bash
juju deploy sdcore-nrf --channel=edge
juju deploy sdcore-nrf-k8s --channel=edge
juju deploy mongodb-k8s --trust --channel=5/edge
juju deploy self-signed-certificates --channel=beta

juju integrate sdcore-nrf:database mongodb-k8s
juju integrate self-signed-certificates:certificates sdcore-nrf:certificates
juju integrate sdcore-nrf-k8s:database mongodb-k8s
juju integrate self-signed-certificates:certificates sdcore-nrf-k8s:certificates
```

# Image
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
From a charm directory, fetch the library using `charmcraft`:
```shell
charmcraft fetch-lib charms.sdcore_nrf.v0.fiveg_nrf
charmcraft fetch-lib charms.sdcore_nrf_k8s.v0.fiveg_nrf
```
Add the following libraries to the charm's `requirements.txt` file:
Expand All @@ -28,7 +28,7 @@
from ops.charm import CharmBase
from ops.main import main
from charms.sdcore_nrf.v0.fiveg_nrf import NRFAvailableEvent, NRFRequires
from charms.sdcore_nrf_k8s.v0.fiveg_nrf import NRFAvailableEvent, NRFRequires
logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -58,7 +58,7 @@ def _on_nrf_available(self, event: NRFAvailableEvent):
from ops.charm import CharmBase, RelationJoinedEvent
from ops.main import main
from charms.sdcore_nrf.v0.fiveg_nrf import NRFProvides
from charms.sdcore_nrf_k8s.v0.fiveg_nrf import NRFProvides
class DummyFiveGNRFProviderCharm(CharmBase):
Expand Down Expand Up @@ -103,14 +103,14 @@ def _on_nrf_url_changed(
from pydantic import AnyHttpUrl, BaseModel, Field, ValidationError

# The unique Charmhub library identifier, never change it
LIBID = "cd132a12c2b34243bfd2bae8d08c32d6"
LIBID = "14746bb6f8d34accbeac27ea50ff4715"

# Increment this major API version when introducing breaking changes
LIBAPI = 0

# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
LIBPATCH = 6
LIBPATCH = 1

PYDEPS = ["pydantic", "pytest-interface-tester"]

Expand Down
10 changes: 5 additions & 5 deletions metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: sdcore-nrf
display-name: SD-Core NRF
name: sdcore-nrf-k8s
display-name: SD-Core NRF K8s
summary: Charmed Operator for the SD-Core Network Repository Function (NRF).
description: Charmed Operator for the SD-Core Network Repository Function (NRF).
website: https://charmhub.io/sdcore-nrf
source: https://github.com/canonical/sdcore-nrf-operator
issues: https://github.com/canonical/sdcore-nrf-operator/issues
website: https://charmhub.io/sdcore-nrf-k8s
source: https://github.com/canonical/sdcore-nrf-k8s-operator
issues: https://github.com/canonical/sdcore-nrf-k8s-operator/issues

containers:
nrf:
Expand Down
6 changes: 3 additions & 3 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.

"""Charmed operator for the SD-Core NRF service."""
"""Charmed operator for the SD-Core NRF service for K8s."""

import logging
from ipaddress import IPv4Address
from subprocess import check_output
from typing import Optional

from charms.data_platform_libs.v0.data_interfaces import DatabaseRequires # type: ignore[import]
from charms.sdcore_nrf.v0.fiveg_nrf import NRFProvides # type: ignore[import]
from charms.sdcore_nrf_k8s.v0.fiveg_nrf import NRFProvides # type: ignore[import]
from charms.tls_certificates_interface.v2.tls_certificates import ( # type: ignore[import]
CertificateAvailableEvent,
CertificateExpiringEvent,
Expand Down Expand Up @@ -81,7 +81,7 @@ def _render_config(


class NRFOperatorCharm(CharmBase):
"""Main class to describe juju event handling for the SD-Core NRF operator."""
"""Main class to describe juju event handling for the SD-Core NRF operator for K8s."""

def __init__(self, *args):
"""Initialize charm."""
Expand Down
1 change: 1 addition & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ flake8-docstrings
flake8-builtins
isort
juju>=3.1
macaroonbakery==1.3.2 # https://protobuf.dev/news/2022-05-06/#python-updates
mypy
pep8-naming
pyproject-flake8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from ops.charm import CharmBase, RelationJoinedEvent
from ops.main import main

from lib.charms.sdcore_nrf.v0.fiveg_nrf import NRFProvides
from lib.charms.sdcore_nrf_k8s.v0.fiveg_nrf import NRFProvides


class DummyFiveGNRFProviderCharm(CharmBase):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from ops.charm import CharmBase
from ops.main import main

from lib.charms.sdcore_nrf.v0.fiveg_nrf import NRFAvailableEvent, NRFBrokenEvent, NRFRequires
from lib.charms.sdcore_nrf_k8s.v0.fiveg_nrf import NRFAvailableEvent, NRFBrokenEvent, NRFRequires

logger = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def test_given_invalid_nrf_information_in_relation_data_when_relation_changed_th
relation_id=relation_id, app_or_unit=self.remote_app_name, key_values=relation_data
)
self.assertIn(
f"DEBUG:lib.charms.sdcore_nrf.v0.fiveg_nrf:Invalid relation data: {relation_data}",
f"DEBUG:lib.charms.sdcore_nrf_k8s.v0.fiveg_nrf:Invalid relation data: {relation_data}", # noqa: E501
log.output,
)

Expand Down Expand Up @@ -116,7 +116,7 @@ def test_given_nrf_information_not_in_relation_data_when_get_nrf_url_then_return
nrf_url = self.harness.charm.nrf_requirer.nrf_url
self.assertIsNone(nrf_url)
self.assertIn(
f"DEBUG:lib.charms.sdcore_nrf.v0.fiveg_nrf:Invalid relation data: {relation_data}",
f"DEBUG:lib.charms.sdcore_nrf_k8s.v0.fiveg_nrf:Invalid relation data: {relation_data}", # noqa: E501
log.output,
)

Expand All @@ -133,11 +133,11 @@ def test_given_nrf_information_in_relation_data_is_not_valid_when_get_nrf_url_th
nrf_url = self.harness.charm.nrf_requirer.nrf_url
self.assertIsNone(nrf_url)
self.assertIn(
f"DEBUG:lib.charms.sdcore_nrf.v0.fiveg_nrf:Invalid relation data: {relation_data}",
f"DEBUG:lib.charms.sdcore_nrf_k8s.v0.fiveg_nrf:Invalid relation data: {relation_data}", # noqa: E501
log.output,
)

@patch("lib.charms.sdcore_nrf.v0.fiveg_nrf.NRFRequirerCharmEvents.nrf_broken")
@patch("lib.charms.sdcore_nrf_k8s.v0.fiveg_nrf.NRFRequirerCharmEvents.nrf_broken")
def test_given_nrf_relation_created_when_relation_broken_then_nrf_broken_event_emitted(
self, patched_nrf_broken_event
):
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ envlist = lint, static, unit
src_path = {toxinidir}/src/
unit_test_path = {toxinidir}/tests/unit/
integration_test_path = {toxinidir}/tests/integration/
lib_path = {toxinidir}/lib/charms/sdcore_nrf/v0/
lib_path = {toxinidir}/lib/charms/sdcore_nrf_k8s/v0/
all_path = {[vars]src_path} {[vars]unit_test_path} {[vars]integration_test_path} {[vars]lib_path}

[testenv]
Expand Down

0 comments on commit f7e71dd

Please sign in to comment.