forked from cni-genie/CNI-Genie
-
Notifications
You must be signed in to change notification settings - Fork 25
/
Makefile
72 lines (52 loc) · 1.93 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
# Disable make's implicit rules, which are not useful for golang, and slow down the build
# considerably.
.SUFFIXES:
GO_PATH=$(GOPATH)
SRCFILES=cni-genie.go
TEST_SRCFILES=$(wildcard *_test.go)
GO_PKG := $(shell go list ./... | grep -v vendor)
# Ensure that the dist directory is always created
MAKE_SURE_DIST_EXIST := $(shell mkdir -p dist)
.PHONY: clean plugin policy-controller policy-controller-binary admission-controller admission-controller-binary test-e2e
default: plugin policy-controller-binary admission-controller-binary
plugin: clean dist/genie
test-e2e: dist/genie-test
clean:
rm -rf dist
policy-controller: genie-policy
policy-controller-binary: genie-policy-binary
admission-controller: nw-admission-controller
admission-controller-binary: nw-admission-controller-binary
release: clean
# Build the genie cni plugin
dist/genie: $(SRCFILES)
echo "Building genie plugin..."
@GOPATH=$(GO_PATH) CGO_ENABLED=0 go build -v -i -o dist/genie \
-ldflags "-X main.VERSION=1.0 -s -w" cni-genie.go
nw-admission-controller-binary:
cd controllers/network-admission-controller && make
nw-admission-controller:
echo "Building genie network admission controller..."
cd controllers/network-admission-controller && make admission-controller
genie-policy-binary:
cd controllers/network-policy-controller && make
genie-policy:
echo "Building genie network policy controller..."
cd controllers/network-policy-controller && make policy-controller
# Build the genie cni plugin tests
dist/genie-test: $(TEST_SRCFILES)
@GOPATH=$(GO_PATH) CGO_ENABLED=0 ETCD_IP=127.0.0.1 PLUGIN=genie CNI_SPEC_VERSION=0.3.0 go test -v ./e2e/ -args --testKubeVersion=$(testKubeVersion) --testKubeConfig=$(testKubeConfig)
.PHONY: test
ifeq ($(WHAT),)
TESTDIR=.
else
TESTDIR=${WHAT}
endif
ifeq ($(print),y)
PRINT=-v
endif
test:
go test ${PRINT} `go list ./${TESTDIR}/... | grep -v vendor | grep -v e2e | grep -v controllers`
.PHONY: fmt
fmt:
@go fmt $(GO_PKG)