generated from cobaltcore-dev/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTiltfile
115 lines (105 loc) · 3.76 KB
/
Tiltfile
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Copyright 2025 SAP SE
# SPDX-License-Identifier: Apache-2.0
# For Pylance to not complain around:
# type: ignore
# Don't track us.
analytics_settings(False)
if not os.getenv('TILT_VALUES_PATH'):
fail("TILT_VALUES_PATH is not set.")
if not os.path.exists(os.getenv('TILT_VALUES_PATH')):
fail("TILT_VALUES_PATH "+ os.getenv('TILT_VALUES_PATH') + " does not exist.")
load('ext://helm_resource', 'helm_resource', 'helm_repo')
helm_repo(
'Bitnami Helm Repo',
'https://charts.bitnami.com/bitnami',
labels=['Repositories'],
)
helm_repo(
'Prometheus Community Helm Repo',
'https://prometheus-community.github.io/helm-charts',
labels=['Repositories'],
)
# Build the helm charts
local('test -f ./helm/cortex/Chart.lock || helm dep up ./helm/cortex')
local('test -f ./helm/prometheus/Chart.lock || helm dep up ./helm/prometheus')
local('test -f ./helm/postgres/Chart.lock || helm dep up ./helm/postgres')
########### Cortex Core Services
tilt_values = os.getenv('TILT_VALUES_PATH')
docker_build('ghcr.io/cobaltcore-dev/cortex', '.', only=[
'internal/', 'main.go', 'go.mod', 'go.sum', 'Makefile', tilt_values,
])
k8s_yaml(helm('./helm/cortex', name='cortex', values=[tilt_values]))
k8s_resource('cortex-syncer', port_forwards=[
port_forward(8001, 2112),
], links=[
link('localhost:8001/metrics', '/metrics'),
], labels=['Core-Services'])
k8s_resource('cortex-extractor', port_forwards=[
port_forward(8002, 2112),
], links=[
link('localhost:8002/metrics', '/metrics'),
], labels=['Core-Services'])
k8s_resource('cortex-scheduler', port_forwards=[
port_forward(8080, 8080),
port_forward(8003, 2112),
], links=[
link('localhost:8003/metrics', '/metrics'),
], labels=['Core-Services'])
k8s_resource('cortex-kpis', port_forwards=[
port_forward(8004, 2112),
], links=[
link('localhost:8004/metrics', '/metrics'),
], labels=['Core-Services'])
k8s_resource('cortex-mqtt', port_forwards=[
port_forward(1883, 1883), # Direct TCP connection
port_forward(8005, 8080), # Websocket connection
], labels=['Core-Services'])
########### Cortex Commands
k8s_resource('cortex-cli', labels=['Commands'])
local_resource(
'Run E2E Tests',
'kubectl exec -it cortex-cli -- /usr/bin/cortex checks',
deps=['./internal/checks'],
labels=['Commands'],
trigger_mode=TRIGGER_MODE_MANUAL,
auto_init=False,
)
########### Postgres DB for Cortex Core Service
k8s_yaml(helm('./helm/postgres', name='cortex-postgres'))
k8s_resource('cortex-postgresql', port_forwards=[
port_forward(5432, 5432),
], labels=['Core-Services'])
########### Monitoring
k8s_yaml(helm('./helm/prometheus-deps', name='cortex-prometheus-deps')) # Operator
k8s_yaml(helm('./helm/prometheus', name='cortex-prometheus')) # Alerts + ServiceMonitor
k8s_resource('cortex-prometheus-operator', labels=['Monitoring'])
k8s_resource(
new_name='cortex-prometheus',
port_forwards=[port_forward(9090, 9090)],
links=[
link('http://localhost:9090', 'metrics'),
link('http://localhost:9090/alerts', 'alerts'),
],
objects=['cortex-prometheus:Prometheus:default'],
labels=['Monitoring'],
)
k8s_resource(
new_name='cortex-alertmanager',
objects=['cortex-alertmanager:Alertmanager:default'],
labels=['Monitoring'],
)
docker_build('cortex-visualizer', 'visualizer')
k8s_yaml('./visualizer/app.yaml')
k8s_resource('cortex-visualizer', port_forwards=[
port_forward(8006, 80),
], links=[
link('localhost:8006', 'visualizer'),
], labels=['Monitoring'])
########### Plutono (Grafana Fork)
docker_build('cortex-plutono', 'plutono')
k8s_yaml('./plutono/app.yaml')
k8s_resource('cortex-plutono', port_forwards=[
port_forward(3000, 3000, name='plutono'),
], links=[
link('http://localhost:3000/d/cortex/cortex?orgId=1', 'cortex dashboard'),
], labels=['Monitoring'])