(charmed-osm) Add auth to prometheus and update kafka/zk
- Authentication to prometheus:
- Update prometheus relation to provide auth credentials (user/pass)
- Update grafana datasource to include credentials to prometheus
- Update kafka and zookeeper charms:
- Add support for the charms to talk to the new kafka charm
- Add kafka and zookeeper charms in local bundle
Change-Id: Ifb83769583178f3a2069ae6756aa430ec69eecce
Signed-off-by: David Garcia <david.garcia@canonical.com>
diff --git a/installers/charm/grafana/src/charm.py b/installers/charm/grafana/src/charm.py
index 36bf696..778b5eb 100755
--- a/installers/charm/grafana/src/charm.py
+++ b/installers/charm/grafana/src/charm.py
@@ -145,11 +145,19 @@
def _build_datasources_files(self):
files_builder = FilesV3Builder()
+ prometheus_user = self.prometheus_client.user
+ prometheus_password = self.prometheus_client.password
+ enable_basic_auth = all([prometheus_user, prometheus_password])
files_builder.add_file(
"datasource_prometheus.yaml",
Template(Path("templates/default_datasources.yaml").read_text()).substitute(
prometheus_host=self.prometheus_client.hostname,
prometheus_port=self.prometheus_client.port,
+ enable_basic_auth=enable_basic_auth,
+ user=f"user: {prometheus_user}" if enable_basic_auth else "",
+ password=f"password: {prometheus_password}"
+ if enable_basic_auth
+ else "",
),
)
return files_builder.build()