Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor adjustments while standarding shared code with the router vm charm #339

Merged
merged 2 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:

build:
name: Build charm
uses: canonical/data-platform-workflows/.github/workflows/[email protected].0
uses: canonical/data-platform-workflows/.github/workflows/[email protected].1
with:
cache: true

Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:
- lint
- unit-test
- build
uses: canonical/data-platform-workflows/.github/workflows/[email protected].0
uses: canonical/data-platform-workflows/.github/workflows/[email protected].1
with:
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}
architecture: ${{ matrix.architecture }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:

build:
name: Build charm
uses: canonical/data-platform-workflows/.github/workflows/[email protected].0
uses: canonical/data-platform-workflows/.github/workflows/[email protected].1

release:
name: Release charm
needs:
- ci-tests
- build
uses: canonical/data-platform-workflows/.github/workflows/[email protected].0
uses: canonical/data-platform-workflows/.github/workflows/[email protected].1
with:
channel: 8.0/edge
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
sync-docs:
name: Sync docs from Discourse
uses: canonical/data-platform-workflows/.github/workflows/[email protected].0
uses: canonical/data-platform-workflows/.github/workflows/[email protected].1
with:
reviewers: a-velasco,izmalk
permissions:
Expand Down
20 changes: 5 additions & 15 deletions src/abstract_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,15 @@ def _read_only_endpoints(self) -> str:

@property
@abc.abstractmethod
def _exposed_read_write_endpoint(self) -> typing.Optional[str]:
def _exposed_read_write_endpoints(self) -> typing.Optional[str]:
"""The exposed read-write endpoint.

Only defined in vm charm.
"""

@property
@abc.abstractmethod
def _exposed_read_only_endpoint(self) -> typing.Optional[str]:
def _exposed_read_only_endpoints(self) -> typing.Optional[str]:
"""The exposed read-only endpoint.

Only defined in vm charm.
Expand All @@ -134,10 +134,7 @@ def is_externally_accessible(self, *, event) -> typing.Optional[bool]:
@property
@abc.abstractmethod
def _status(self) -> ops.StatusBase:
"""Status of the charm.

Only applies to Kubernetes charm
"""
"""Status of the charm."""

@property
def _tls_certificate_saved(self) -> bool:
Expand Down Expand Up @@ -258,13 +255,6 @@ def _reconcile_service(self) -> None:
Only applies to Kubernetes charm
"""

def _check_service_connectivity(self) -> bool:
"""Check if the service is available (connectable with a socket).

Returns false if Machine charm. Overridden in Kubernetes charm.
"""
return False

@abc.abstractmethod
def _reconcile_ports(self, *, event) -> None:
"""Reconcile exposed ports.
Expand Down Expand Up @@ -364,8 +354,8 @@ def reconcile(self, event=None) -> None: # noqa: C901
event=event,
router_read_write_endpoints=self._read_write_endpoints,
router_read_only_endpoints=self._read_only_endpoints,
exposed_read_write_endpoint=self._exposed_read_write_endpoint,
exposed_read_only_endpoint=self._exposed_read_only_endpoint,
exposed_read_write_endpoints=self._exposed_read_write_endpoints,
exposed_read_only_endpoints=self._exposed_read_only_endpoints,
shell=workload_.shell,
)
self._update_endpoints()
Expand Down
7 changes: 4 additions & 3 deletions src/kubernetes_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def _status(self) -> ops.StatusBase:
return ops.BlockedStatus("K8s service not connectible")

def is_externally_accessible(self, *, event) -> typing.Optional[bool]:
"""No-op since this charm is exposed with node-port"""
"""No-op since this charm is exposed with the expose-external config."""

def _get_service(self) -> typing.Optional[lightkube.resources.core_v1.Service]:
"""Get the managed k8s service."""
Expand Down Expand Up @@ -251,6 +251,7 @@ def _reconcile_service(self) -> None:
logger.info(f"Request to create desired service {desired_service_type=} dispatched")

def _check_service_connectivity(self) -> bool:
"""Check if the service is available (connectable with a socket)."""
if not self._get_service() or not isinstance(
self.get_workload(event=None), workload.AuthenticatedWorkload
):
Expand Down Expand Up @@ -402,12 +403,12 @@ def _read_only_endpoints(self) -> str:
return self._get_hosts_ports("ro")

@property
def _exposed_read_write_endpoint(self) -> typing.Optional[str]:
def _exposed_read_write_endpoints(self) -> typing.Optional[str]:
"""Only applies to VM charm, so no-op."""
pass

@property
def _exposed_read_only_endpoint(self) -> typing.Optional[str]:
def _exposed_read_only_endpoints(self) -> typing.Optional[str]:
"""Only applies to VM charm, so no-op."""
pass

Expand Down
Loading