Contributing to OpenKruise Agents
Developing Environmentâ
As a contributor, if you want to make any contribution to OpenKruise Agents, we should reach an agreement on the version of tools used in the development environment. Here are some dependencies with specific versions:
For agent-sandbox-controller:
- Golang : v1.24+
- kubernetes: v1.28+
You can use
go mod vendorto avoid the IDE crashes caused by go mod list failures.
Developing guideâ
Generate code and manifestsâ
If the APIs are modified, you have to run the following commands to generate code and manifests.
# Generate code and manifests e.g. CRD, RBAC YAML files etc
make generate manifests
Run testsâ
You can use the command make test to run unit tests.
For JetBrains IDE users, you can find some pre-configured configurations to run tests directly. They are stored in .run
Build imagesâ
OpenKruise Agents consists of two components:
- agent-sandbox-controller: a k8s operator for agent CRDs, including Sandbox, SandboxSet, etc.
- sandbox-manager: a server for sandbox management, compatible with E2B API.
You can use the commands below to build the images with Dockerfiles.
make docker-build-controller # build agent-sandbox-controller
make docker-build-manager # build sandbox-manager
make docker-build-runtime # build agent-runtime
Deploy to Kubernetesâ
It is recommended to deploy OpenKruise Agents to a Kubernetes cluster via kustomize for testing. Any Kubernetes cluster should be ok, but we recommend using kind to create a local cluster.
- Modify the following patch files with your own images.
- Deploy the components
make deploy-agent-sandbox-controller
make deploy-sandbox-manager
Test OpenKruise Agents via E2B clientâ
It is recommended to use the customized e2b protocol with patched client to avoid the complexity of wildcard domain resolution and certificates.
-
Create a SandboxSet with name
code-interpreteras an E2B templatekubectl apply -f examples/code_interpreter/sandboxset.yaml -
Install E2B python SDK
pip install e2b-code-interpreter -
Port forward the sandbox-manager
sudo kubectl port-forward services/sandbox-manager 80:7788 -n sandbox-system -
Create a new terminal, and set the environment variables
export E2B_DOMAIN=localhost
export E2B_API_KEY=some-api-key # configured in config/sandbox-manager/configuration_patch.yaml -
Patch the client (refer to this document)
- Copy patch_e2b.py to your python project
- Patch your E2B SDK before using it
from patch_e2b import patch_e2b
from e2b_code_interpreter import Sandbox
patch_e2b(False)
with Sandbox.create(template="code-interpreter") as sbx:
sbx.run_code("print('hello world')")
Proposalsâ
If you are going to contribute a feature with a new API or need significant effort, please submit a proposal in ./docs/proposals/ first.