-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
79 lines (60 loc) · 1.86 KB
/
Copy pathMakefile
File metadata and controls
79 lines (60 loc) · 1.86 KB
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
# Image URL to use all building/pushing image targets
IMG ?= eni-controller:latest
# 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: build
# Build manager binary
build: fmt vet
go build -o bin/manager cmd/main.go
# Run against the configured Kubernetes cluster in ~/.kube/config
run: fmt vet
go run ./cmd/main.go
# Run go fmt against code
fmt:
go fmt ./...
# Run go vet against code
vet:
go vet ./...
# Build the docker image
docker-build:
docker build . -t ${IMG}
# Push the docker image
docker-push:
docker push ${IMG}
# Install CRDs into a cluster
install:
kubectl apply -f deploy/crds/
# Deploy controller in the configured Kubernetes cluster in ~/.kube/config
deploy: install
cd deploy && kustomize edit set image controller=${IMG}
kubectl apply -f deploy/
# Generate manifests e.g. CRD, RBAC etc.
manifests:
controller-gen crd rbac:roleName=eni-controller-role webhook paths="./..." output:crd:artifacts:config=deploy/crds
# Run unit tests
test: fmt vet
go test ./... -short -coverprofile cover.out
# Run unit tests only
test-unit:
go test -v ./pkg/... -short
# Run integration tests (requires AWS credentials)
test-integration:
go test -v ./pkg/aws -tags=integration
# Run end-to-end tests (requires AWS credentials and Kubernetes cluster)
test-e2e:
go test -v ./test/e2e -tags=e2e
# Run all tests
test-all: test-unit test-integration test-e2e
# Run unit tests with coverage
test-coverage:
go test -v ./pkg/... -short -coverprofile=coverage.out
go tool cover -html=coverage.out -o coverage.html
# Clean up
clean:
rm -rf bin/
rm -f coverage.out coverage.html cover.out
.PHONY: all build run fmt vet docker-build docker-push install deploy manifests test test-unit test-integration test-e2e test-all test-coverage clean