-
Notifications
You must be signed in to change notification settings - Fork 54
/
Tiltfile
64 lines (52 loc) · 1.59 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
# -*- mode: Python -*-
# Settings and defaults.
project_name = 'nri-kubernetes'
cluster_name = 'minikube'
live_reload = True
# Only use explicitly allowed kubeconfigs as a safety measure.
allow_k8s_contexts(cluster_name)
# Building Docker image.
load('ext://restart_process', 'docker_build_with_restart')
if live_reload:
binary_name = '%s-linux' % project_name
# Building daemon binary locally.
local_resource(
'%s-binary' % project_name,
'GOOS=linux make compile',
deps=[
"./src",
"./internal",
"./cmd"
],
)
# Use custom Dockerfile for Tilt builds, which only takes locally built daemon binary for live reloading.
dockerfile = '''
FROM alpine:3.17.3
COPY %s /usr/local/bin/%s
''' % (binary_name, project_name)
docker_build_with_restart(
ref=project_name,
context='./bin',
dockerfile_contents=dockerfile,
entrypoint=[
"/usr/local/bin/%s" % project_name,
],
only=binary_name,
live_update=[
# Copy the binary so it gets restarted.
sync('bin/%s' % binary_name, '/usr/local/bin/%s' % project_name),
],
)
else:
docker_build(project_name, '.')
# ns_yaml_str is wrapped as Blob so that Tiltfile will treat it as DATA and not as a filepath
ns_yaml_str = """
---
apiVersion: v1
kind: Namespace
metadata:
name: nri-k8s-dev
"""
k8s_yaml([blob(ns_yaml_str)])
k8s_yaml(helm('./charts/newrelic-infrastructure', name='nr', namespace='nri-k8s-dev', values=['values-dev.yaml', 'values-local.yaml']))
k8s_yaml(helm('./charts/internal/e2e-resources', name='e2e-resources', namespace='nri-k8s-dev'))