Mercurial > code > home > repos > victoriametrics
view tasks.py @ 4:1eb6e6a2b9b6
version control configs finally; use configmaps to present them to VM
author | drewp@bigasterisk.com |
---|---|
date | Sun, 12 Jun 2022 17:08:31 -0700 |
parents | |
children | 2023a6ce7bc0 |
line wrap: on
line source
import urllib.request from invoke import task def updateConfigmapCmd(path): return f'kubectl create configmap victoriametrics-config --from-file {path}=config/{path} -o yaml --dry-run=client | kubectl apply -f -' def reload(ctx, svc): host = ctx.run(f'khost {svc}').stdout path = {'victoriametrics': '/m', 'vmalert': '/vmalert'}[svc] print(' -> status', urllib.request.urlopen(f'http://{host}{path}/-/reload').status) @task def sync_config(ctx): ctx.run(updateConfigmapCmd("scrape_config.yaml")) ctx.run(updateConfigmapCmd("scrape_ssl.yaml")) reload(ctx, 'victoriametrics') ctx.run(updateConfigmapCmd("rules_expected_hosts.yaml")) ctx.run(updateConfigmapCmd("rules_expected_nodes.yaml")) ctx.run(updateConfigmapCmd("rules_k8s.yaml")) ctx.run(updateConfigmapCmd("rules_main.yaml")) reload(ctx, 'vmalert')