Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] improve the development.md document #4018

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 41 additions & 49 deletions docs/development/development.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
This document helps you get started using the Volcano code base.
If you follow this guide and find some problem, please take
a few minutes to update this file.
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-the-code)
- [Building docker images](#building-docker-images)
Expand All @@ -13,39 +11,37 @@ a few minutes to update this file.
- [Adding dependencies](#adding-dependencies)
- [About testing](#about-testing)

## Cloning the Code

## Cloning the code
You will need to clone the main `volcano` repo to `$GOPATH/src/volcano.sh/volcano` for the below commands to work correctly.

You will need to clone the main `volcano` repo to `$GOPATH/src/volcano.sh/volcano` for
the below commands to work correctly.
## Building the Code

## Building the code

To build volcano all components for your host architecture, go to
the source root and run:
To build all Volcano components for your host architecture, go to the source root and run:

```bash
make image_bins
```
the binaries will be generated at .../src/volcano.sh/volcano/_output/bin/linux/amd64/
but if we just make as below

The binaries will be generated at `.../src/volcano.sh/volcano/_output/bin/linux/amd64/`.

If we just run `make` as below:

```bash
make
```
then 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>`:
Then 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>`:

```bash
make vc-scheduler
```

## Building Docker Images

## Building docker images

Build the containers in your local docker cache:
Build the containers in your local Docker cache:

```bash
make images
Expand All @@ -57,62 +53,62 @@ To build cross-platform images:
make images DOCKER_PLATFORMS="linux/amd64,linux/arm64" BUILDX_OUTPUT_TYPE=registry IMAGE_PREFIX=[yourregistry]
```

## Building a Specific Component

## Building a specific component
If you want to make a local change and test some component, say `vc-controller-manager`, you could do:

If you want to make a local change and test some component, say `vc-controller-manager`, you
could do:

Under volcano.sh/volcano repo
Under `volcano.sh/volcano` repo:

```bash
pwd
```
The path should be

The path should be:

```bash
.../src/volcano.sh/volcano
```

Set up environment variables HUB and TAG by
Set up environment variables HUB and TAG:

```bash
export HUB=docker.io/yourrepo
export TAG=citadel
```

Make some local change of the code, then build `vc-controller-manager`
Make some local change to the code, then build `vc-controller-manager`:

```bash
make vc-controller-manager
```

## Building the Volcano manifests
## Building the Volcano Manifests

Use the following command to build the deploy yaml files:
Use the following command to build the deploy YAML files:

```bash
make generate-yaml
```

## Cleaning outputs
## Cleaning Outputs

You can delete any build artifacts with:

```bash
make clean
```

## Running tests
## Running Tests

### Running unit tests
### Running Unit Tests

You can run all the available unit tests with:

```bash
make unit-test
```

### Running e2e tests
### Running E2E Tests

You can run all the available e2e tests with:

Expand All @@ -122,54 +118,50 @@ make images
make e2e
```

If you want to run e2e test in a existing cluster with volcano deployed, run the following:
If you want to run e2e tests in an existing cluster with Volcano deployed, run the following:

```bash
export VC_BIN= need to set vcctl binary path (eg:.../src/volcano.sh/volcano/_output/bin/)
export VC_BIN=<path-to-vcctl-binary> (e.g., .../src/volcano.sh/volcano/_output/bin/)
KUBECONFIG=${KUBECONFIG} go test ./test/e2e
```

## Auto-formatting source code
## Auto-Formatting Source Code

You can automatically format the source code to follow our conventions by going to the
top of the repo and entering:
You can automatically format the source code to follow our conventions by going to the top of the repo and entering:

```bash
./hack/update-gofmt.sh
```

## Running the verification
## Running the Verification

You can run all the verification we require on your local repo by going to the top of the repo and entering:

```bash
make verify
```

## Adding dependencies
## Adding Dependencies

Volcano uses [Go Modules](https://blog.golang.org/migrating-to-go-modules) to manage its dependencies.
If you want to add or update a dependency, running:
Volcano uses [Go Modules](https://blog.golang.org/migrating-to-go-modules) to manage its dependencies. If you want to add or update a dependency, run:

```bash
go get dependency-name@version
go mod tidy
go mod vendor
```

Note: 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.
Note: 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.

## About testing
## About Testing

Before sending pull requests you should at least make sure your changes have
passed both unit and the verification. We only merge pull requests when
**all** tests are passing.
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](https://github.com/golang/go/wiki/TableDrivenTests)
- The preferred method of testing multiple scenarios or input is [table-driven testing](https://github.com/golang/go/wiki/TableDrivenTests).
- Concurrent unit test runs must pass.


Loading