Skip to content

Commit

Permalink
invoker support, updates ports, workflows, docker
Browse files Browse the repository at this point in the history
Client returns a fatal error if communication with the producer fails
Producer now has lite-producer functionality if the flag is used
Lite producer is removed.
changes producer to work with examples invoker
Updates dockerfile to use target arg
Changes defualt ports
general cleanup
Removes environment variables
adds serving images to CI/CD
updates dependabot
updates workflows to use grpcurl
removes logs

Signed-off-by: Michal Baczun <s1743497@ed.ac.uk>
  • Loading branch information
Michal M committed Jun 11, 2021
1 parent c460fbf commit abfd0b5
Show file tree
Hide file tree
Showing 17 changed files with 156 additions and 419 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@ updates:
directory: "/"
schedule:
interval: "weekly"

updates:
- package-ecosystem: “gomod”
directory: “/function-images/tests/chained-function-serving”
schedule:
interval: “weekly”
16 changes: 1 addition & 15 deletions .github/workflows/build_docker_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,4 @@ jobs:
git lfs pull
- name: docker build images
run: |
DOCKER_BUILDKIT=1 docker build --file ./scripts/github_runner/Dockerfile.${{ matrix.image }} .
compose_images:
name: Build docker-compose function images
runs-on: ubuntu-18.04
strategy:
fail-fast: false
matrix:
image: [tests/producer-consumer]
steps:
- uses: actions/checkout@v2
- name: docker-compose build images
run: |
cd ./function-images/${{ matrix.image }}
docker-compose up -d
DOCKER_BUILDKIT=1 docker build --file ./scripts/github_runner/Dockerfile.${{ matrix.image }} .
Original file line number Diff line number Diff line change
@@ -1,41 +1,42 @@
name: Test the entire build and invokation chain of test examples.
name: Function composition tests

on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]

env:
GOOS: linux
GO111MODULE: on

jobs:
compose_images:
name: Build and run chained functions serving
docker-compose:
name: Serving uBench (docker-compose)
runs-on: ubuntu-18.04
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: go mod tidy

- name: Setup grpcurl
run: |
cd ./function-images/tests/chained-function-serving/
go mod tidy
wget -qO- https://github.com/fullstorydev/grpcurl/releases/download/v1.8.1/grpcurl_1.8.1_linux_x86_64.tar.gz | sudo tar -C /usr/bin/ -xz grpcurl
- name: start multi-container program with docker-compose
run: |
cd ./function-images/tests/chained-function-serving/
docker-compose up -d
docker-compose up &> log_file &
sleep 15s
- name: invoke the client
- name: invoke the chain
run: |
cd ./function-images/tests/chained-function-serving/
go run ./client/client.go
grpcurl -plaintext localhost:3031 helloworld.Greeter.SayHello
- name: show docker-compose log
run: cat ./function-images/tests/chained-function-serving/log_file

knative_chain:
name: Start up and run the knative chain
knative:
name: Serving uBench (knative)
env:
GITHUB_RUN_ID: ${{ github.run_id }}
LOGPATH: /tmp/uBench-logs/${{ github.run_id }}
Expand All @@ -46,7 +47,7 @@ jobs:
fail-fast: false
steps:

- name: Set up Go 1.15
- name: Set up Golang
uses: actions/setup-go@v2
with:
go-version: 1.15
Expand All @@ -63,36 +64,30 @@ jobs:
- uses: actions/checkout@v2

- name: start containerd
- name: Start containerd
run: sudo containerd 1>$LOGPATH/uBench.out 2>$LOGPATH/uBench.err &

- name: start one node cluster
- name: Start one-node cluster
run : |
./scripts/cluster/create_one_node_cluster.sh stock-only && sleep 2m
- name: check pods
run : KUBECONFIG=/etc/kubernetes/admin.conf kubectl get pods -A

- name: start consumer
- name: Start consumer
run: KUBECONFIG=/etc/kubernetes/admin.conf kn service apply -f ./function-images/tests/chained-function-serving/service-consumer.yaml && sleep 30s

- name: start producer
- name: Start producer
run: KUBECONFIG=/etc/kubernetes/admin.conf kn service apply -f ./function-images/tests/chained-function-serving/service-producer.yaml && sleep 30s

- name: show services
run: KUBECONFIG=/etc/kubernetes/admin.conf kn service list

- name: run client
- name: Run invoker client
run: |
cd ./function-images/tests/chained-function-serving/client
echo "producer.default.192.168.1.240.sslip.io" > urls.txt
cd ./examples/invoker
go build client.go
cd ..
./client/client --addr producer.default.192.168.1.240.nip.io --pc 80 -s 3
cd ../..
./examples/invoker/client
- name: Archive log artifacts
uses: actions/upload-artifact@v2
with:
name: test_file
name: logs
path: /tmp/uBench-logs/${{ github.run_id }}

- name: Cleaning
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/image_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,27 @@ jobs:
${{ secrets.DOCKER_HUB_USERNAME }}/${{ env.VHIVE_GOLANG_VERSION }}
chained_serving:
name: Deploy chained serving images
runs-on: ubuntu-18.04
strategy:
fail-fast: false
steps:

