-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Tiltfile
54 lines (41 loc) · 1.97 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
# -*- mode: Python -*
# For more on Extensions, see: https://docs.tilt.dev/extensions.html
load('ext://restart_process', 'docker_build_with_restart')
load('ext://conftest', 'conftest')
load('ext://list_port_forwards', 'display_port_forwards')
load('ext://print_tiltfile_dir', 'print_tiltfile_dir')
load('ext://min_tilt_version', 'min_tilt_version')
min_tilt_version('0.13.0')
load('ext://tilt_inspector', 'tilt_inspector')
tilt_inspector()
#load('ext://min_k8s_version', 'min_k8s_version')
#min_k8s_version('1.21.1')
load('ext://namespace', 'namespace_create', 'namespace_inject')
namespace_create('webapp')
conftest(path='k8s/backend/deployment.yaml', namespace='main')
# k8s_yaml('k8s/backend/deployment.yaml')
k8s_yaml(namespace_inject(read_file('k8s/backend/deployment.yaml'), 'webapp'), allow_duplicates=False)
k8s_resource('backend-wotd-v1', port_forwards=3000, resource_deps=['conftest'])
# Add a live_update rule to our docker_build
congrats = "🎉 Congrats, you ran a live_update! 🎉"
docker_build('styled-wotd', '.', build_args={'IMAGE_SOURCE': 'node', 'IMAGE_TAG': 'lts', 'VERCEL_TOKEN': ''},
dockerfile='./Dockerfile',
entrypoint=['npm', 'run', 'develop:docker'],
live_update=[
sync('.', '/usr/src/app')
])
def api_server_logs():
api_server_pod_name = str(local('kubectl get pods --namespace kube-system -o=jsonpath="{.items..metadata.name}" -l component=kube-apiserver')).rstrip('\n')
local_resource('API Server Logs', '', serve_cmd='kubectl logs -f -n kube-system %s' % api_server_pod_name )
def current_namespace():
return str(local("kubectl config view --minify --output 'jsonpath={..namespace}'"))
def get_global(name):
return os.getenv(_get_env_name(name))
def set_global(name, value):
os.putenv(_get_env_name(name), value)
def unset_global(name):
os.unsetenv(_get_env_name(name))
def _get_env_name(name):
return 'TILT_GLOBAL_VAR_%s' % name.upper()
def jest(path):
local_resource("jest", "", serve_cmd="cd %s && yarn run jest --bail" % path)