forked from tinkerbell/tink
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kube.mk
62 lines (52 loc) · 2 KB
/
kube.mk
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
## --------------------------------------
## Generate
## --------------------------------------
.PHONY: generate
generate: generate-go generate-manifests # Generate code, manifests etc.
.PHONY: generate-go
generate-go: bin/controller-gen bin/gofumpt # Generate Go code.
controller-gen object:headerFile="hack/boilerplate/boilerplate.generatego.txt" paths="./pkg/apis/..."
gofumpt -w -s ./pkg/apis
.PHONY: generate-manifests
generate-manifests: generate-crds generate-rbacs generate-server-rbacs # Generate manifests e.g. CRD, RBAC etc.
.PHONY: generate-crds
generate-crds: bin/controller-gen
controller-gen \
paths=./pkg/apis/... \
crd:crdVersions=v1 \
rbac:roleName=manager-role \
output:crd:dir=./config/crd/bases \
output:webhook:dir=./config/webhook \
webhook
prettier --write ./config/crd/bases
.PHONY: generate-rbacs
generate-rbacs: bin/controller-gen
controller-gen \
paths=./pkg/controllers/... \
output:rbac:dir=./config/rbac/ \
rbac:roleName=manager-role
prettier --write ./config/rbac
.PHONY: generate-server-rbacs
generate-server-rbacs: bin/controller-gen
controller-gen \
paths=./server/... \
output:rbac:dir=./config/server-rbac \
rbac:roleName=server-role
prettier --write ./config/server-rbac/
TINK_SERVER_IMAGE ?= quay.io/tinkerbell/tink-server
TINK_CONTROLLER_IMAGE ?= quay.io/tinkerbell/tink-controller
TINK_SERVER_TAG ?= latest
TINK_CONTROLLER_TAG ?= latest
NAMESPACE ?= tink-system
out/release/default/kustomization.yaml: config/default/kustomization.yaml
rm -rf out/
mkdir -p out/
cp -a config/ out/release/
out/release/tink.yaml: bin/kustomize generate-manifests out/release/default/kustomization.yaml
(cd out/release/default && \
kustomize edit set image server=$(TINK_SERVER_IMAGE):$(TINK_CONTROLLER_TAG) controller=$(TINK_CONTROLLER_IMAGE):$(TINK_CONTROLLER_TAG) && \
kustomize edit set namespace $(NAMESPACE) \
)
kustomize build out/release/default -o $@
prettier --write $@
release-manifests: out/release/tink.yaml ## Builds the manifests to publish with a release.