-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tiltfile
59 lines (45 loc) · 2.11 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
load('ext://restart_process', 'docker_build_with_restart')
CONTROLLER_DOCKERFILE = '''FROM golang:alpine
WORKDIR /
COPY ./bin/mcing-controller /
CMD ["/mcing-controller"]
'''
def manifests():
return 'make manifests;'
def generate():
return 'make generate;'
def apidoc():
return 'make apidoc;'
def controller_binary():
return 'CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bin/mcing-controller cmd/mcing-controller/main.go'
# Generate manifests and go files
local_resource('make manifests', manifests(), deps=["api", "controllers"], ignore=['*/*/zz_generated.deepcopy.go'])
local_resource('make generate', generate(), deps=["api"], ignore=['*/*/zz_generated.deepcopy.go'])
local_resource('make apidoc', apidoc(), deps=["api"], ignore=['*/*/zz_generated.deepcopy.go'])
# Deploy CRD
local_resource(
'CRD', 'make install', deps=["api"],
ignore=['*/*/zz_generated.deepcopy.go'])
# Deploy manager
watch_file('./config/')
k8s_yaml(kustomize('./config/dev'))
# Deploy sample minecraft resource
local_resource('Sample YAML', 'kustomize build ./config/samples | kubectl apply -f -', deps=["./config/samples"], resource_deps=["mcing-controller-manager"])
local_resource(
'Watch & Compile (mcing controller)', generate() + controller_binary(), deps=['internal', 'api', 'pkg', 'cmd/mcing-controller'],
ignore=['*/*/zz_generated.deepcopy.go'])
docker_build_with_restart(
'ghcr.io/kmdkuk/mcing-controller:latest', '.',
dockerfile_contents=CONTROLLER_DOCKERFILE,
entrypoint=['/mcing-controller'],
only=['./bin/mcing-controller'],
live_update=[
sync('./bin/mcing-controller', '/mcing-controller'),
]
)
local_resource('Build & Load (mcing-init)',
'make build-image-init tag-init IMAGE_PREFIX=ghcr.io/kmdkuk/ IMAGE_TAG=e2e; kind load docker-image ghcr.io/kmdkuk/mcing-init:e2e --name mcing-dev',
deps=["Dockerfile", 'pkg', 'cmd/mcing-init'])
local_resource('Build & Load (mcing-agent)',
'make build-image-agent tag-agent IMAGE_PREFIX=ghcr.io/kmdkuk/ IMAGE_TAG=e2e; kind load docker-image ghcr.io/kmdkuk/mcing-agent:e2e --name mcing-dev',
deps=["Dockerfile", 'pkg', 'cmd/mcing-agent'])