-
Notifications
You must be signed in to change notification settings - Fork 200
/
Makefile
83 lines (64 loc) · 2.39 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
# Image URL to use all building/pushing image targets
IMG_MANAGER ?= kubespheredev/porter:v0.1.1
IMG_AGENT ?= kubespheredev/porter-agent:v0.1.1
NAMESPACE ?= porter-system
CRD_OPTIONS ?= "crd:trivialVersions=true"
# 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: manager
# Run tests
test: fmt vet
go test -v ./api/... ./controllers/... ./pkg/... -coverprofile cover.out
# Build manager binary
manager: fmt vet
go build -o bin/manager github.com/kubesphere/porter/cmd/manager
# Install CRDs into a cluster
install: manifests
kubectl apply -f config/crd/bases
# Deploy controller in the configured Kubernetes cluster in ~/.kube/config
deploy: manifests
kubectl apply -f config/crd/bases
kustomize build config/default | kubectl apply -f -
# Generate code
generate: controller-gen
$(CONTROLLER_GEN) object:headerFile=./hack/boilerplate.go.txt paths=./api/...
# Generate manifests e.g. CRD, RBAC etc.
manifests: controller-gen
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./api/..." paths="./controllers/..." output:crd:artifacts:config=config/crd/bases
# Run go fmt against code
fmt:
go fmt ./pkg/... ./cmd/... ./test/... ./api/... ./controllers/...
# Run go vet against code
vet:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go vet ./pkg/... ./cmd/... ./test/... ./controllers/...
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
debug: vet
./hack/test.sh -m debug
clean-up:
./hack/cleanup.sh
release:
./hack/deploy.sh ${IMG_MANAGER} manager
./hack/deploy.sh ${IMG_AGENT} agent
sed -i '' -e 's@image: .*@image: '"${IMG_AGENT}"'@' ./config/release/agent_image_patch.yaml
sed -i '' -e 's@image: .*@image: '"${IMG_MANAGER}"'@' ./config/release/manager_image_patch.yaml
kustomize build config/release -o deploy/porter.yaml
@echo "Done, the yaml is in deploy folder named 'porter.yaml'"
install-travis:
chmod +x ./hack/*.sh
./hack/install_tools.sh
e2e-test: vet
./hack/test.sh
e2e-nobuild:
./hack/test.sh --skip-build
docker-ut:
docker run --rm -v "${PWD}":/usr/src/github.com/kubesphere/porter -w /usr/src/github.com/kubesphere/porter golang:1.11-alpine go test -v ./pkg/nettool/