generated from pokt-network/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Tiltfile
37 lines (29 loc) · 1.53 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
load('ext://restart_process', 'docker_build_with_restart')
IMAGE_NAME = "pocket-operator"
DOCKERFILE = '''FROM debian:bullseye
WORKDIR /
COPY ./bin/manager /
CMD ["/manager"]
'''
def copy_samples():
local('cp ./.operator-builder/samples/* ./config/samples')
return ''
# Makes sure kustomize is installed and sets the image name (so tilt can intervene & control the container lifecycle)
local('make kustomize')
k8s_yaml(kustomize('config/default-localnet', kustomize_bin='bin/kustomize'))
### Monitors for changes in .operator-builder directory and rebuilds the operator from template
operator_builder_deps = ['.operator-builder/nodes.pokt.network/']
local_resource('operator-builder-watch-and-template', "cd .operator-builder && make operator-build", deps=operator_builder_deps)
### Builds and updates the operator binary on cluster
kubebuilder_deps = ['controllers', 'main.go', 'api', 'internal']
local_resource('kubebuilder-watch-and-compile', "make generate; GOOS=linux go build -o bin/manager main.go" + copy_samples(), deps=kubebuilder_deps, ignore=['*/*/zz_generated.deepcopy.go'])
local('cd config/manager && ../../bin/kustomize edit set image controller=ghcr.io/pokt-network/pocket-operator:latest')
local_resource('operator-builder-maintain-samples', "cd .operator-builder && make operator-samples", deps=['.operator-builder/samples/'])
docker_build_with_restart(IMAGE_NAME, '.',
dockerfile_contents=DOCKERFILE,
entrypoint='/manager',
only=['./bin/manager'],
live_update=[
sync('./bin/manager', '/manager'),
]
)