Skip to content

Commit

Permalink
Merge branch 'main' into feature/generic-alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelThamm authored Dec 20, 2024
2 parents 7b458ea + f758e22 commit a0baec6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "cosl"
version = "0.0.47"
version = "0.0.48"
authors = [
{ name = "sed-i", email = "[email protected]" },
]
Expand Down
14 changes: 14 additions & 0 deletions src/cosl/coordinated_workers/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@
"charms.tempo_coordinator_k8s.v0.tracing",
"charms.observability_libs.v0.kubernetes_compute_resources_patch",
"charms.tls_certificates_interface.v3.tls_certificates",
"charms.catalogue_k8s.v1.catalogue",
)

from charms.catalogue_k8s.v1.catalogue import CatalogueConsumer, CatalogueItem
from charms.data_platform_libs.v0.s3 import S3Requirer
from charms.grafana_k8s.v0.grafana_dashboard import GrafanaDashboardProvider
from charms.loki_k8s.v1.loki_push_api import LogForwarder, LokiPushApiConsumer
Expand Down Expand Up @@ -165,6 +167,7 @@ def _validate_container_name(
"send-datasource": Optional[str],
"receive-datasource": Optional[str],
"s3": str,
"catalogue": Optional[str],
},
total=True,
)
Expand Down Expand Up @@ -204,6 +207,7 @@ def __init__(
container_name: Optional[str] = None,
remote_write_endpoints: Optional[Callable[[], List[RemoteWriteEndpoint]]] = None,
workload_tracing_protocols: Optional[List[ReceiverProtocol]] = None,
catalogue_item: Optional[CatalogueItem] = None,
):
"""Constructor for a Coordinator object.
Expand Down Expand Up @@ -231,6 +235,7 @@ def __init__(
and the worker charm can push metrics to.
workload_tracing_protocols: A list of protocols that the worker intends to send
workload traces with.
catalogue_item: A catalogue application entry to be sent to catalogue.
Raises:
ValueError:
Expand Down Expand Up @@ -261,6 +266,7 @@ def __init__(
self._container_name = container_name
self._resources_limit_options = resources_limit_options or {}
self.remote_write_endpoints_getter = remote_write_endpoints
self._catalogue_item = catalogue_item

self.nginx = Nginx(
self._charm,
Expand Down Expand Up @@ -330,6 +336,12 @@ def __init__(
else None
)

self.catalogue = (
CatalogueConsumer(self._charm, item=self._catalogue_item)
if self._endpoints.get("catalogue", None)
else None
)

# We always listen to collect-status
self.framework.observe(self._charm.on.collect_unit_status, self._on_collect_unit_status)

Expand Down Expand Up @@ -629,6 +641,8 @@ def _reconcile(self):

self._update_nginx_tls_certificates()
self.update_cluster()
if self.catalogue:
self.catalogue.update_item(item=self._catalogue_item) # type: ignore

@property
def _peers(self) -> Optional[Set[ops.model.Unit]]:
Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ commands =
charmcraft fetch-lib charms.tempo_coordinator_k8s.v0.tracing
charmcraft fetch-lib charms.observability_libs.v0.kubernetes_compute_resources_patch
charmcraft fetch-lib charms.tls_certificates_interface.v3.tls_certificates

charmcraft fetch-lib charms.catalogue_k8s.v1.catalogue

[testenv:fmt]
description = Apply coding style standards to code
deps =
Expand Down

0 comments on commit a0baec6

Please sign in to comment.