@@ -24,16 +24,16 @@ def kubebuilder(DOMAIN, GROUP, VERSION, KIND, IMG='controller:latest', CONTROLLE
24
24
25
25
return encode_yaml_stream (decoded )
26
26
return data
27
-
27
+
28
28
def manifests ():
29
29
return 'controller-gen ' + CONTROLLERGEN
30
-
30
+
31
31
def generate ():
32
32
return 'controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./...";'
33
-
33
+
34
34
def vetfmt ():
35
35
return 'go vet ./...; go fmt ./...'
36
-
36
+
37
37
# build to tilt_bin beause kubebuilder has a dockerignore for bin/
38
38
def binary ():
39
39
return 'CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -o tilt_bin/manager cmd/main.go'
@@ -43,29 +43,29 @@ def kubebuilder(DOMAIN, GROUP, VERSION, KIND, IMG='controller:latest', CONTROLLE
43
43
44
44
DIRNAME = os .path .basename (os . getcwd ())
45
45
# if kubebuilder
46
- if os .path .exists ('go.mod' ) == False :
46
+ if not os .path .exists ('go.mod' ):
47
47
local ("go mod init %s" % DIRNAME )
48
-
49
- if os .path .exists ('PROJECT' ) == False :
48
+
49
+ if not os .path .exists ('PROJECT' ):
50
50
local ("kubebuilder init --domain %s" % DOMAIN )
51
-
52
- if os .path .exists ('api' ) == False :
51
+
52
+ if not os .path .exists ('api' ):
53
53
local ("kubebuilder create api --resource --controller --group %s --version %s --kind %s" % (GROUP , VERSION , KIND ))
54
-
54
+
55
55
local (manifests () + generate ())
56
-
56
+
57
57
local_resource ('CRD' , manifests () + 'kustomize build config/crd | kubectl apply -f -' , deps = ["api" ])
58
-
58
+
59
59
k8s_yaml (yaml ())
60
-
60
+
61
61
deps = ['internal/controller' , 'cmd/main.go' ]
62
62
deps .append ('api' )
63
-
63
+
64
64
local_resource ('Watch&Compile' , generate () + binary (), deps = deps , ignore = ['*/*/zz_generated.deepcopy.go' ])
65
-
65
+
66
66
local_resource ('Sample YAML' , 'kubectl apply -f ./config/samples' , deps = ["./config/samples" ], resource_deps = [DIRNAME + "-controller-manager" ])
67
-
68
- docker_build_with_restart (IMG , '.' ,
67
+
68
+ docker_build_with_restart (IMG , '.' ,
69
69
dockerfile_contents = DOCKERFILE ,
70
70
entrypoint = '/manager' ,
71
71
only = ['./tilt_bin/manager' ],
0 commit comments