Skip to content

Commit

Permalink
Update MimirRolesConfig for cos-lib coordinator compatibility (#72)
Browse files Browse the repository at this point in the history
* Update MimirRolesConfig to be compatible with ClusterRolesConfig in the cos-lib coordinator
* Chore: numpy module is required by the deepdiff module for unit tests

---------

Co-authored-by: Noctua <[email protected]>
  • Loading branch information
MichaelThamm and observability-noctua-bot authored Aug 28, 2024
1 parent 7b89a25 commit e7fe505
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from cosl.coordinated_workers.coordinator import Coordinator
from ops.model import ModelError

from mimir_config import MimirConfig, MimirRolesConfig
from mimir_config import MIMIR_ROLES_CONFIG, MimirConfig
from nginx_config import NginxConfig

# Log messages can be retrieved using juju debug-log
Expand Down Expand Up @@ -52,7 +52,7 @@ def __init__(self, *args: Any):

self.coordinator = Coordinator(
charm=self,
roles_config=MimirRolesConfig(),
roles_config=MIMIR_ROLES_CONFIG,
s3_bucket_name="mimir",
external_url=self.external_url,
worker_metrics_port=8080,
Expand Down
20 changes: 9 additions & 11 deletions src/mimir_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

import logging
from pathlib import Path
from typing import Any, Dict, Iterable, Mapping
from typing import Any, Dict

import yaml
from cosl import JujuTopology
from cosl.coordinated_workers.coordinator import Coordinator
from cosl.coordinated_workers.coordinator import ClusterRolesConfig, Coordinator
from cosl.coordinated_workers.interface import ClusterProvider
from cosl.coordinated_workers.worker import CERT_FILE, CLIENT_CA_FILE, KEY_FILE

Expand Down Expand Up @@ -81,15 +81,13 @@
"""The set of roles that need to be allocated for the
deployment to be considered robust according to the official recommendations/guidelines."""


class MimirRolesConfig:
"""Define the configuration for Mimir roles."""

roles: Iterable[str] = ROLES
meta_roles: Mapping[str, Iterable[str]] = META_ROLES
minimal_deployment: Iterable[str] = MINIMAL_DEPLOYMENT
recommended_deployment: Dict[str, int] = RECOMMENDED_DEPLOYMENT

MIMIR_ROLES_CONFIG = ClusterRolesConfig(
roles=ROLES,
meta_roles=META_ROLES,
minimal_deployment=MINIMAL_DEPLOYMENT,
recommended_deployment=RECOMMENDED_DEPLOYMENT,
)
"""Define the configuration for Mimir roles."""

# The minimum number of workers per role to enable replication
REPLICATION_MIN_WORKERS = 3
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ deps =
pytest
coverage[toml]
deepdiff
numpy
-r{toxinidir}/requirements.txt

# Binary deps from from charmcraft.yaml
Expand Down

0 comments on commit e7fe505

Please sign in to comment.