annotate tasks.py @ 58:0064c490c33d

some tiny scrape configs for testing multi-node vmstorage/vmselect
author drewp@bigasterisk.com
date Fri, 26 Apr 2024 15:48:22 -0700
parents 21185db8a52e
children 6a357b483c04
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20
f5777b65f035 fast update of scrape_main.yaml
drewp@bigasterisk.com
parents: 15
diff changeset
1 import yaml
4
1eb6e6a2b9b6 version control configs finally; use configmaps to present them to VM
drewp@bigasterisk.com
parents:
diff changeset
2 from invoke import task
20
f5777b65f035 fast update of scrape_main.yaml
drewp@bigasterisk.com
parents: 15
diff changeset
3 from kubernetes import config
4
1eb6e6a2b9b6 version control configs finally; use configmaps to present them to VM
drewp@bigasterisk.com
parents:
diff changeset
4
22
cd115f1ca2a8 use configmaps and a special pod refresh trick
drewp@bigasterisk.com
parents: 20
diff changeset
5 import alert_rules
27
eec015e90818 reformat
drewp@bigasterisk.com
parents: 22
diff changeset
6 from k8s_ops import firstPodName, refreshPodCmaps, replaceCmap
4
1eb6e6a2b9b6 version control configs finally; use configmaps to present them to VM
drewp@bigasterisk.com
parents:
diff changeset
7
20
f5777b65f035 fast update of scrape_main.yaml
drewp@bigasterisk.com
parents: 15
diff changeset
8 config.load_kube_config()
12
b6720e379d5b config updates
drewp@bigasterisk.com
parents: 10
diff changeset
9
b6720e379d5b config updates
drewp@bigasterisk.com
parents: 10
diff changeset
10
22
cd115f1ca2a8 use configmaps and a special pod refresh trick
drewp@bigasterisk.com
parents: 20
diff changeset
11 @task
cd115f1ca2a8 use configmaps and a special pod refresh trick
drewp@bigasterisk.com
parents: 20
diff changeset
12 def push_config(ctx):
32
eb1de82c93aa refactor the merging of all the groups
drewp@bigasterisk.com
parents: 27
diff changeset
13 rulesObj = alert_rules.allRules(ctx)
10
2023a6ce7bc0 some of the config-rebuild code
drewp@bigasterisk.com
parents: 4
diff changeset
14
54
21185db8a52e refactor
drewp@bigasterisk.com
parents: 34
diff changeset
15 replaceCmap("victoriametrics-config", {
21185db8a52e refactor
drewp@bigasterisk.com
parents: 34
diff changeset
16 "scrape_main": scrapeConfig("config/scrape_main.yaml"),
58
0064c490c33d some tiny scrape configs for testing multi-node vmstorage/vmselect
drewp@bigasterisk.com
parents: 54
diff changeset
17 "scrape_recent": scrapeConfig("config/scrape_recent.yaml"),
0064c490c33d some tiny scrape configs for testing multi-node vmstorage/vmselect
drewp@bigasterisk.com
parents: 54
diff changeset
18 "scrape_forever": scrapeConfig("config/scrape_forever.yaml"),
54
21185db8a52e refactor
drewp@bigasterisk.com
parents: 34
diff changeset
19 "rules": rulesObj,
21185db8a52e refactor
drewp@bigasterisk.com
parents: 34
diff changeset
20 })
4
1eb6e6a2b9b6 version control configs finally; use configmaps to present them to VM
drewp@bigasterisk.com
parents:
diff changeset
21
34
3b91d52b007d rules tuning
drewp@bigasterisk.com
parents: 32
diff changeset
22 # these don't give errors on rules format! they just quietly keep the old
3b91d52b007d rules tuning
drewp@bigasterisk.com
parents: 32
diff changeset
23 # rules! use `skaffold run` to get errs.
3b91d52b007d rules tuning
drewp@bigasterisk.com
parents: 32
diff changeset
24 #
3b91d52b007d rules tuning
drewp@bigasterisk.com
parents: 32
diff changeset
25 # or run
3b91d52b007d rules tuning
drewp@bigasterisk.com
parents: 32
diff changeset
26 # validateTemplates = flag.Bool("rule.validateTemplates", true, "Whether to validate annotation and label templates")
54
21185db8a52e refactor
drewp@bigasterisk.com
parents: 34
diff changeset
27 # validateExpressions = flag.Bool("rule.validateExpressions", true, "Whether to validate rules expressions via MetricsQL engine")
34
3b91d52b007d rules tuning
drewp@bigasterisk.com
parents: 32
diff changeset
28
22
cd115f1ca2a8 use configmaps and a special pod refresh trick
drewp@bigasterisk.com
parents: 20
diff changeset
29 refreshPodCmaps(firstPodName("app=victoriametrics"))
cd115f1ca2a8 use configmaps and a special pod refresh trick
drewp@bigasterisk.com
parents: 20
diff changeset
30 refreshPodCmaps(firstPodName("app=vmalert"))
4
1eb6e6a2b9b6 version control configs finally; use configmaps to present them to VM
drewp@bigasterisk.com
parents:
diff changeset
31
22
cd115f1ca2a8 use configmaps and a special pod refresh trick
drewp@bigasterisk.com
parents: 20
diff changeset
32 # If the VM reloader isn't fast enough, we could do this too:
cd115f1ca2a8 use configmaps and a special pod refresh trick
drewp@bigasterisk.com
parents: 20
diff changeset
33 # hup(ctx, 'deploy/victoriametrics', 'victoria-metrics-prod')
20
f5777b65f035 fast update of scrape_main.yaml
drewp@bigasterisk.com
parents: 15
diff changeset
34
f5777b65f035 fast update of scrape_main.yaml
drewp@bigasterisk.com
parents: 15
diff changeset
35
54
21185db8a52e refactor
drewp@bigasterisk.com
parents: 34
diff changeset
36 def scrapeConfig(fn):
21185db8a52e refactor
drewp@bigasterisk.com
parents: 34
diff changeset
37 return yaml.load(open(fn), yaml.FullLoader)