Include monitoring configuration in c4k-mixin

This commit is contained in:
bom 2022-12-29 10:05:54 +01:00
parent b131458114
commit 4feca9bb3a

View file

@ -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)