* upgrade K8s dependency to v0.21 * update CRD for new version of controller-runtime * fix ci component revision create must fill Raw in runtime.RawExtension * try fix test * start control plane timeout set to 1min and fix tests * add timeout for env test start and stop * longer timeout time for BeforeSuit function * upgrade kubebuilder and k8s cluster version to match with v1.21.2 in github action * fix test * fix resource tracker ownerRef override * update developer guides
3.7 KiB
Developer guide
This guide helps you get started developing KubeVela.
Prerequisites
- Golang version 1.16+
- Kubernetes version v1.18+ with
~/.kube/configconfigured. - ginkgo 1.14.0+ (just for E2E test)
- golangci-lint 1.38.0+, it will install automatically if you run
make, you can install it manually if the installation is too slow. - kubebuilder v3.1.0+ and you need to manually install the dependency tools for unit test.
Install Kubebuilder manually
linux:
wget https://storage.googleapis.com/kubebuilder-tools/kubebuilder-tools-1.21.2-linux-amd64.tar.gz
tar -zxvf kubebuilder-tools-1.21.2-linux-amd64.tar.gz
mkdir -p /usr/local/kubebuilder/bin
sudo mv kubebuilder/bin/* /usr/local/kubebuilder/bin
macOS:
wget https://storage.googleapis.com/kubebuilder-tools/kubebuilder-tools-1.21.2-darwin-amd64.tar.gz
tar -zxvf kubebuilder-tools-1.21.2-darwin-amd64.tar.gz
mkdir -p /usr/local/kubebuilder/bin
sudo mv kubebuilder/bin/* /usr/local/kubebuilder/bin
For other OS or system architecture, please refer to https://storage.googleapis.com/kubebuilder-tools/
You may also be interested with KubeVela's design before diving into its code.
Build
- Clone this project
git clone git@github.com:oam-dev/kubevela.git
KubeVela includes two parts, vela core and vela cli.
- The
vela coreis actually a K8s controller, it will watch OAM Spec CRD and deploy resources. - The
vela cliis a command line tool that can build, run apps(with the help ofvela core).
For local development, we probably need to build both of them.
- Build Vela CLI
make
After the vela cli built successfully, make command will create vela binary to bin/ under the project.
- Configure
velabinary to System PATH
export PATH=$PATH:/your/path/to/project/kubevela/bin
Then you can use vela command directly.
- Build Vela Core
make manager
- Run Vela Core
Firstly make sure your cluster has CRDs, below is the command that can help install all CRDs.
make core-install
To ensure you have created vela-system namespace and install definitions of necessary module. you can run the command:
make check-install-def
And then run locally:
make core-run
This command will run controller locally, it will use your local KubeConfig which means you need to have a k8s cluster locally. If you don't have a one, we suggest that you could setup up a cluster with kind.
When you're developing vela-core, make sure the controller installed by helm chart is not running.
Otherwise, it will conflict with your local running controller.
You can check and uninstall it by using helm.
helm list -A
helm uninstall -n vela-system kubevela
Use
You can try use your local built binaries follow the documentation.
Testing
Unit test
make test
E2E test
Before e2e test start, make sure you have vela-core running.
make core-run
Start to test.
make e2e-test
Contribute Docs
Please read the documentation before contributing to the docs.
- Build docs
make docs-build
- Local development and preview
make docs-start
Next steps
- Read our code conventions
- Learn how to Create a pull request