- uses: actions/checkout@v2

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Build and push
run: |
cd ./function-images/tests/chained-function-serving
make all-image
make all-image-push
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Added [script](./scripts/cloudlab/start_onenode_vhive_cluster.sh) to (re)start vHive single node cluster in a push-button.
- CRI test logs are now stored as GitHub artifacts.
- Added Knative Eventing Tutorial: [documentation](./docs/knative/eventing.md) and [example](./examples/knative-eventing-tutorial).
- Added a chained functions microbenchmark that uses Knative Serving.

### Changed

Expand Down
1 change: 1 addition & 0 deletions configs/.wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ Micheli
Microarchitecting
microarchitectural
Microarchitecture
microbenchmark
microVMs
minio
MinIO
Expand Down
55 changes: 14 additions & 41 deletions function-images/tests/chained-function-serving/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,50 +20,23 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

FROM amd64/golang:1.16.4-alpine3.13 as consumerBuilder
FROM vhiveease/golang:latest as builder

WORKDIR /app
COPY go.mod /app/go.mod
COPY consumer/ /app/consumer/
COPY proto/ /app/proto/
RUN go mod download && \
CGO_ENABLED=0 GOOS=linux go build -v -o /main /app/consumer/consumer.go
RUN apk add --no-cache make
# We use ARG and ENV to have a single Dockerfile for the all three programs.
# https://vsupalov.com/docker-build-pass-environment-variables/
ARG target_arg
ENV target=$target_arg
COPY . ./
RUN mkdir /log

FROM amd64/golang:1.16.4-alpine3.13 as consumer
WORKDIR /
COPY --from=consumerBuilder /main /main
COPY --from=consumerBuilder /log/ /log/
ENTRYPOINT [ "/main" ]

FROM amd64/golang:1.16.4-alpine3.13 as producerBuilder

WORKDIR /app
COPY go.mod /app/go.mod
COPY producer/ /app/producer/
COPY proto/ /app/proto/
RUN go mod download && \
CGO_ENABLED=0 GOOS=linux go build -v -o /main /app/producer/producer.go
RUN mkdir /log

FROM amd64/golang:1.16.4-alpine3.13 as producer
WORKDIR /
COPY --from=producerBuilder /main /main
COPY --from=producerBuilder /log/ /log/
ENTRYPOINT [ "/main" ]

FROM amd64/golang:1.16.4-alpine3.13 as lite-producerBuilder
CGO_ENABLED=0 GOOS=linux go build -v -o ./${target}-bin ./${target}/

FROM scratch
WORKDIR /app
COPY go.mod /app/go.mod
COPY lite-producer/ /app/lite-producer/
COPY proto/ /app/proto/
RUN go mod download && \
CGO_ENABLED=0 GOOS=linux go build -v -o /main /app/lite-producer/lite-producer.go
RUN mkdir /log

FROM amd64/golang:1.16.4-alpine3.13 as lite-producer
WORKDIR /
COPY --from=lite-producerBuilder /main /main
COPY --from=lite-producerBuilder /log/ /log/
ENTRYPOINT [ "/main" ]
ARG target_arg
ENV target=$target_arg
COPY --from=builder /log/ /app/log/
COPY --from=builder /app/${target}-bin /app/exe
ENTRYPOINT [ "/app/exe" ]
Original file line number Diff line number Diff line change
Expand Up @@ -20,40 +20,34 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: consumer
namespace: default
spec:
template:
spec:
containers:
- image: docker.io/vhiveease/chained-functions-serving-consumer:latest
imagePullPolicy: Always
ports:
# For `h2c`, see https://knative.tips/networking/http2/
- name: h2c
containerPort: 80


apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: producer
namespace: default
spec:
template:
spec:
containers:
- image: docker.io/vhiveease/chained-functions-serving-producer:latest
imagePullPolicy: Always
ports:
# For `h2c`, see https://knative.tips/networking/http2/
- name: h2c
containerPort: 80
env:
- name: ADDR
value: "localhost"
- name: PORT_CLIENT
value: "80"
all: all-image

all-image: producer-image consumer-image

all-image-push: producer-image-push consumer-image-push

clean:
rm -f ./producer-bin ./consumer-bin


producer-image: Dockerfile producer/producer.go proto/prodcon.pb.go proto/prodcon_grpc.pb.go
docker build --tag vhiveease/chained-functions-serving-producer:latest --build-arg target_arg=producer .

producer-image-push: producer-image
docker push vhiveease/chained-functions-serving-producer:latest


consumer-image: Dockerfile consumer/consumer.go proto/prodcon.pb.go proto/prodcon_grpc.pb.go
docker build --tag vhiveease/chained-functions-serving-consumer:latest --build-arg target_arg=consumer .

consumer-image-push: consumer-image
docker push vhiveease/chained-functions-serving-consumer:latest


cmd/server/tempReader_grpc.pb.go cmd/server/tempReader.pb.go: cmd/server/tempReader.proto
protoc \
--go_out=. \
--go_opt="paths=source_relative" \
--go-grpc_out=. \
--go-grpc_opt="paths=source_relative" \
cmd/server/tempReader.proto
56 changes: 0 additions & 56 deletions function-images/tests/chained-function-serving/client/client.go

This file was deleted.

Loading

0 comments on commit abfd0b5

Please sign in to comment.