未验证 提交 99bf6d62 编写于 作者: P pengfei 提交者: GitHub

refine how-to-build

上级 1d599c26
# How to build KubeSphere?
This document walks you through how to get started building KubeSphere in your local environment.
This document walks you through how to get started with building KubeSphere in your local environment.
## Preparing the environment
### Go
KubeSphere development is based on [Kubernetes](https://github.com/kubernetes/kubernetes), both of them are written in [Go](http://golang.org/). If you don't have a Go development environment, please [set one up](http://golang.org/doc/code.html).
KubeSphere development is based on [Kubernetes](https://github.com/kubernetes/kubernetes), both of them are written in [Go](http://golang.org/). If you don't have a Go development environment, please [set it up](http://golang.org/doc/code.html).
| Kubernetes | requires Go |
|----------------|-------------|
......@@ -15,30 +15,28 @@ KubeSphere development is based on [Kubernetes](https://github.com/kubernetes/ku
> Tips:
> - Ensure your GOPATH and PATH have been configured in accordance with the Go
environment instructions.
> - It's recommended to install [macOS GNU tools](https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x) for Mac OS.
> - It's recommended to install [macOS GNU tools](https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x) when using MacOS for development.
### Docker
KubeSphere components are often deployed as containers in Kubernetes. If you need to rebuild the KubeSphere components in the Kubernetes cluster, you will need to [install Docker](https://docs.docker.com/install/).
KubeSphere components are often deployed as containers in Kubernetes. If you need to rebuild the KubeSphere components in the Kubernetes cluster, you'll need to [install Docker](https://docs.docker.com/install/) in advance.
### Dependency management
KubeSphere uses [Go Modules](https://github.com/golang/go/wiki/Modules) to manage dependencies in the `vendor/` tree.
> Note: Kubesphere uses the `go module` to manage dependencies, but the kubesphere development process still relies on `GOPATH`
> In the CRD development process, you need to use tools to automatically generate code. The tools used by kubesphere still need to rely on `GOPATH`.
> Kubesphere has a large number of Chinese contributors.
> These contributors may encounter network problems when pulling the go module.We recommend using [goproxy.cn](https://goproxy.cn) as the proxy.
> Note: KubeSphere uses `go module` to manage dependencies, but the development process still relies on `GOPATH`
> In the CRD development process, you need to use tools to automatically generate code. The tools used by KubeSphere still need to rely on `GOPATH`.
> For Chinese contributors who are going to pull the go module, we recommend you to use [goproxy.cn](https://goproxy.cn) as the proxy.
## Building KubeSphere Core on a local OS/shell environment
### For Quick Taste Binary
When you go get kubesphere, you can choose the version you want to get: `go get kubesphere.io/kubesphere@version-you-want`
When you go get KubeSphere, you can choose the version you want to get: `go get kubesphere.io/kubesphere@version-you-want`
> Note: Before getting kubesphere, you need to synchronize the contents of the `replace` section of the go.mod file of the kubesphere you want to version.
> Note: Before getting KubeSphere, you need to synchronize the contents of the `replace` section of the go.mod file of the KubeSphere you want to version.
```bash
mkdir ks-tmp
......@@ -59,16 +57,16 @@ GO111MODULE=on go build -o ks-iam kubesphere.io/kubesphere/cmd/ks-iam # build ks
### For Building KubeSphere Core Images
KubeSphere components are often deployed as a container in a kubernetes cluster, you may need to build a Docker image locally.
KubeSphere components are often deployed as a container in a Kubernetes cluster, you may need to build a Docker image locally.
1. Clone repo to local
1. Clone repo to local.
```bash
git clone https://github.com/kubesphere/kubesphere.git
cd kubesphere
```
2. Run Docker command to build image
2. Run Docker command to build image.
```bash
# $REPO is the docker registry to push to
......@@ -84,14 +82,16 @@ docker build -f ./pkg/db/Dockerfile -t $REPO/ks-devops:flyway-$TAG ./pkg/db/
### For KubeSphere Core local development building.
1. Create a `kubesphere` work directory under `GOPATH` and clone the source code
1. Create a `kubesphere` work directory under `GOPATH` and clone the source code.
```bash
mkdir -p $GOPATH/src/kubesphere.io/
cd $GOPATH/src/kubesphere.io/
git clone https://github.com/kubesphere/kubesphere
```
2. Use make to build binary
2. Use command `make` to build binary
```bash
make ks-apiserver # Build ks-apiserver binary
make ks-iam # Build ks-iam binary
......@@ -103,13 +103,13 @@ If you need to build a docker image, you can refer to the previous section.
### Test
In the development process, it is recommended to use local Kubernetes clusters, such as [minikube](https://kubernetes.io/docs/tasks/tools/install-minikube/), or to install an single-node [all-in-one](https://github.com/kubesphere/kubesphere#all-in-one) environment (Kubernetes-based) for quick testing.
It‘s recommended to use local Kubernetes clusters, such as [minikube](https://kubernetes.io/docs/tasks/tools/install-minikube/), or to install an single-node [all-in-one](https://github.com/kubesphere/kubesphere#all-in-one) environment (Kubernetes-based) for quick testing.
> Tip: It also supports to use Docker for Desktop ships with Kubernetes as the test environment.
## Building KubeSphere Other Module
## Building Other Module of KubeSphere
Kubesphere has quite a few modules such as ServiceMesh, DevOps, Logging...
Some of these modules have unique build methods, we recommend that you refer to the documentation related to the components.
Kubesphere has some pluggable modules such as ServiceMesh, DevOps, Logging, OpenPitrix ...
Some of these modules have their unique build methods, refer to the their documentation accordingly.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册