This document helps you get started using the Volcano code base. If you follow this guide and find a problem, please take a few minutes to update this file.
- Building the code
- Building docker images
- Building a specific docker image
- Building the Volcano manifests
- Cleaning outputs
- Running tests
- Auto-formatting source code
- Running the verification
- Adding dependencies
- About testing
You will need to clone the main volcano repo to $GOPATH/src/volcano.sh/volcano for the below commands to work correctly.
To build all Volcano components for your host architecture, go to the source root and run:
make image_binsThe binaries will be generated at .../src/volcano.sh/volcano/_output/bin/linux/amd64/.
If we just run make as below:
makeThen the binaries would be generated at .../src/volcano.sh/volcano/_output/bin/.
To build a specific component for your host architecture, go to the source root and run make <component name>:
make vc-schedulerBuild the containers in your local Docker cache:
make imagesTo build cross-platform images:
make images DOCKER_PLATFORMS="linux/amd64,linux/arm64" BUILDX_OUTPUT_TYPE=registry IMAGE_PREFIX=[yourregistry]If you want to make a local change and test some component, say vc-controller-manager, you could do:
Under volcano.sh/volcano repo:
pwdThe path should be:
.../src/volcano.sh/volcanoSet up environment variables HUB and TAG:
export HUB=docker.io/yourrepo
export TAG=citadelMake some local change to the code, then build vc-controller-manager:
make vc-controller-managerUse the following command to build the deploy YAML files:
make generate-yamlYou can delete any build artifacts with:
make cleanYou can run all the available unit tests with:
make unit-testYou can run all the available e2e tests with:
make vcctl
make images
make e2eIf you want to run e2e tests in an existing cluster with Volcano deployed, run the following:
export VC_BIN=<path-to-vcctl-binary> (e.g., .../src/volcano.sh/volcano/_output/bin/)
KUBECONFIG=${KUBECONFIG} go test ./test/e2eYou can automatically format the source code to follow our conventions by going to the top of the repo and entering:
./hack/update-gofmt.shYou can run all the verification we require on your local repo by going to the top of the repo and entering:
make verifyVolcano uses Go Modules to manage its dependencies. If you want to add or update a dependency, run:
go get dependency-name@version
go mod tidy
go mod vendorNote: Go's module system, introduced in Go 1.11, provides an official dependency management solution built into the go command. Make sure GO111MODULE env is not off before using it.
Before sending pull requests, you should at least make sure your changes have passed both unit tests and verification. We only merge pull requests when all tests are passing.
- Unit tests should be fully hermetic
- Only access resources in the test binary.
- All packages and any significant files require unit tests.
- Unit tests are written using the standard Go testing package.
- The preferred method of testing multiple scenarios or input is table-driven testing.
- Concurrent unit test runs must pass.