-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathTiltfile
174 lines (156 loc) · 3.94 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
load('ext://restart_process', 'docker_build_with_restart')
load('ext://namespace', 'namespace_create')
namespace_create('kubetail-system')
# kubetail-cluster-api
local_resource(
'kubetail-cluster-api-compile',
'cd modules && CGO_ENABLED=0 GOOS=linux go build -o ../.tilt/cluster-api ./cluster-api/cmd/main.go',
deps=[
'./modules/cluster-api',
'./modules/shared'
]
)
docker_build_with_restart(
'kubetail-cluster-api',
dockerfile='hack/tilt/Dockerfile.kubetail-cluster-api',
context='.',
entrypoint="/cluster-api/cluster-api -c /etc/kubetail/config.yaml",
only=[
'./.tilt/cluster-api',
],
live_update=[
sync('./.tilt/cluster-api', '/cluster-api/cluster-api'),
]
)
# kubetail-cluster-agent
local_resource(
'kubetail-cluster-agent-compile',
'cd modules && CGO_ENABLED=0 GOOS=linux go build -o ../.tilt/cluster-agent ./cluster-agent/cmd/main.go',
deps=[
'./modules/cluster-agent',
'./modules/shared'
]
)
docker_build_with_restart(
'kubetail-cluster-agent',
dockerfile='hack/tilt/Dockerfile.kubetail-cluster-agent',
context='.',
entrypoint="/cluster-agent/cluster-agent -c /etc/kubetail/config.yaml",
only=[
'./.tilt/cluster-agent',
],
live_update=[
sync('./.tilt/cluster-agent', '/cluster-agent/cluster-agent'),
]
)
# kubetail-dashboard
local_resource(
'kubetail-dashboard-compile',
'''
# Check if the dashboard-ui/dist directory exists
if [ -d dashboard-ui/dist ]; then
rm -rf modules/dashboard/website &&
cp -r dashboard-ui/dist modules/dashboard/website
fi
# Build the Go binary
cd modules &&
CGO_ENABLED=0 GOOS=linux go build -o ../.tilt/dashboard ./dashboard/cmd/main.go
# Reset dashboard/website directory
if [ ! -f dashboard/website/.gitkeep ]; then
rm -rf dashboard/website &&
git checkout dashboard/website
fi
''',
deps=[
'./dashboard-ui/dist',
'./modules/dashboard',
'./modules/shared'
],
ignore=[
'./modules/dashboard/website'
]
)
docker_build_with_restart(
'kubetail-dashboard',
dockerfile='hack/tilt/Dockerfile.kubetail-dashboard',
context='.',
entrypoint="/dashboard/dashboard -c /etc/kubetail/config.yaml",
only=[
'./.tilt/dashboard',
],
live_update=[
sync('./.tilt/dashboard', '/dashboard/dashboard'),
]
)
# apply manifests
k8s_yaml('hack/tilt/kubetail.yaml')
k8s_yaml('hack/tilt/loggen.yaml')
k8s_yaml('hack/tilt/loggen-ansi.yaml')
k8s_yaml('hack/tilt/echoserver.yaml')
k8s_yaml('hack/tilt/cronjob.yaml')
k8s_yaml('hack/tilt/chaoskube.yaml')
# define resources
k8s_resource(
objects=[
'kubetail-system:namespace',
'kubetail:configmap',
'kubetail-testuser:serviceaccount',
'kubetail-testuser:role',
'kubetail-testuser:clusterrole',
'kubetail-testuser:rolebinding',
'kubetail-testuser:clusterrolebinding',
],
new_name='kubetail-shared',
)
k8s_resource(
'kubetail-dashboard',
port_forwards='4500:8080',
objects=[
'kubetail-dashboard:clusterrole',
'kubetail-dashboard:clusterrolebinding',
'kubetail-dashboard:role',
'kubetail-dashboard:rolebinding',
'kubetail-dashboard:serviceaccount',
],
resource_deps=['kubetail-shared'],
)
k8s_resource(
'kubetail-cluster-api',
port_forwards='4501:8080',
objects=[
'kubetail-cluster-api:serviceaccount',
'kubetail-cluster-api:role',
'kubetail-cluster-api:rolebinding',
],
resource_deps=['kubetail-shared'],
)
k8s_resource(
'kubetail-cluster-agent',
objects=[
'kubetail-cluster-agent:serviceaccount',
'kubetail-cluster-agent:networkpolicy',
],
resource_deps=['kubetail-shared'],
)
k8s_resource(
objects=[
'kubetail-cli:serviceaccount',
'kubetail-cli:clusterrole',
'kubetail-cli:clusterrolebinding',
],
new_name='kubetail-cli',
)
k8s_resource(
'chaoskube',
objects=[
'chaoskube:serviceaccount',
'chaoskube:clusterrole',
'chaoskube:clusterrolebinding',
'chaoskube:role',
'chaoskube:rolebinding'
]
)
k8s_resource(
'echoserver',
port_forwards='4502:8080',
)