From 4feca9bb3a41abc0ebc51e0399c4364175630597 Mon Sep 17 00:00:00 2001 From: bom Date: Thu, 29 Dec 2022 10:05:54 +0100 Subject: [PATCH] Include monitoring configuration in c4k-mixin --- src/main/python/ddadevops/c4k_mixin.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/python/ddadevops/c4k_mixin.py b/src/main/python/ddadevops/c4k_mixin.py index 7195282..c6cbd1d 100644 --- a/src/main/python/ddadevops/c4k_mixin.py +++ b/src/main/python/ddadevops/c4k_mixin.py @@ -1,6 +1,7 @@ from os import chmod from .python_util import * from .devops_build import DevopsBuild +from .credential import gopass_field_from_path, gopass_password_from_path def add_c4k_mixin_config(config, c4k_module_name, @@ -31,10 +32,18 @@ class C4kMixin(DevopsBuild): def write_c4k_config(self): fqdn = self.get('fqdn') self.c4k_mixin_config.update({'fqdn':fqdn}) + self.c4k_mixin_config.update({'mon-config': { + 'cluster-name': f':{self.c4k_module_name}', + 'cluster-stage': f':{self.stage}', + 'grafana-cloud-url': 'https://prometheus-prod-01-eu-west-0.grafana.net/api/prom/push'}}) with open(self.build_path() + '/out_config.edn', 'w') as output_file: output_file.write(self.__generate_clojure_map(self.c4k_mixin_config)) def write_c4k_auth(self): + self.c4k_mixin_auth.update({'mon-auth': { + 'grafana-cloud-user': gopass_field_from_path('server/meissa/grafana_cloud', 'grafana-cloud-user'), + 'grafana-cloud-password': gopass_password_from_path('server/meissa/grafana_cloud') + }}) with open(self.build_path() + '/out_auth.edn', 'w') as output_file: output_file.write(self.__generate_clojure_map(self.c4k_mixin_auth)) chmod(self.build_path() + '/out_auth.edn', 0o600)