-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathTiltfile
More file actions
69 lines (63 loc) · 2.49 KB
/
Tiltfile
File metadata and controls
69 lines (63 loc) · 2.49 KB
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
# -*- mode: Python -*-
#
# Tiltfile for local KubeLB development.
#
# Watches source files and rebuilds+redeploys the manager and CCM into their
# respective kind clusters. Processes run INSIDE the clusters (so
# envoycp.kubelb.svc xDS keeps working). Under the hood just calls
# `make dev-reload`, which uses hash-tracked builds to skip unchanged
# components.
#
# Usage (via Makefile): `make dev-tilt`
#
# Prerequisites: `make dev-setup` must have been run first.
config.define_string('kubeconfigs-dir')
cfg = config.parse()
KUBECONFIGS_DIR = cfg.get('kubeconfigs-dir', os.environ.get('KUBECONFIGS_DIR', os.getcwd() + '/.e2e-kubeconfigs'))
# Tilt connects to exactly one k8s context; we point at the manager cluster.
# CCM lives in kind-tenant1 and is managed via local_resource below
# (kubectl --kubeconfig), so Tilt never switches contexts.
allow_k8s_contexts('kind-kubelb')
# Fail fast if dev-setup wasn't run.
if not os.path.exists(KUBECONFIGS_DIR + '/kubelb.kubeconfig'):
fail('kubeconfigs not found at %s — run `make dev-setup` first' % KUBECONFIGS_DIR)
# ---------------------------------------------------------------------------
# Reload: rebuilds kubelb + ccm binaries, does hash-skipped docker build +
# kind load + rollout restart across kubelb and tenant1 clusters. Single
# resource so builds stay serialized and there are no concurrent-make races.
# reload.sh internally decides which components actually changed and skips
# untouched ones.
# ---------------------------------------------------------------------------
local_resource(
'kubelb-reload',
cmd='make -s DEV_MODE=true KUBECONFIGS_DIR=%s dev-reload' % KUBECONFIGS_DIR,
deps=[
'cmd/kubelb',
'cmd/ccm',
'internal',
'api',
'pkg',
'go.mod',
'go.sum',
],
ignore=[
'**/*_test.go',
'**/zz_generated_*.go',
],
labels=['kubelb'],
)
# Stream manager logs into the Tilt UI. (CCM lives in tenant1; tail its logs
# separately: `kubectl --kubeconfig=.e2e-kubeconfigs/tenant1.kubeconfig
# -n kubelb logs -f deploy/kubelb-ccm`.)
local_resource(
'kubelb-manager-logs',
serve_cmd='kubectl --kubeconfig="%s/kubelb.kubeconfig" -n kubelb logs -f deploy/kubelb --tail=50' % KUBECONFIGS_DIR,
resource_deps=['kubelb-reload'],
labels=['logs'],
)
local_resource(
'kubelb-ccm-logs',
serve_cmd='kubectl --kubeconfig="%s/tenant1.kubeconfig" -n kubelb logs -f deploy/kubelb-ccm --tail=50' % KUBECONFIGS_DIR,
resource_deps=['kubelb-reload'],
labels=['logs'],
)