-
Notifications
You must be signed in to change notification settings - Fork 4
/
generate.sh
executable file
·79 lines (73 loc) · 2.41 KB
/
generate.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env bash
set -e
set -x
# only exit with zero if all commands of the pipeline exit successfully
set -o pipefail
# Make sure to use project tooling
PATH="$(pwd)/tmp/bin:${PATH}"
# Generate monitoring-satellite YAML files
jsonnet -c -J vendor -m monitoring-satellite/manifests \
--ext-code config="{
namespace: 'monitoring-satellite',
# clusterName: 'fake-cluster',
nodeAffinity: {
nodeSelector: {
'gitpod.io/workload_services': 'true',
'kubernetes.io/os': 'linux',
},
},
pyrra: {},
probe: {
targets: ['http://google.com'],
},
}" \
monitoring-satellite/manifests/yaml-generator.jsonnet | xargs -I{} sh -c 'cat {} | gojsontoyaml > {}.yaml' -- {}
# Generate monitoring-central YAML files
jsonnet -c -J vendor -m monitoring-central/manifests \
--ext-code config="{
namespace: 'monitoring-central',
grafana: {
nodePort: 32164,
DNS: 'http://fake.grafana.url',
GCPExternalIpAddress: 'fake_external_ip_address',
IAPClientID: 'fakeIAP_ID',
IAPClientSecret: 'fakeIAP_secret',
issuer: 'issuer-123',
},
victoriametrics: {
DNS: 'http://fake.victoriametrics.url',
authKey: 'random-key',
username: 'p@ssW0rd',
password: 'user',
GCPExternalIpAddress: 'fake_external_ip_address',
issuer: 'issuer-123',
cpu: 5,
memory: '20Gi',
},
stackdriver: {
clientEmail: '[email protected]',
defaultProject: 'google-project',
privateKey:
|||
multiline
fake
key
|||,
},
pyrra: {
prometheusURL: 'http://victoriametrics.monitoring-central.svc.cluster.local:8428',
DNS: 'http://fake.pyrra.url',
nodePort: 32164,
GCPExternalIpAddress: 'fake_external_ip_address',
IAPClientID: 'fakeIAP_ID',
IAPClientSecret: 'fakeIAP_secret',
},
}" \
monitoring-central/manifests/yaml-generator.jsonnet | xargs -I{} sh -c 'cat {} | gojsontoyaml > {}.yaml' -- {}
# Generate monitoring-satellite prometheus rules
jsonnet -c -J vendor -m monitoring-satellite/manifests \
--ext-code config="{}" \
monitoring-satellite/manifests/rules.jsonnet | xargs -I{} sh -c 'cat {} | gojsontoyaml > {}.yaml' -- {}
# Make sure to remove json files
find monitoring-satellite/manifests -type f ! -name '*.yaml' ! -name '*.jsonnet' -delete
find monitoring-central/manifests -type f ! -name '*.yaml' ! -name '*.jsonnet' -delete