generated from cybozu-go/neco-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Tiltfile
71 lines (63 loc) · 2.92 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
65
66
67
68
69
70
71
load('ext://restart_process', 'docker_build_with_restart')
DOCKERFILE = '''FROM golang:alpine
WORKDIR /
COPY ./bin/cattage-controller /
CMD ["/cattage-controller"]
'''
# Generate manifests and go files
local_resource('make manifests', "make manifests", deps=["api", "controllers", "hooks"], ignore=['*/*/zz_generated.deepcopy.go'])
local_resource('make generate', "make generate", deps=["api", "controllers", "hooks"], ignore=['*/*/zz_generated.deepcopy.go'])
# Deploy CRD
local_resource(
'CRD', 'make install', deps=["api"],
ignore=['*/*/zz_generated.deepcopy.go'], labels=['cattage'])
# Don't watch generated files
watch_settings(ignore=['config/crd/bases/', 'config/rbac/role.yaml', 'config/webhook/manifests.yaml'])
# Deploy Cattage
watch_file('./config/')
k8s_yaml(kustomize('./config/dev'))
k8s_resource(new_name='Cattage Resources', objects=[
'cattage:namespace',
'cattage-mutating-webhook-configuration:mutatingwebhookconfiguration',
'cattage-controller-manager:serviceaccount',
'cattage-leader-election-role:role',
'cattage-manager-role:clusterrole',
'cattage-leader-election-rolebinding:rolebinding',
'cattage-manager-rolebinding:clusterrolebinding',
'cattage-controller-config:configmap',
'cattage-manager-config:configmap',
'cattage-serving-cert:certificate',
'cattage-selfsigned-issuer:issuer',
'cattage-validating-webhook-configuration:validatingwebhookconfiguration'
], labels=['cattage'])
k8s_resource(workload='cattage-controller-manager', labels=['cattage'])
local_resource(
'Watch & Compile', 'make build', deps=['controllers', 'pkg', 'hooks', 'cmd', 'version.go', 'api'],
ignore=['*/*/zz_generated.deepcopy.go'],
labels=['cattage'])
docker_build_with_restart(
'cattage:dev', '.',
dockerfile_contents=DOCKERFILE,
entrypoint=['/cattage-controller', '--zap-devel=true'],
only=['./bin/cattage-controller'],
live_update=[
sync('./bin/cattage-controller', '/cattage-controller'),
]
)
# Sample
local_resource(
'Sample: Template', 'kubectl apply -f ./config/samples/template.yaml',
deps=["./config/samples/template.yaml"], labels=['sample'])
local_resource(
'Sample: Tenant', 'kubectl apply -f ./config/samples/tenant.yaml', deps=["./config/samples/tenant.yaml"],
resource_deps=["cattage-controller-manager", "Sample: Template"], labels=['sample'])
local_resource(
'Sample: SubNamespace', 'kubectl apply -f ./config/samples/subnamespace.yaml',
deps=["./config/samples/subnamespace.yaml"], resource_deps=["Sample: Tenant"], labels=['sample'])
local_resource(
'Wait for SubNamespace',
'kubectl wait namespace/sub-1 --for=jsonpath="{.status.phase}"=Active --timeout=10s',
resource_deps=["Sample: SubNamespace"], labels=['sample'])
local_resource(
'Sample: Application', 'kubectl apply -f ./config/samples/application.yaml',
deps=["./config/samples/application.yaml"], resource_deps=["Wait for SubNamespace"], labels=['sample'])