-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
88 lines (67 loc) · 2.27 KB
/
Makefile
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:crdVersions=v1"
GINKGO_ARGS = -r -p --randomize-suites --randomize-all
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
else
GOBIN=$(shell go env GOBIN)
endif
all: generate format manager webhook
test: lint unit-tests acceptance-tests
unit-tests:
ginkgo ${GINKGO_ARGS} --skip-package acceptance
acceptance-tests:
ginkgo -r acceptance
manager:
go build -o bin/manager cmd/manager/main.go
webhook:
go build -o bin/webhook cmd/webhook/main.go
run: generate format
go run ./cmd/manager/main.go
install: generate
kubectl apply -f deployments/k8s/manifests/projects.vmware.com_projects.yaml
kubectl apply -f deployments/k8s/manifests/projects.vmware.com_projectaccesses.yaml
generate: generate-deepcopy generate-rbac generate-crd
go generate ./...
generate-deepcopy: controller-gen
$(CONTROLLER_GEN) \
object:headerFile=./hack/boilerplate.go.txt \
paths=./api/...
generate-crd: controller-gen
$(CONTROLLER_GEN) $(CRD_OPTIONS) \
output:crd:artifacts:config=deployments/k8s/manifests \
paths=./...
generate-rbac: controller-gen
$(CONTROLLER_GEN) $(CRD_OPTIONS) \
rbac:roleName=projects-manager-role \
output:rbac:stdout \
paths=./controllers/... > deployments/k8s/manifests/manager-role.yaml
$(CONTROLLER_GEN) $(CRD_OPTIONS) \
rbac:roleName=projectaccesses-manager-role \
output:rbac:stdout \
paths=./pkg/... > deployments/k8s/manifests/projectaccess-role.yaml
$(CONTROLLER_GEN) $(CRD_OPTIONS) \
rbac:roleName=projects-leader-election-role \
output:rbac:stdout \
paths=./cmd/manager/... > deployments/k8s/manifests/leader-election-role.yaml
./scripts/yttify-yaml
controller-gen:
ifeq (, $(shell which controller-gen))
go get sigs.k8s.io/controller-tools/cmd/[email protected]
CONTROLLER_GEN=$(GOBIN)/controller-gen
else
CONTROLLER_GEN=$(shell which controller-gen)
endif
#### Custom tasks ####
clean-crs:
kubectl delete projects --all
lint:
golangci-lint run --timeout 2m30s --verbose
format:
golangci-lint run --fix --timeout 2m30s --verbose
#################### k14s ####################
kapp-deploy:
./scripts/kapp-deploy
kapp-delete:
kapp delete -a projects-operator -y