Skip to content

Commit

Permalink
feat: add bentoml yatai stack contrib
Browse files Browse the repository at this point in the history
  • Loading branch information
yetone committed Jan 17, 2023
1 parent d82081f commit 23b7971
Show file tree
Hide file tree
Showing 14 changed files with 13,196 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/bentoml_kind_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build & Apply BentoML Yatai Stack manifests in KinD
on:
pull_request:
paths:
- contrib/bentoml/**

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install KinD
run: ./tests/gh-actions/install_kind.sh

- name: Create KinD Cluster
run: kind create cluster --config tests/gh-actions/kind-cluster-1-24.yaml

- name: Install kustomize
run: ./tests/gh-actions/install_kustomize.sh

- name: Install cert-manager
run: ./tests/gh-actions/install_cert_manager.sh

- name: Build & Apply manifests
run: |
cd contrib/bentoml/
make test
35 changes: 35 additions & 0 deletions contrib/bentoml/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
BENTOML_YATAI_IMAGE_BUILDER_VERSION ?= 1.1.3
BENTOML_YATAI_DEPLOYMENT_VERSION ?= 1.1.4
BENTOML_HELM_CHART_REPO ?= https://bentoml.github.io/helm-charts

.PHONY: bentoml-yatai-stack/bases
bentoml-yatai-stack/bases: clean-kustomize
mkdir -p bentoml-yatai-stack/bases/yatai-image-builder
cd bentoml-yatai-stack/bases/yatai-image-builder && helm template --skip-tests yatai-image-builder-crds yatai-image-builder-crds --repo ${BENTOML_HELM_CHART_REPO} --namespace kubeflow --version ${BENTOML_YATAI_IMAGE_BUILDER_VERSION} > resources.yaml
cd bentoml-yatai-stack/bases/yatai-image-builder && helm template --skip-tests -f ../../../sources/yatai-image-builder-values.yaml yatai-image-builder yatai-image-builder --repo ${BENTOML_HELM_CHART_REPO} --namespace kubeflow --version ${BENTOML_YATAI_IMAGE_BUILDER_VERSION} >> resources.yaml
cp sources/kustomization-template.yaml bentoml-yatai-stack/bases/yatai-image-builder/kustomization.yaml
mkdir -p bentoml-yatai-stack/bases/yatai-deployment
cd bentoml-yatai-stack/bases/yatai-deployment && helm template --skip-tests yatai-deployment-crds yatai-deployment-crds --repo ${BENTOML_HELM_CHART_REPO} --namespace kubeflow --version ${BENTOML_YATAI_DEPLOYMENT_VERSION} > resources.yaml
cd bentoml-yatai-stack/bases/yatai-deployment && helm template --skip-tests -f ../../../sources/yatai-deployment-values.yaml yatai-deployment yatai-deployment --repo ${BENTOML_HELM_CHART_REPO} --namespace kubeflow --version ${BENTOML_YATAI_DEPLOYMENT_VERSION} >> resources.yaml
cp sources/kustomization-template.yaml bentoml-yatai-stack/bases/yatai-deployment/kustomization.yaml

.PHONY: clean-kustomize
clean-kustomize:
rm -rf bentoml-yatai-stack/bases

.PHONY: test
test:
kubectl create ns kubeflow || echo "namespace kubeflow already exists"
kustomize build bentoml-yatai-stack/default | kubectl apply --server-side -f -
kubectl -n kubeflow wait --for=condition=available --timeout=600s deploy/yatai-image-builder
kubectl -n kubeflow wait --for=condition=available --timeout=600s deploy/yatai-deployment
sleep 5
kubectl apply -n kubeflow -f example.yaml
sleep 5
kubectl -n kubeflow logs deploy/yatai-deployment
sleep 5
kubectl -n kubeflow wait --for=condition=available --timeout=600s deploy/test-yatai
kubectl -n kubeflow wait --for=condition=available --timeout=600s deploy/test-yatai-runner-0
kubectl delete -n kubeflow -f example.yaml
kustomize build bentoml-yatai-stack/default | kubectl delete -f -

3 changes: 3 additions & 0 deletions contrib/bentoml/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
approvers:
- yetone
- yubozhao
19 changes: 19 additions & 0 deletions contrib/bentoml/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# BentoML Yatai Stack

[BentoML Yatai Stack](https://github.com/bentoml/yatai-deployment) is a series of components for deploying models/bentos to Kubernetes at scale

## Requirements

* Kubernetes 1.20 - 1.24

## Installation

* The yaml assumes you will install in kubeflow namespace

```bash
kustomize build bentoml-yatai-stack/default | kubectl apply -n kubeflow --server-side -f -
```

## Upgrating

See [UPGRADE.md](UPGRADE.md)
35 changes: 35 additions & 0 deletions contrib/bentoml/UPGRADE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Upgrading Documentation

## Updating manifests

In order to update manifests make sure you are running the commands in linux.

If you are running in another OS, please make sure to update the Makefile commands.

You can refresh the configuration by running:

```
make bentoml-yatai-stack/base
```

## Updating to specific version

Upgrading the version can be done by setting the `BENTOML_YATAI_STACK_VERSION` environment variable, such as:

```
# Set the desired version
export BENTOML_YATAI_IMAGE_BUILDER_VERSION=1.1.0
export BENTOML_YATAI_DEPLOYMENT_VERSION=1.1.0
# Rebuild the kustomize bases
make bentoml-yatai-stack/bases
# Run new manifests against cluster
kustomize build bentoml-yatai-stack/default | kubectl apply -f -
```

## Instructions for breaking changes

The [Yatai upgrading docs](https://docs.bentoml.org/projects/yatai) provide step by step overview of breaking changes across minor and patch versions.


Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
resources:
- resources.yaml
Loading

0 comments on commit 23b7971

Please sign in to comment.