Skip to content

Upgrade Golang Dependencies #349

Upgrade Golang Dependencies

Upgrade Golang Dependencies #349

# MIT License
#
# Copyright (c) 2021 Michal Baczun and EASE lab
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
name: Chained Serving End-to-End Tests
on:
workflow_dispatch:
schedule:
- cron: '0 9 * * 1'
push:
branches: [ main ]
paths:
- 'benchmarks/chained-function-serving/*'
- 'utils/*'
pull_request:
branches: [ main ]
paths:
- 'benchmarks/chained-function-serving/*'
- 'utils/*'
env:
GOOS: linux
GO111MODULE: on
PLATFORMS: linux/amd64,linux/arm64
jobs:
build-and-push:
name: Build and Push all images
runs-on: ubuntu-20.04
strategy:
fail-fast: false
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
lfs: 'true'
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Build and Push
working-directory: benchmarks/chained-function-serving
env:
GOPRIVATE_KEY: ${{ secrets.XDT_REPO_ACCESS_KEY }}
run: make all-image-push
test-compose:
name: Test Docker Compose
needs: build-and-push
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
file: [docker-compose.yml, fanin-basic.yml, fanout-basic.yml, docker-compose-elasticache.yml]
include:
- file: docker-compose.yml
port: 3031
- file: fanin-basic.yml
port: 3032
- file: fanout-basic.yml
port: 3032
- file: docker-compose-elasticache.yml
port: 3031
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
lfs: 'true'
- name: start docker-compose benchmark
env:
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }}
working-directory: benchmarks/chained-function-serving/yamls/docker-compose
run: |
docker-compose -f ${{ matrix.file }} up &> log_file &
sleep 60s
- name: invoke the chain
run: |
./tools/bin/grpcurl -plaintext localhost:${{ matrix.port }} helloworld.Greeter.SayHello
- name: show docker-compose log
run: cat benchmarks/chained-function-serving/yamls/docker-compose/log_file
test-knative:
name: Test Knative Deployment
needs: build-and-push
env:
KIND_VERSION: v0.14.0
K8S_VERSION: v1.23
YAML_DIR: benchmarks/chained-function-serving/yamls/knative/
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
folder: [inline, fanin-basic, fanout-basic, elasticache]
steps:
- uses: actions/checkout@v4
with:
lfs: 'true'
- name: Checkout LFS objects
run: git lfs checkout
- uses: actions/setup-go@v5
with:
go-version: '1.21'
## Setup a Knative cluster to test the service
- name: Create k8s Kind Cluster
run: bash ./runner/scripts/01-kind.sh
- name: Install Serving
run: bash ./runner/scripts/02-serving.sh
- name: Install Kourier
run: bash ./runner/scripts/02-kourier.sh
- name: Setup domain
run: |
INGRESS_HOST="127.0.0.1"
KNATIVE_DOMAIN=$INGRESS_HOST.sslip.io
kubectl patch configmap -n knative-serving config-domain -p "{\"data\": {\"$KNATIVE_DOMAIN\": \"\"}}"
- name: Setup kn
env:
KN_VERSION: v1.8.1
KN_INSTALL_PATH: /usr/local/bin/kn
run: |-
echo "Downloading kn $KN_VERSION"
sudo wget --quiet -O $KN_INSTALL_PATH "https://github.com/knative/client/releases/download/knative-$KN_VERSION/kn-linux-amd64"
sudo chmod +x $KN_INSTALL_PATH
echo "Installed kn $KN_VERSION"
- name: Configure redis pod
if: matrix.folder == 'elasticache'
run: |
cat <<EOF >./redis-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis
labels:
app: redis
spec:
selector:
matchLabels:
app: redis
template:
metadata:
labels:
app: redis
spec:
containers:
- name: redis
image: redis:5.0.4
command:
- redis-server
env:
- name: MASTER
value: "true"
ports:
- containerPort: 6379
EOF
kubectl apply -f redis-deployment.yaml
- name: Configure redis service
if: matrix.folder == 'elasticache'
run: |
kubectl expose deployment redis --type=ClusterIP --name=redis-service
kubectl get svc redis-service
- name: Up for elasticache
if: matrix.folder == 'elasticache'
working-directory: benchmarks
run: |
export BUCKET_NAME="$(kubectl get svc redis-service -ojsonpath='{.spec.clusterIP}'):6379"
echo $BUCKET_NAME
../tools/kn_deploy.sh ./chained-function-serving/yamls/knative/${{ matrix.folder }}/*
- name: Up
working-directory: benchmarks
run: ../tools/kn_deploy.sh ./chained-function-serving/yamls/knative/${{ matrix.folder }}/*
- name: Test
working-directory: tools/test-client
run: |
set -x
NODEPORT=80
HOSTNAME=$(kubectl get ksvc driver -n default -o jsonpath='{.status.url}' | cut -c8-)
go build ./test-client.go
./test-client -addr $HOSTNAME:$NODEPORT
- name: Print logs
if: ${{ always() }}
run: |
set -x
kubectl logs -n default -c user-container -l serving.knative.dev/service=producer
kubectl logs -n default -c user-container -l serving.knative.dev/service=consumer
kubectl logs -n default -c user-container -l serving.knative.dev/service=driver
- name: Down
if: ${{ always() }}
run: kn service delete --all --namespace default --wait