-
Notifications
You must be signed in to change notification settings - Fork 16
/
Makefile
74 lines (55 loc) · 1.98 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
.PHONY: build
build: target/initializer-container
SRCS=$(shell find ./pkg -name "*.go") $(shell find ./cmd -name "*.go")
.PHONY: generate
generate:
operator-sdk generate k8s
.PHONY: containers
containers: target/initializer-container operator-container
.PHONY: push-container
push-containers: containers
docker push soloio/envoy-operator:v0.0.1
docker push soloio/envoy-operator-init:0.1
.PHONY: minikube-env
minikube-env:
minikube start --vm-driver=kvm2 --cpus 3 --memory 8192
minikube docker-env
.PHONY: deploy
deploy:
kubectl apply -f deploy/rbac.yaml
kubectl apply -f deploy/crd.yaml
kubectl apply -f deploy/operator.yaml
################################## low level #############################################
target:
[ -d $@ ] || mkdir -p $@
target/initializer: target $(SRCS)
CGO_ENABLED=0 GOOS=linux go build -o $@ ./cmd/initializer/main.go
.PHONY: target/initializer-container
target/initializer-container: target/initializer cmd/initializer/Dockerfile
cat cmd/initializer/Dockerfile | docker build -t soloio/envoy-operator-init:0.1 -f - target
.PHONY: operator-container
operator-container:
./tmp/build/build.sh && IMAGE=soloio/envoy-operator:v0.0.1 ./tmp/build/docker_build.sh
#----------------------------------------------------------------------------------
# Generated Code
#----------------------------------------------------------------------------------
# must be a seperate target so that make waits for it to complete before moving on
.PHONY: mod-download
mod-download:
go mod download
DEPSGOBIN=$(shell pwd)/_output/.bin
# https://github.com/go-modules-by-example/index/blob/master/010_tools/README.md
.PHONY: install-go-tools
install-go-tools: mod-download
mkdir -p $(DEPSGOBIN)
GOBIN=$(DEPSGOBIN) go install golang.org/x/tools/cmd/goimports
.PHONY: generated-code
SUBDIRS:=$(shell ls -d -- */)
generated-code:
go mod tidy
GO111MODULE=on go generate ./...
gofmt -w $(SUBDIRS)
PATH=$(DEPSGOBIN):$$PATH goimports -w $(SUBDIRS)
.PHONY: clean
clean:
rm -rf _output