forked from SeldonIO/seldon-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
158 lines (119 loc) · 5.26 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
SHELL := /bin/bash
VERSION ?= $(shell cat ../version.txt)
# Image URL to use all building/pushing image targets
DOCKER_REGISTRY ?= seldonio
IMAGE_NAME_BASE=seldon-core-executor
IMG ?= ${DOCKER_REGISTRY}/${IMAGE_NAME_BASE}:${VERSION}
EXECUTOR_FOLDERS ?= ./api/... ./predictor/... ./k8s/... ./logger/...
KIND_NAME ?= kind
# # 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
# Run go fmt against code
fmt:
go fmt ${EXECUTOR_FOLDERS}
# Run go vet against code
vet:
go vet ${EXECUTOR_FOLDERS}
# Build manager binary
executor: copy_operator fmt vet
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o executor cmd/executor/main.go
kafka-proxy: copy_operator fmt vet
go build -o kafka-proxy cmd/proxy/main.go
.PHONY: copy_operator
copy_operator:
rm -rf _operator
cp -r ../operator _operator
.PHONY: copy_protos
copy_protos:
cp -r ../proto/tensorflow/tensorflow/** proto/tensorflow
.PHONY: compile_seldon_proto
compile_seldon_proto:
cp ../proto/prediction.proto api/grpc/seldon/proto
cd api/grpc/seldon/proto && protoc -I. -I../../../../proto/ --go_out=paths=source_relative,plugins=grpc:. prediction.proto
sed -i "s/package api/package proto/" api/grpc/seldon/proto/prediction.pb.go
rm api/grpc/seldon/proto/prediction.proto
# https://github.com/tensorflow/serving/issues/1365#issuecomment-525351995
.PHONY: compile_tensorflow_proto
compile_tensorflow_proto:
git clone -b r1.15 https://github.com/tensorflow/tensorflow.git
git clone -b r1.14 https://github.com/tensorflow/serving.git
go run protoc.go
go mod edit -replace=github.com/tensorflow/tensorflow/tensorflow/go/core=./proto/tensorflow/core
cd proto/tensorflow/core && go mod init github.com/tensorflow/tensorflow/tensorflow/go/core && cd -
go build ./proto/tensorflow/serving
compile_kfserving_proto:
#git clone https://github.com/NVIDIA/triton-inference-server
mkdir -p api/grpc/kfserving/inference
cp triton-inference-server/src/core/*.proto api/grpc/kfserving/inference
cd api/grpc/kfserving/inference && protoc -I. --go_out=paths=source_relative,plugins=grpc:. grpc_service.proto && protoc -I. --go_out=paths=source_relative,plugins=grpc:. model_config.proto && protoc -I. --go_out=paths=source_relative,plugins=grpc:. server_status.proto
#sed -i "s/package nvidia_inferenceserver/package proto/" api/grpc/kfserving/proto/grpc_service.pb.go
#sed -i "s/package nvidia_inferenceserver/package proto/" api/grpc/kfserving/proto/model_config.pb.go
#sed -i "s/package nvidia_inferenceserver/package proto/" api/grpc/kfserving/proto/server_status.pb.go
.PHONY: add_protos
add_protos:
cd tensorflow && find ./tensorflow -name '*.proto' | cpio -pdm ../proto
cd serving && find ./tensorflow_serving -name '*.proto' | cpio -pdm ../proto
# Run tests
test: copy_operator fmt vet
go test ${EXECUTOR_FOLDERS} -coverprofile cover.out
copy_openapi_resources:
mkdir -p api/rest/openapi
cp ../openapi/swagger-ui/* api/rest/openapi
cp ../openapi/engine.oas3.json api/rest/openapi/seldon.json
mkdir -p api/rest/openapi/open-inference
cp ../openapi/v2/swagger-ui/* api/rest/openapi/open-inference
cp ../openapi/v2/dataplane.yaml api/rest/openapi/open-inference/dataplane.yaml
# Build the docker image
docker-build: copy_operator copy_openapi_resources
docker build -f Dockerfile.executor -t ${IMG} .
docker-push:
docker push ${IMG}
# Red Hat Related
# password can be found at: https://connect.redhat.com/projects/5e9b34726c2dde3913c2bb65/overview
project=5e9b34726c2dde3913c2bb65
redhat-image-scan:
docker pull ${IMG}
source ~/.config/seldon/seldon-core/redhat-image-passwords.sh && \
echo $${rh_password_executor} | docker login -u redhat-isv-containers+${project}-robot quay.io --password-stdin
docker tag ${IMG} quay.io/redhat-isv-containers/${project}:${VERSION}
docker push quay.io/redhat-isv-containers/${project}:${VERSION}
source ~/.config/seldon/seldon-core/redhat-image-passwords.sh && \
preflight check container quay.io/redhat-isv-containers/${project}:${VERSION} --docker-config=${HOME}/.docker/config.json --certification-project-id=${project} --pyxis-api-token=$${pyxis_api_token} --submit
kind-image-install: docker-build
kind load -v 3 docker-image ${IMG} --name ${KIND_NAME}
.PHONY: clean
clean:
rm -rf vendor
rm -rf tensorflow
rm -rf serving
rm -rf triton-inference-server
install-dev:
# Tool to generate license info
pip install \
'git+https://github.com/seldonio/kubeflow-testing#egg=go-license-tools&subdirectory=py/kubeflow/testing/go-license-tools'
.PHONY: licenses/dep.txt
licenses/dep.txt:
go list -m all | cut -d ' ' -f 1 > licenses/dep.txt
.PHONY: licenses
licenses: licenses/dep.txt
# NOTE: You need to create a file in ~/.github_api_token with a GitHub token.
get-github-repo \
-o licenses/repo.txt \
--manual-dep-repo-mapping ../licenses/dep_repo.manual.csv \
licenses/dep.txt
get-github-license-info -o licenses/license_info.csv licenses/repo.txt
python -m 'patch_additional_license_info' \
licenses/license_info.csv \
../licenses/additional_license_info.csv
concatenate-license -o licenses/license.txt licenses/license_info.csv
.PHONY: lint
lint: copy_operator licenses/dep.txt
# Check if licenses have changed
git \
--no-pager diff \
--exit-code \
./licenses