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

Generate S3 config for mimir workers #15

Merged
merged 5 commits into from
Jan 9, 2024
Merged
Changes from 1 commit
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
37 changes: 20 additions & 17 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,23 +201,26 @@ def _set_data_dirs(self, config: Dict[str, Any]) -> dict:
https://grafana.com/docs/mimir/latest/references/configuration-parameters/
"""
config = config.copy()
for key, folder in (
("alertmanager", "data-alertmanager"),
("compactor", "data-compactor"),
):
if key not in config:
config[key] = {}
config[key]["data_dir"] = str(self._root_data_dir / folder)

# blocks_storage:
# bucket_store:
# sync_dir: /etc/mimir/tsdb-sync
# data_dir: /data/tsdb-sync
if config.get("blocks_storage"):
config["blocks_storage"] = {
"bucket_store": {"sync_dir": str(self._root_data_dir / "tsdb-sync")}
}

data_mapping = [
IbraAoad marked this conversation as resolved.
Show resolved Hide resolved
("alertmanager", "data_dir", "data-alertmanager"),
("alertmanager_storage", "filesystem", "data-alertmanager-recovery"),
("compactor", "data_dir", "data-compactor"),
("ruler", "rule_path", "data-ruler"),
("ruler_storage", "filesystem", "ruler"),
("blocks_storage", "filesystem", "blocks"),
("blocks_storage", "tsdb", "tsdb"),
("blocks_storage", "bucket_store", "tsdb-sync"),
]

for key, subkey, folder in data_mapping:
IbraAoad marked this conversation as resolved.
Show resolved Hide resolved
config.setdefault(key, {})
if subkey in config[key]:
if "data_dir" == subkey or subkey == "rule_path":
config[key][subkey] = str(self._root_data_dir / folder)
IbraAoad marked this conversation as resolved.
Show resolved Hide resolved
elif "filesystem" == subkey or subkey == "tsdb":
config[key][subkey] = {"dir": str(self._root_data_dir / folder)}
elif "bucket_store" == subkey:
config[key][subkey] = {"sync_dir": str(self._root_data_dir / folder)}
return config

def _running_mimir_config(self) -> Optional[dict]:
Expand Down