-
Notifications
You must be signed in to change notification settings - Fork 831
/
Makefile
202 lines (167 loc) · 6.9 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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
VERSION := $(shell cat ../../version.txt)
# This can be "Auto" or a Number
PYTEST_WORKERS ?= "2"
.PHONY: kind_create_cluster
kind_create_cluster:
kind create cluster --config ../resources/kind_config.yaml
.PHONY: kind_delete_cluster
kind_delete_cluster:
kind delete cluster
.PHONY: kind_build_operator
kind_build_operator:
cd ../../operator && make kind-image-install
.PHONY: kind_build_executor
kind_build_executor:
cd ../../executor && make kind-image-install
.PHONY: kind_build_test_models
kind_build_test_models:
make -C ../../examples/models/mean_classifier kind_load
make -C ../../examples/models/testing run_kind_load_all
make -C ../docker/fixed-model kind_load_images
make -C ../docker/echo-model kind_load_image
make -C ../docker/mock-preprocessor kind_load_image
.PHONY: kind_build_prepackaged
kind_build_prepackaged:
cd ../../servers/sklearnserver && make kind-load
cd ../../servers/xgboostserver && make kind-load
cd ../../servers/mlflowserver && make kind-load
cd ../../servers/tfserving_proxy && make kind-load
.PHONY: kind_build_alibi_explain
kind_build_alibi_explain:
cd ../../components/alibi-explain-server && make kind_load
.PHONY: kind_build_alibi_detect
kind_build_alibi_detect:
cd ../../components/alibi-detect-server && make kind_load
.PHONY: kind_build_rclone_storage_initializer
kind_build_rclone_storage_initializer:
cd ../../components/rclone-storage-initializer && make kind-load
.PHONY: kind_build_misc
kind_build_misc:
cd ../../components/routers/epsilon-greedy && make kind_load
.PHONY: kind_build_images
kind_build_images: build_protos kind_build_operator kind_build_executor kind_build_prepackaged kind_build_alibi_explain kind_build_alibi_detect kind_build_rclone_storage_initializer
.PHONY: kind_build_test_images
kind_build_test_images: kind_build_test_models kind_build_misc
.PHONY: helm_setup
helm_setup:
helm repo add seldonio https://storage.googleapis.com/seldon-charts
helm repo add datawire https://app.getambassador.io
helm repo add jetstack https://charts.jetstack.io
helm repo add metrics-server https://kubernetes-sigs.github.io/metrics-server/
helm repo update
.PHONY: install_ambassador
install_ambassador:
kubectl apply -f https://app.getambassador.io/yaml/emissary/3.8.0/emissary-crds.yaml
kubectl wait --timeout=2m --for=condition=available deployment emissary-apiext -n emissary-system
helm upgrade --install -n ambassador --create-namespace emissary datawire/emissary-ingress \
-f ../resources/ambassador_values.yaml
kubectl wait --timeout=2m --for=condition=available deploy \
-lapp.kubernetes.io/instance=emissary -n ambassador
kubectl apply -f ../resources/ambassador_nontls_setup.yaml -n ambassador
.PHONY: install_jaeger
install_jaeger:
kubectl create namespace observability || echo "namespace observability exists"
kubectl apply -f https://github.com/jaegertracing/jaeger-operator/releases/download/v1.38.0/jaeger-operator.yaml -n observability
kubectl wait --timeout=90s --for condition=Available -n observability deployment/jaeger-operator
sleep 20 # hack as Available condition does not seem to be enough for operator to be ready
kubectl create namespace seldon-system || echo "namespace seldon-system exists"
kubectl apply -f ../resources/jaeger.yaml
install_cert_manager:
helm upgrade \
--install \
cert-manager jetstack/cert-manager \
--namespace cert-manager \
--create-namespace \
--version v1.10.0 \
--wait \
--set installCRDs=true
sleep 5 #https://github.com/jetstack/cert-manager/issues/2273
.PHONY: install_seldon
install_seldon:
kubectl create namespace seldon-system || echo "namespace seldon-system exists"
helm delete seldon --namespace seldon-system || echo "seldon-core not installed"
helm upgrade seldon \
../../helm-charts/seldon-core-operator \
--namespace seldon-system \
--set istio.enabled=true \
--set ambassador.enabled=true \
--set keda.enabled=true \
--set istio.gateway=istio-system/seldon-gateway \
--set certManager.enabled=false \
--wait --install
# Install istio and patch nodePort to allow 8004 to point to ingress gateway
.PHONY: install_istio
install_istio:
curl -L https://istio.io/downloadIstio | ISTIO_VERSION=1.16.2 TARGET_ARCH=x86_64 sh -
istio-1.16.2/bin/istioctl install -y --set profile=demo
kubectl patch svc istio-ingressgateway -n istio-system --patch "$$(cat ../resources/istio-ingressgateway-patch.yaml)"
kubectl apply -f ../resources/seldon-gateway.yaml -n istio-system
.PHONY: install_keda
install_keda:
kubectl apply -f https://github.com/kedacore/keda/releases/download/v2.0.0/keda-2.0.0.yaml
.PHONY: create_namespaces
create_namespaces:
kubectl create namespace seldon || echo "Namespace seldon already exists"
kubectl create namespace test1 || echo "Namespace test1 already exists"
.PHONY: set_namespace
set_namespace:
kubectl config set-context $$(kubectl config current-context) --namespace=seldon
.PHONY: install_metrics
# Derived from https://github.com/kubernetes-sigs/kind/issues/398#issuecomment-478325705
install_metrics:
helm upgrade --install --set args={--kubelet-insecure-tls} metrics-server metrics-server/metrics-server --namespace kube-system --wait
.PHONY: kind_setup
kind_setup: create_namespaces helm_setup install_cert_manager install_ambassador install_istio install_keda install_jaeger install_seldon set_namespace install_metrics
port-forward-ambassador:
kubectl port-forward $$(kubectl get pods -n ambassador -lapp.kubernetes.io/instance=emissary -o jsonpath='{.items[0].metadata.name}') -n ambassador 8005:8080
.PHONY: s2i_build_base_images
s2i_build_base_images:
cd ../../wrappers/s2i/python/build_scripts && ./build_all.sh
.PHONY: build_protos
build_protos:
cp ../../proto/prediction.proto ./proto
cd ../../proto/tensorflow && make create_protos
cp -vr ../../proto/tensorflow/tensorflow .
python -m grpc.tools.protoc -I. --python_out=. --grpc_python_out=. ./proto/prediction.proto
cd ../../notebooks && make build_protos
cd ../../proto/k8s && make create_protos
#requires mvn, helm, ks, python, s2i and an accessible k8s cluster (if minikube increase mem and cpu)
#tests will create namespaces, deploy seldon core and create examples
install:
pip install -r dev_requirements.txt
pip install -e ../../python
# Run the core tests in parallel
test_parallel: build_protos install
pytest \
--verbose \
-s \
-W ignore \
-n $(PYTEST_WORKERS) \
-m "not sequential and not notebooks and not benchmark" 2>&1
# Then run the s2i tests in sequence (as they currently fail in parallel)
test_sequential: build_protos install
pytest \
--verbose \
-s \
-W ignore \
-n 0 \
-m "sequential" 2>&1
test_notebooks: build_protos install
pytest \
--verbose \
-s \
-m "notebooks" \
-W ignore test_notebooks.py::TestNotebooks 2>&1
test_benchmark: build_protos install
pytest \
--verbose \
-s \
-W ignore \
-m "benchmark" 2>&1
.PHONY: clean
clean:
rm -f proto/prediction*
rm -rf run.log
rm -rf tensorflow
rm -rf my-model
rm -rf ../../wrappers/s2i/python/_python/