From 54bb4f0b261a1dfa35ace3a6f24c213c4a075aee Mon Sep 17 00:00:00 2001 From: Avan Thakkar Date: Mon, 24 Jan 2022 15:08:02 +0530 Subject: [PATCH] mgr/cephadm: introduce loki and promtail containers Signed-off-by: Avan Thakkar (cherry picked from commit ddccfdb5aa108631a6ce0bc9435a4ded1c12af7f) Conflicts: src/cephadm/cephadm --- src/cephadm/cephadm | 51 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 1f022cfc466d5..d87cb1d0026a6 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -49,6 +49,9 @@ DEFAULT_IMAGE = 'quay.io/ceph/ceph:v17' DEFAULT_IMAGE_IS_MASTER = False DEFAULT_IMAGE_RELEASE = 'quincy' DEFAULT_PROMETHEUS_IMAGE = 'quay.io/prometheus/prometheus:v2.33.4' +DEFAULT_CADVISOR_IMAGE = 'gcr.io/cadvisor/cadvisor:v0.39.3' +DEFAULT_LOKI_IMAGE = 'docker.io/r/grafana/loki:2.4.0' +DEFAULT_PROMTAIL_IMAGE = 'docker.io/r/grafana/promtail:2.4.0' DEFAULT_NODE_EXPORTER_IMAGE = 'quay.io/prometheus/node-exporter:v1.3.1' DEFAULT_ALERT_MANAGER_IMAGE = 'quay.io/prometheus/alertmanager:v0.23.0' DEFAULT_GRAFANA_IMAGE = 'quay.io/ceph/ceph-grafana:8.3.5' @@ -523,6 +526,8 @@ class Monitoring(object): 'node-exporter': [9100], 'grafana': [3000], 'alertmanager': [9093, 9094], + 'cAdvisor': [8080], + 'loki': [3100] } components = { @@ -538,6 +543,33 @@ class Monitoring(object): 'prometheus.yml', ], }, + 'cAdvisor': { + 'image': DEFAULT_CADVISOR_IMAGE, + 'cpus': '2', + 'memory': '1GB' + }, + 'loki': { + 'image': DEFAULT_LOKI_IMAGE, + 'cpus': '1', + 'memory': '1GB', + 'args': [ + '--config.file=/etc/loki/loki.yml', + ], + 'config-json-files': [ + 'loki.yml', + ], + }, + 'promtail': { + 'image': DEFAULT_PROMTAIL_IMAGE, + 'cpus': '1', + 'memory': '1GB', + 'args': [ + '--config.file=/etc/promtail/promtail.yml', + ], + 'config-json-files': [ + 'promtail.yml', + ], + }, 'node-exporter': { 'image': DEFAULT_NODE_EXPORTER_IMAGE, 'cpus': '1', @@ -2595,6 +2627,16 @@ def create_daemon_dirs(ctx, fsid, daemon_type, daemon_id, uid, gid, config_dir = 'etc/alertmanager' makedirs(os.path.join(data_dir_root, config_dir), uid, gid, 0o755) makedirs(os.path.join(data_dir_root, config_dir, 'data'), uid, gid, 0o755) + elif daemon_type == 'promtail': + data_dir_root = get_data_dir(fsid, ctx.data_dir, + daemon_type, daemon_id) + config_dir = 'etc/promtail' + makedirs(os.path.join(data_dir_root, config_dir), uid, gid, 0o755) + elif daemon_type == 'loki': + data_dir_root = get_data_dir(fsid, ctx.data_dir, + daemon_type, daemon_id) + config_dir = 'etc/loki' + makedirs(os.path.join(data_dir_root, config_dir), uid, gid, 0o755) # populate the config directory for the component from the config-json if 'files' in config_json: @@ -2783,6 +2825,15 @@ def get_container_mounts(ctx, fsid, daemon_type, daemon_id, if daemon_type == 'prometheus': mounts[os.path.join(data_dir, 'etc/prometheus')] = '/etc/prometheus:Z' mounts[os.path.join(data_dir, 'data')] = '/prometheus:Z' + elif daemon_type == 'cAdvisor': + mounts['/sys'] = '/sys:ro' + mounts['/'] = '/rootfs:ro' + mounts['/var/run'] = '/var/run:rw' + mounts['/var/lib/docker'] = '/var/lib/docker:ro' + elif daemon_type == 'loki': + mounts[os.path.join(data_dir, 'etc/loki')] = '/etc/loki:Z' + elif daemon_type == 'promtail': + mounts[os.path.join(data_dir, 'etc/promtail')] = '/etc/promtail:Z' elif daemon_type == 'node-exporter': mounts['/proc'] = '/host/proc:ro' mounts['/sys'] = '/host/sys:ro' -- 2.39.5