-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tiltfile
47 lines (37 loc) · 1.52 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
load('ext://restart_process', 'docker_build_with_restart')
DOCKERFILE = '''FROM golang:alpine
WORKDIR /
COPY ./bin/manager /
CMD ["/manager"]
'''
def manifests():
return './bin/controller-gen crd rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases;'
def generate():
return './bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./...";'
def binary():
return 'CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bin/manager main.go'
# Generate manifests and go files
local_resource('make manifests', manifests(), deps=["api", "controllers", "hooks"], ignore=['*/*/zz_generated.deepcopy.go'])
local_resource('make generate', generate(), deps=["api", "hooks"], ignore=['*/*/zz_generated.deepcopy.go'])
# Deploy CRD
local_resource(
'CRD', manifests() + 'kustomize build config/crd | kubectl apply -f -', deps=["api"],
ignore=['*/*/zz_generated.deepcopy.go'])
# Deploy manager
watch_file('./config/')
k8s_yaml(kustomize('./config/dev'))
local_resource(
'Watch & Compile', generate() + binary(), deps=['controllers', 'api', 'pkg', 'main.go'],
ignore=['*/*/zz_generated.deepcopy.go'])
docker_build_with_restart(
'controller:latest', '.',
dockerfile_contents=DOCKERFILE,
entrypoint=['/manager'],
only=['./bin/manager'],
live_update=[
sync('./bin/manager', '/manager'),
]
)
local_resource(
'Sample', 'kubectl apply -f ./config/samples/yumemi_v1alpha1_mirakurun.yaml',
deps=["./config/samples/yumemi_v1alpha1_mirakurun.yaml"])