Skip to content

Commit 8d21733

Browse files
authored
add kserve frontend samples for A/B/n (#114)
* add mm frontend sample Signed-off-by: Michael Kalantar <[email protected]> * kserve-http abn sample frontend Signed-off-by: Michael Kalantar <[email protected]> * kserve grpc sample frontend Signed-off-by: Michael Kalantar <[email protected]> * updated comments Signed-off-by: Michael Kalantar <[email protected]> * updated comments Signed-off-by: Michael Kalantar <[email protected]> --------- Signed-off-by: Michael Kalantar <[email protected]>
1 parent 6814661 commit 8d21733

File tree

21 files changed

+5452
-3291
lines changed

21 files changed

+5452
-3291
lines changed

.github/workflows/abn-sample.yaml

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
- samples/abn-sample
88

99
jobs:
10+
# A/B/n sample backend HTTP service
1011
build-and-push-backend:
1112
runs-on: ubuntu-latest
1213
steps:
@@ -39,6 +40,8 @@ jobs:
3940
file: samples/abn-sample/backend/Dockerfile
4041
push: true
4142

43+
# A/B/n sample frontend where the backend is a simple HTTP server (see above)
44+
# Sample frontends are provided in both go and node
4245
build-and-push-frontends:
4346
runs-on: ubuntu-latest
4447
strategy:
@@ -74,3 +77,121 @@ jobs:
7477
file: samples/abn-sample/frontend/${{ matrix.lang }}/Dockerfile
7578
push: true
7679

80+
81+
# A/B/n sample frontend for modelmesh-serving
82+
# In this case, the backends are models deployed as InferenceServices
83+
# This frontend is implemented omly in go
84+
build-and-push-mm-frontend:
85+
runs-on: ubuntu-latest
86+
strategy:
87+
matrix:
88+
lang: [go]
89+
steps:
90+
- uses: actions/checkout@v3
91+
with:
92+
fetch-depth: 0
93+
- name: Get version
94+
run: |
95+
tagref=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
96+
# Strip "v" prefix from tagref
97+
echo "VERSION=$(echo $tagref | sed -e 's/^v//')" >> $GITHUB_ENV
98+
echo "MAJOR_MINOR_VERSION=$(echo $tagref | sed -e 's/^v//' -e 's,\([0-9]*\.[0-9]*\)\.\([0-9]*\),\1,')" >> $GITHUB_ENV
99+
- name: Get owner
100+
run: |
101+
ownerrepo=${{ github.repository }}
102+
owner=$(echo $ownerrepo | cut -f1 -d/)
103+
if [[ "$owner" == "iter8-tools" ]]; then
104+
owner=iter8
105+
fi
106+
echo "OWNER=$owner" >> $GITHUB_ENV
107+
- uses: docker/setup-buildx-action@v2
108+
- uses: docker/login-action@v2
109+
with:
110+
username: ${{ secrets.DOCKERHUB_USERNAME }}
111+
password: ${{ secrets.DOCKERHUB_SECRET }}
112+
- uses: docker/build-push-action@v4
113+
with:
114+
platforms: linux/amd64,linux/arm64
115+
tags: ${{ env.OWNER }}/abn-sample-mm-frontend-${{ matrix.lang }}:${{ env.VERSION }},${{ env.OWNER }}/abn-sample-mm-frontend-${{ matrix.lang }}:${{ env.MAJOR_MINOR_VERSION }},${{ env.OWNER }}/abn-sample-mm-frontend-${{ matrix.lang }}:latest
116+
file: samples/abn-sample/mm-frontend/${{ matrix.lang }}/Dockerfile
117+
context: samples/abn-sample/mm-frontend/${{ matrix.lang }}
118+
push: true
119+
120+
# A/B/n sample frontend for KServe w/ HTTP
121+
# In this case, the backends are models deployed as InferenceServices
122+
# This frontend is implemented omly in go
123+
build-and-push-kserve-http-frontend:
124+
runs-on: ubuntu-latest
125+
strategy:
126+
matrix:
127+
lang: [go]
128+
steps:
129+
- uses: actions/checkout@v3
130+
with:
131+
fetch-depth: 0
132+
- name: Get version
133+
run: |
134+
tagref=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
135+
# Strip "v" prefix from tagref
136+
echo "VERSION=$(echo $tagref | sed -e 's/^v//')" >> $GITHUB_ENV
137+
echo "MAJOR_MINOR_VERSION=$(echo $tagref | sed -e 's/^v//' -e 's,\([0-9]*\.[0-9]*\)\.\([0-9]*\),\1,')" >> $GITHUB_ENV
138+
- name: Get owner
139+
run: |
140+
ownerrepo=${{ github.repository }}
141+
owner=$(echo $ownerrepo | cut -f1 -d/)
142+
if [[ "$owner" == "iter8-tools" ]]; then
143+
owner=iter8
144+
fi
145+
echo "OWNER=$owner" >> $GITHUB_ENV
146+
- uses: docker/setup-buildx-action@v2
147+
- uses: docker/login-action@v2
148+
with:
149+
username: ${{ secrets.DOCKERHUB_USERNAME }}
150+
password: ${{ secrets.DOCKERHUB_SECRET }}
151+
- uses: docker/build-push-action@v4
152+
with:
153+
platforms: linux/amd64,linux/arm64
154+
tags: ${{ env.OWNER }}/abn-sample-kserve-http-frontend-${{ matrix.lang }}:${{ env.VERSION }},${{ env.OWNER }}/abn-sample-kserve-http-frontend-${{ matrix.lang }}:${{ env.MAJOR_MINOR_VERSION }},${{ env.OWNER }}/abn-sample-kserve-http-frontend-${{ matrix.lang }}:latest
155+
file: samples/abn-sample/kserve-http-frontend/${{ matrix.lang }}/Dockerfile
156+
context: samples/abn-sample/kserve-http-frontend/${{ matrix.lang }}
157+
push: true
158+
159+
# A/B/n sample frontend for KServe w/ gRPC
160+
# In this case, the backends are models deployed as InferenceServices
161+
# This frontend is implemented omly in go
162+
build-and-push-kserve-grpc-frontend:
163+
runs-on: ubuntu-latest
164+
strategy:
165+
matrix:
166+
lang: [go]
167+
steps:
168+
- uses: actions/checkout@v3
169+
with:
170+
fetch-depth: 0
171+
- name: Get version
172+
run: |
173+
tagref=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
174+
# Strip "v" prefix from tagref
175+
echo "VERSION=$(echo $tagref | sed -e 's/^v//')" >> $GITHUB_ENV
176+
echo "MAJOR_MINOR_VERSION=$(echo $tagref | sed -e 's/^v//' -e 's,\([0-9]*\.[0-9]*\)\.\([0-9]*\),\1,')" >> $GITHUB_ENV
177+
- name: Get owner
178+
run: |
179+
ownerrepo=${{ github.repository }}
180+
owner=$(echo $ownerrepo | cut -f1 -d/)
181+
if [[ "$owner" == "iter8-tools" ]]; then
182+
owner=iter8
183+
fi
184+
echo "OWNER=$owner" >> $GITHUB_ENV
185+
- uses: docker/setup-buildx-action@v2
186+
- uses: docker/login-action@v2
187+
with:
188+
username: ${{ secrets.DOCKERHUB_USERNAME }}
189+
password: ${{ secrets.DOCKERHUB_SECRET }}
190+
- uses: docker/build-push-action@v4
191+
with:
192+
platforms: linux/amd64,linux/arm64
193+
tags: ${{ env.OWNER }}/abn-sample-kserve-grpc-frontend-${{ matrix.lang }}:${{ env.VERSION }},${{ env.OWNER }}/abn-sample-kserve-grpc-frontend-${{ matrix.lang }}:${{ env.MAJOR_MINOR_VERSION }},${{ env.OWNER }}/abn-sample-kserve-grpc-frontend-${{ matrix.lang }}:latest
194+
file: samples/abn-sample/kserve-grpc-frontend/${{ matrix.lang }}/Dockerfile
195+
context: samples/abn-sample/kserve-grpc-frontend/${{ matrix.lang }}
196+
push: true
197+

go.work

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
go 1.21.0
2+
3+
use ./samples/abn-sample/frontend/go
4+
use ./samples/abn-sample/mm-frontend/go
5+
use ./samples/abn-sample/kserve-http-frontend/go
6+
use ./samples/abn-sample/kserve-grpc-frontend/go

samples/abn-sample/frontend/go/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Get Iter8
2-
FROM golang:1.19-buster as builder
2+
FROM golang:1.21-bookworm as builder
33

44
# # Install protoc
55
# RUN apt update && apt install -y protobuf-compiler
@@ -9,7 +9,7 @@ FROM golang:1.19-buster as builder
99

1010
# Get source
1111
WORKDIR /
12-
COPY samples/abn-sample/frontend/go .
12+
COPY . ./
1313
# COPY samples/abn-sample/frontend/abn.proto .
1414

1515
# # generate gRPC libraries from abn.proto
@@ -24,7 +24,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o fe main.go
2424
### New image below
2525

2626
# Small Linux image with Iter8 binary
27-
FROM debian:buster-slim
27+
FROM debian:bookworm-slim
2828
WORKDIR /
2929
COPY --from=builder /fe /frontend
3030

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
module github.com/kalantar/ab-example/frontend/go
22

3-
go 1.17
3+
go 1.21
44

55
require (
6-
github.com/iter8-tools/iter8 v0.16.0
7-
github.com/sirupsen/logrus v1.9.0
8-
google.golang.org/grpc v1.56.2
6+
github.com/iter8-tools/iter8 v0.17.1
7+
github.com/sirupsen/logrus v1.9.3
8+
google.golang.org/grpc v1.58.0
99
)
1010

1111
require (
1212
github.com/golang/protobuf v1.5.3 // indirect
1313
golang.org/x/net v0.12.0 // indirect
1414
golang.org/x/sys v0.10.0 // indirect
1515
golang.org/x/text v0.11.0 // indirect
16-
google.golang.org/genproto/googleapis/rpc v0.0.0-20230629202037-9506855d4529 // indirect
16+
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect
1717
google.golang.org/protobuf v1.31.0 // indirect
1818
)

0 commit comments

Comments
 (0)