-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
executable file
·99 lines (78 loc) · 2.34 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
89
90
91
92
93
94
95
96
97
98
99
IMAGE=trace-context-injector:v1
DELAY=1
GOOS=$(shell go env GOOS)
GOARCH=$(shell go env GOARCH)
.PHONY: build
build:
CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} GO111MODULE=on go build -a -o bin/webhook ./cmd/webhook/main.go
docker: build
docker rmi -f $(IMAGE)
docker build -f build/Dockerfile -t $(IMAGE) .
docker save -o bin/$(IMAGE).tar $(IMAGE)
install:
hack/webhook-create-signed-cert.sh --service trace-context-injector-webhook-svc --secret trace-context-injector-webhook-certs --namespace default
cat deploy/base/mutatingwebhook.yaml | hack/webhook-patch-ca-bundle.sh > deploy/base/mutatingwebhook-ca-bundle.yaml
./tools/kustomize build deploy/base | kubectl apply -f -
remove:
kubectl delete secret trace-context-injector-webhook-certs
./tools/kustomize build deploy/base | kubectl delete -f -
.PHONY: test
test: gofmt golint govet gosec unit
gofmt:
./hack/gofmt.sh
golint: bin/golangci-lint
./bin/golangci-lint run ./... --timeout=10m
govet:
go vet ./...
gosec: bin/gosec
./bin/gosec -quiet ./...
unit:
go test ./... -coverprofile=cover.out
go tool cover -html=cover.out -o coverage.html
deployment:
kubectl apply -f test/yaml/deployment.yaml
sleep $(DELAY)
kubectl apply -f test/yaml/deployment_v2.yaml
sleep $(DELAY)
kubectl delete -f test/yaml/deployment_v2.yaml
deamonset:
kubectl apply -f test/yaml/deamonset.yaml
sleep $(DELAY)
kubectl apply -f test/yaml/deamonset_v2.yaml
sleep $(DELAY)
kubectl delete -f test/yaml/deamonset_v2.yaml
statefulset:
kubectl apply -f test/yaml/statefulset.yaml
sleep $(DELAY)
kubectl apply -f test/yaml/statefulset_v2.yaml
sleep $(DELAY)
kubectl delete -f test/yaml/statefulset_v2.yaml
replicaset:
kubectl apply -f test/yaml/replicaset.yaml
sleep $(DELAY)
kubectl apply -f test/yaml/replicaset_v2.yaml
sleep $(DELAY)
kubectl delete -f test/yaml/replicaset_v2.yaml
pod:
kubectl apply -f test/yaml/pod.yaml
sleep $(DELAY)
kubectl apply -f test/yaml/pod_v2.yaml
sleep $(DELAY)
kubectl delete -f test/yaml/pod_v2.yaml
clean:
rm -rf bin/*
rm -f deploy/base/mutatingwebhook-ca-bundle.yaml
rm -f cover*
docker rmi -f $(IMAGE)
# Install kustomize
bin/kustomize:
./hack/install_kustomize.sh
# Install controller-gen
bin/controller-gen:
./hack/install_controller-gen.sh
# Install golangci-lint
bin/golangci-lint:
./hack/install_golangci-lint.sh
# Install gosec
bin/gosec:
./hack/install_gosec.sh