I'm glad you can see this document and I'm looking forward to your contributions to the yatai-image-builder.
yatai-image-builder is a product based on a cloud-native architecture. It runs in a Kubernetes cluster, it is an operator for the BentoRequest CRD, it aims to generate the Bento CR, and it also acts as a client for Yatai to request Yatai's RESTful API.
As you know, Kubernetes has a complex network environment, so developing cloud-native products locally can be a challenge. But don't worry, this document will show you how to develop yatai-image-builder locally easily, quickly and comfortably.
-
A yatai-image-builder installed in the development environment for development and debugging
NOTE: Since you are developing, you must not use the production environment, so we recommend using the quick install script to install yatai and yatai-image-builder in the local minikube
Using a development environment with pre-installed yatai-image-builder, the goal is to quickly provide a set of out-of-the-box infrastructure dependencies
You can start by reading this installation document to install yatai-image-builder. It is highly recommended to use the quick install script to install yatai-image-builder
Remember, never use infrastructure from the production environment, only use newly installed infrastructure in the cluster, such as SQL databases, blob storage, docker registry, etc. The quick install script mentioned above will prevent you from using the infrastructure in the production environment, this script will help you to install all the infrastructure from scratch, you can use it without any worries.
If you have already installed it, please verify that your kubectl context is correct with the following command:
kubectl config current-context
-
Used to parse json from the command line
-
yatai-image-builder is implemented by Go Programming Language
-
The most critical dependency in this document for bridging the local network and the Kubernetes cluster network
-
Clone the source code from your fork of yatai-image-builder's GitHub repository:
git clone git@github.com:${your github username}/yatai-image-builder.git && cd yatai-image-builder
-
Add the yatai-image-builder upstream remote to your local yatai-image-builder clone:
git remote add upstream git@github.com:bentoml/yatai-image-builder.git
-
Installing Go dependencies
go mod download
git checkout main
-
Use the git pull command to retrieve content from the BentoML Github repository.
git pull upstream main -r
-
Create a new branch and switch to it.
git checkout -b your-new-branch-name
-
Make your changes!
-
Use the git add command to save the state of files you have changed.
git add <names of the files you have changed>
-
Commit your changes.
git commit -m 'your commit message'
-
Synchronize upstream changes
git pull upstream main -r
-
Push all changes to your forked repo on GitHub.
git push origin your-new-branch-name
-
Run yatai-image-builder
WARNING: The following command uses the infrastructure of the Kubernetes environment in the current kubectl context and replaces the behavior of yatai-image-builder in the current Kubernetes environment, so please proceed with caution
NOTE: The following command will automatically run
telepresence connect
to connet to the k8s networkmake start-dev
If you get something wrong, you should check the Troubleshooting
-
✨ Enjoy it!
You can test the telepresence connection with the following command:
curl http://yatai.yatai-system.svc.cluster.local/api/v1/info
The above command will return:
{"is_saas":false,"saas_domain_suffix":""}
If you can't communicate with the yatai service in the k8s cluster using the above command, you should kill all processes of telepresence:
ps aux | grep telepresence | grep -v grep | awk '{print $2}' | xargs -i sudo kill {}
Then run yatai-image-builder again:
make start-dev