update contribute guide and add multi-cluster scenario
Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com>
This commit is contained in:
parent
d02b40236d
commit
b4b7bae0a9
|
@ -507,6 +507,80 @@ spec:
|
|||
ref: make-release-in-hangzhou
|
||||
```
|
||||
|
||||
### Multi-cluster scheduling with customized workflow steps
|
||||
|
||||
The multi-cluster feature and combine with the [customized workflow steps](../end-user/workflow/overview) to provide a powerful way for multi-cluster scheduling.
|
||||
|
||||
In the following example, we'll deploy the task first into the `local` cluster and `default` namespace, then check the deploy status by `read-object` step, after that we'll deploy the task into the `prod` namespace according the status.
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: deploy-with-override
|
||||
spec:
|
||||
components:
|
||||
- name: mytask
|
||||
type: task
|
||||
properties:
|
||||
image: bash
|
||||
count: 1
|
||||
cmd: ["echo", "hello world"]
|
||||
policies:
|
||||
- name: target-default
|
||||
type: topology
|
||||
properties:
|
||||
clusters: ["local"]
|
||||
namespace: "default"
|
||||
- name: target-prod
|
||||
type: topology
|
||||
properties:
|
||||
clusters: ["local"]
|
||||
namespace: "prod"
|
||||
- name: override-annotations-1
|
||||
type: override
|
||||
properties:
|
||||
components:
|
||||
- type: task
|
||||
traits:
|
||||
- type: annotations
|
||||
properties:
|
||||
"description": "01 cron task - 1"
|
||||
- name: override-annotations-2
|
||||
type: override
|
||||
properties:
|
||||
components:
|
||||
- type: task
|
||||
traits:
|
||||
- type: annotations
|
||||
properties:
|
||||
"description": "02 cron task - 2"
|
||||
workflow:
|
||||
steps:
|
||||
- type: deploy
|
||||
name: deploy-01
|
||||
properties:
|
||||
policies: ["target-default", "override-annotations-1"]
|
||||
- name: read-object
|
||||
type: read-object
|
||||
outputs:
|
||||
- name: ready
|
||||
valueFrom: output.value.status["ready"]
|
||||
properties:
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
name: mytask
|
||||
namespace: default
|
||||
cluster: local
|
||||
- type: deploy
|
||||
name: deploy-02
|
||||
inputs:
|
||||
- from: ready
|
||||
if: inputs["ready"] == 0
|
||||
properties:
|
||||
policies: ["target-prod", "override-annotations-2"]
|
||||
```
|
||||
|
||||
## Backward Compatibility
|
||||
|
||||
KubeVela Application v1.3 uses different policies and workflow steps to configure and managing multi-cluster applications.
|
||||
|
|
|
@ -16,12 +16,79 @@ This guide helps you get started developing KubeVela.
|
|||
|
||||
### Prerequisites
|
||||
|
||||
1. Golang version 1.19+
|
||||
2. Kubernetes version v1.20+ with `~/.kube/config` configured. (Don't have a test cluster? Try [VelaD](https://github.com/kubevela/velad/blob/main/docs/06.develop_kubevela.md) to develop KubeVela)
|
||||
3. ginkgo 1.14.0+ (just for [E2E test](#e2e-test))
|
||||
4. golangci-lint 1.38.0+, it will install automatically if you run `make`, you can [install it manually](https://golangci-lint.run/usage/install/#local-installation) if the installation is too slow.
|
||||
5. kubebuilder v3.1.0+ and you need to manually install the dependency tools for unit test.
|
||||
6. [CUE binary](https://github.com/cue-lang/cue/releases) v0.3.0+
|
||||
* Golang version 1.19+
|
||||
|
||||
<details>
|
||||
<summary>Install Golang</summary>
|
||||
|
||||
1. Install go1.19 from [official site](https://go.dev/dl/). Unpack the binary and place it somewhere, assume it's in the home path `~/go/`, below is an example command, you should choose the right binary according to your system.
|
||||
```
|
||||
wget https://go.dev/dl/go1.20.2.linux-amd64.tar.gz
|
||||
tar xzf go1.20.2.linux-amd64.tar.gz
|
||||
```
|
||||
|
||||
If you want to keep multiple golang version in your local develop environment, you can download the package and unfold it into some place, like `~/go/go1.19.1`, then the following commands should also change according to the path.
|
||||
|
||||
1. Set environment variables for Golang
|
||||
|
||||
```
|
||||
export PATH=~/go/bin/:$PATH
|
||||
export GOROOT=~/go/
|
||||
export GOPATH=~/gopath/
|
||||
```
|
||||
|
||||
Create a gopath folder if not exist `mkdir ~/gopath`. These commands will add the go binary folder to the `PATH` environment (let it to be the primary choice for go), and set the `GOROOT` environment to this go folder. Please add these lines to your `~/.bashrc` or `~/.zshrc` file, so that you don't need to set these environment variables every time you open a new terminal.
|
||||
|
||||
1. (Optional) Some area like China may be too slow to connect to the default go registry, you can configure GOPROXY to speed up the download process.
|
||||
```
|
||||
go env -w GOPROXY=https://goproxy.cn,direct
|
||||
```
|
||||
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
* Kubernetes version v1.20+ with `~/.kube/config` configured. (Don't have a test cluster? Try [VelaD](https://github.com/kubevela/velad/blob/main/docs/06.develop_kubevela.md) to develop KubeVela)
|
||||
|
||||
|
||||
* golangci-lint 1.49.0+, it will install automatically if you run `make`, you can install it manually if the installation broken.
|
||||
|
||||
<details>
|
||||
<summary>Install golangci-lint manually</summary>
|
||||
|
||||
You can install it manually follow [the guide](https://golangci-lint.run/usage/install/#local-installation) or the following command:
|
||||
|
||||
```
|
||||
cd ~/go/ && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.49.0
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
* kustomize 4.5.4+, it will install automatically if you run `make reviewable`, you can install it manually if the installation broken.
|
||||
|
||||
<details>
|
||||
<summary>Install kustomize manually</summary>
|
||||
|
||||
You can install it manually follow [the guide](https://kubectl.docs.kubernetes.io/installation/kustomize/) or the following commands:
|
||||
|
||||
```
|
||||
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
|
||||
```
|
||||
|
||||
Move kustomize binary to your KubeVela repo folder:
|
||||
|
||||
```shell
|
||||
mv kustomize ~/kubevela/bin/
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
* ginkgo 1.14.0+ (just for [E2E test](#e2e-test))
|
||||
```
|
||||
go install github.com/onsi/ginkgo/v2/ginkgo@latest
|
||||
```
|
||||
|
||||
* kubebuilder v3.1.0+ and you need to manually install the dependency tools for unit test.
|
||||
|
||||
<details>
|
||||
<summary>Install Kubebuilder manually</summary>
|
||||
|
@ -48,28 +115,29 @@ For other OS or system architecture, please refer to https://storage.googleapis.
|
|||
|
||||
</details>
|
||||
|
||||
|
||||
* [CUElang](https://github.com/cue-lang/cue/blob/master/doc/install.md) v0.4.3+
|
||||
```
|
||||
go install cuelang.org/go/cmd/cue@latest
|
||||
```
|
||||
|
||||
* Other tools for running `make reviewable` in KubeVela.
|
||||
```shell
|
||||
go install honnef.co/go/tools/cmd/staticcheck@2022.1
|
||||
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.6.2
|
||||
go install golang.org/x/tools/cmd/goimports@latest
|
||||
```
|
||||
|
||||
:::tip
|
||||
KubeVela v1.6 upgrades some develop tools. You need to upgrade your local development environment with the following guide.
|
||||
|
||||
1. Install go1.19 from [official site](https://go.dev/dl/). If you want to keep multiple golang version in your local develop environment, you can download the package and unfold it into some place, like `~/go/go1.19.1`.
|
||||
2. Set environment variables. `export PATH=~/go/go1.19.1/bin/:$PATH; export GOROOT=~/go/go1.19.1`. Add the go1.19 binary folder to the `PATH` environment (let it to be the primary choice for go), and set the `GOROOT` environment to your latest version go folder.
|
||||
3. Install the tools for running `make reviewable` in KubeVela.
|
||||
```shell
|
||||
cd ~/go/go1.19.1/ && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.49.0
|
||||
go install honnef.co/go/tools/cmd/staticcheck@2022.1
|
||||
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.6.2
|
||||
go install golang.org/x/tools/cmd/goimports@latest
|
||||
```
|
||||
:::
|
||||
|
||||
You may also be interested with KubeVela's [design](https://github.com/oam-dev/kubevela/tree/master/design/vela-core) before diving into its code.
|
||||
:::
|
||||
|
||||
### Build
|
||||
|
||||
- Clone this project
|
||||
|
||||
```shell script
|
||||
git clone git@github.com:oam-dev/kubevela.git
|
||||
git clone git@github.com:kubevela/kubevela.git
|
||||
```
|
||||
|
||||
KubeVela includes two parts, `vela core` and `vela cli`.
|
||||
|
|
|
@ -522,6 +522,80 @@ spec:
|
|||
ref: make-release-in-hangzhou
|
||||
```
|
||||
|
||||
### 通过自定义工作流步骤实现多集群调度
|
||||
|
||||
多集群部署的功能可以结合[自定义工作流步骤](../end-user/workflow/overview) 实现功能多样的多集群调度能力.
|
||||
|
||||
如下示例所示,我们会部署一个任务到 `local` 集群的 `default` 命名空间,然后通过 `read-object` 步骤检查部署状态,最后根据状态将任务部署到 `prod` 命名空间。
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: deploy-with-override
|
||||
spec:
|
||||
components:
|
||||
- name: mytask
|
||||
type: task
|
||||
properties:
|
||||
image: bash
|
||||
count: 1
|
||||
cmd: ["echo", "hello world"]
|
||||
policies:
|
||||
- name: target-default
|
||||
type: topology
|
||||
properties:
|
||||
clusters: ["local"]
|
||||
namespace: "default"
|
||||
- name: target-prod
|
||||
type: topology
|
||||
properties:
|
||||
clusters: ["local"]
|
||||
namespace: "prod"
|
||||
- name: override-annotations-1
|
||||
type: override
|
||||
properties:
|
||||
components:
|
||||
- type: task
|
||||
traits:
|
||||
- type: annotations
|
||||
properties:
|
||||
"description": "01 cron task - 1"
|
||||
- name: override-annotations-2
|
||||
type: override
|
||||
properties:
|
||||
components:
|
||||
- type: task
|
||||
traits:
|
||||
- type: annotations
|
||||
properties:
|
||||
"description": "02 cron task - 2"
|
||||
workflow:
|
||||
steps:
|
||||
- type: deploy
|
||||
name: deploy-01
|
||||
properties:
|
||||
policies: ["target-default", "override-annotations-1"]
|
||||
- name: read-object
|
||||
type: read-object
|
||||
outputs:
|
||||
- name: ready
|
||||
valueFrom: output.value.status["ready"]
|
||||
properties:
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
name: mytask
|
||||
namespace: default
|
||||
cluster: local
|
||||
- type: deploy
|
||||
name: deploy-02
|
||||
inputs:
|
||||
- from: ready
|
||||
if: inputs["ready"] == 0
|
||||
properties:
|
||||
policies: ["target-prod", "override-annotations-2"]
|
||||
```
|
||||
|
||||
## 兼容性
|
||||
|
||||
KubeVela 的 v1.3 应用相较于之前的版本使用了不同的策略和工作流步骤来分发、管理多集群应用。
|
||||
|
|
|
@ -16,12 +16,79 @@ This guide helps you get started developing KubeVela.
|
|||
|
||||
### Prerequisites
|
||||
|
||||
1. Golang version 1.19+
|
||||
2. Kubernetes version v1.20+ with `~/.kube/config` configured. (Don't have a test cluster? Try [VelaD](https://github.com/kubevela/velad/blob/main/docs/06.develop_kubevela.md) to develop KubeVela)
|
||||
3. ginkgo 1.14.0+ (just for [E2E test](#e2e-test))
|
||||
4. golangci-lint 1.38.0+, it will install automatically if you run `make`, you can [install it manually](https://golangci-lint.run/usage/install/#local-installation) if the installation is too slow.
|
||||
5. kubebuilder v3.1.0+ and you need to manually install the dependency tools for unit test.
|
||||
6. [CUE binary](https://github.com/cue-lang/cue/releases) v0.3.0+
|
||||
* Golang version 1.19+
|
||||
|
||||
<details>
|
||||
<summary>Install Golang</summary>
|
||||
|
||||
1. Install go1.19 from [official site](https://go.dev/dl/). Unpack the binary and place it somewhere, assume it's in the home path `~/go/`, below is an example command, you should choose the right binary according to your system.
|
||||
```
|
||||
wget https://go.dev/dl/go1.20.2.linux-amd64.tar.gz
|
||||
tar xzf go1.20.2.linux-amd64.tar.gz
|
||||
```
|
||||
|
||||
If you want to keep multiple golang version in your local develop environment, you can download the package and unfold it into some place, like `~/go/go1.19.1`, then the following commands should also change according to the path.
|
||||
|
||||
1. Set environment variables for Golang
|
||||
|
||||
```
|
||||
export PATH=~/go/bin/:$PATH
|
||||
export GOROOT=~/go/
|
||||
export GOPATH=~/gopath/
|
||||
```
|
||||
|
||||
Create a gopath folder if not exist `mkdir ~/gopath`. These commands will add the go binary folder to the `PATH` environment (let it to be the primary choice for go), and set the `GOROOT` environment to this go folder. Please add these lines to your `~/.bashrc` or `~/.zshrc` file, so that you don't need to set these environment variables every time you open a new terminal.
|
||||
|
||||
1. (Optional) Some area like China may be too slow to connect to the default go registry, you can configure GOPROXY to speed up the download process.
|
||||
```
|
||||
go env -w GOPROXY=https://goproxy.cn,direct
|
||||
```
|
||||
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
* Kubernetes version v1.20+ with `~/.kube/config` configured. (Don't have a test cluster? Try [VelaD](https://github.com/kubevela/velad/blob/main/docs/06.develop_kubevela.md) to develop KubeVela)
|
||||
|
||||
|
||||
* golangci-lint 1.49.0+, it will install automatically if you run `make`, you can install it manually if the installation broken.
|
||||
|
||||
<details>
|
||||
<summary>Install golangci-lint manually</summary>
|
||||
|
||||
You can install it manually follow [the guide](https://golangci-lint.run/usage/install/#local-installation) or the following command:
|
||||
|
||||
```
|
||||
cd ~/go/ && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.49.0
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
* kustomize 4.5.4+, it will install automatically if you run `make reviewable`, you can install it manually if the installation broken.
|
||||
|
||||
<details>
|
||||
<summary>Install kustomize manually</summary>
|
||||
|
||||
You can install it manually follow [the guide](https://kubectl.docs.kubernetes.io/installation/kustomize/) or the following commands:
|
||||
|
||||
```
|
||||
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
|
||||
```
|
||||
|
||||
Move kustomize binary to your KubeVela repo folder:
|
||||
|
||||
```shell
|
||||
mv kustomize ~/kubevela/bin/
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
* ginkgo 1.14.0+ (just for [E2E test](#e2e-test))
|
||||
```
|
||||
go install github.com/onsi/ginkgo/v2/ginkgo@latest
|
||||
```
|
||||
|
||||
* kubebuilder v3.1.0+ and you need to manually install the dependency tools for unit test.
|
||||
|
||||
<details>
|
||||
<summary>Install Kubebuilder manually</summary>
|
||||
|
@ -48,19 +115,21 @@ For other OS or system architecture, please refer to https://storage.googleapis.
|
|||
|
||||
</details>
|
||||
|
||||
You may also be interested with KubeVela's [design](https://github.com/oam-dev/kubevela/tree/master/design/vela-core) before diving into its code.
|
||||
|
||||
* [CUElang](https://github.com/cue-lang/cue/blob/master/doc/install.md) v0.4.3+
|
||||
```
|
||||
go install cuelang.org/go/cmd/cue@latest
|
||||
```
|
||||
|
||||
* Other tools for running `make reviewable` in KubeVela.
|
||||
```shell
|
||||
go install honnef.co/go/tools/cmd/staticcheck@2022.1
|
||||
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.6.2
|
||||
go install golang.org/x/tools/cmd/goimports@latest
|
||||
```
|
||||
|
||||
:::tip
|
||||
KubeVela v1.6 upgrades some develop tools. You need to upgrade your local development environment with the following guide.
|
||||
|
||||
1. Install go1.19 from [official site](https://go.dev/dl/). If you want to keep multiple golang version in your local develop environment, you can download the package and unfold it into some place, like `~/go/go1.19.1`.
|
||||
2. Set environment variables. `export PATH=~/go/go1.19.1/bin/:$PATH; export GOROOT=~/go/go1.19.1`. Add the go1.19 binary folder to the `PATH` environment (let it to be the primary choice for go), and set the `GOROOT` environment to your latest version go folder.
|
||||
3. Install the tools for running `make reviewable` in KubeVela.
|
||||
```shell
|
||||
cd ~/go/go1.19.1/ && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.49.0
|
||||
go install honnef.co/go/tools/cmd/staticcheck@2022.1
|
||||
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.6.2
|
||||
```
|
||||
You may also be interested with KubeVela's [design](https://github.com/oam-dev/kubevela/tree/master/design/vela-core) before diving into its code.
|
||||
:::
|
||||
|
||||
### Build
|
||||
|
@ -68,7 +137,7 @@ go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.6.2
|
|||
- Clone this project
|
||||
|
||||
```shell script
|
||||
git clone git@github.com:oam-dev/kubevela.git
|
||||
git clone git@github.com:kubevela/kubevela.git
|
||||
```
|
||||
|
||||
KubeVela includes two parts, `vela core` and `vela cli`.
|
||||
|
@ -122,7 +191,7 @@ 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 one, try [VelaD](https://github.com/kubevela/velad/blob/main/docs/06.develop_kubevela.md)
|
||||
locally. If you don't have one, try [VelaD](https://github.com/kubevela/velad/blob/main/docs/06.develop_kubevela.md)
|
||||
to develop KubeVela.
|
||||
|
||||
When you're developing `vela-core`, make sure the controller installed by helm chart is not running.
|
||||
|
@ -180,7 +249,9 @@ To run vela-core locally for debugging with kubevela installed in the remote clu
|
|||
|
||||
Finally, you can use the commands in the above [Build](#build) and [Testing](#Testing) sections, such as `make run`, to code and debug in your local machine.
|
||||
|
||||
> Note you will not be able to test features relate with validating/mutating webhooks in this way.
|
||||
:::caution
|
||||
Note you will not be able to test features relate with validating/mutating webhooks in this way.
|
||||
:::
|
||||
|
||||
## Run VelaUX Locally
|
||||
|
||||
|
|
|
@ -522,6 +522,80 @@ spec:
|
|||
ref: make-release-in-hangzhou
|
||||
```
|
||||
|
||||
### 通过自定义工作流步骤实现多集群调度
|
||||
|
||||
多集群部署的功能可以结合[自定义工作流步骤](../end-user/workflow/overview) 实现功能多样的多集群调度能力.
|
||||
|
||||
如下示例所示,我们会部署一个任务到 `local` 集群的 `default` 命名空间,然后通过 `read-object` 步骤检查部署状态,最后根据状态将任务部署到 `prod` 命名空间。
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: deploy-with-override
|
||||
spec:
|
||||
components:
|
||||
- name: mytask
|
||||
type: task
|
||||
properties:
|
||||
image: bash
|
||||
count: 1
|
||||
cmd: ["echo", "hello world"]
|
||||
policies:
|
||||
- name: target-default
|
||||
type: topology
|
||||
properties:
|
||||
clusters: ["local"]
|
||||
namespace: "default"
|
||||
- name: target-prod
|
||||
type: topology
|
||||
properties:
|
||||
clusters: ["local"]
|
||||
namespace: "prod"
|
||||
- name: override-annotations-1
|
||||
type: override
|
||||
properties:
|
||||
components:
|
||||
- type: task
|
||||
traits:
|
||||
- type: annotations
|
||||
properties:
|
||||
"description": "01 cron task - 1"
|
||||
- name: override-annotations-2
|
||||
type: override
|
||||
properties:
|
||||
components:
|
||||
- type: task
|
||||
traits:
|
||||
- type: annotations
|
||||
properties:
|
||||
"description": "02 cron task - 2"
|
||||
workflow:
|
||||
steps:
|
||||
- type: deploy
|
||||
name: deploy-01
|
||||
properties:
|
||||
policies: ["target-default", "override-annotations-1"]
|
||||
- name: read-object
|
||||
type: read-object
|
||||
outputs:
|
||||
- name: ready
|
||||
valueFrom: output.value.status["ready"]
|
||||
properties:
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
name: mytask
|
||||
namespace: default
|
||||
cluster: local
|
||||
- type: deploy
|
||||
name: deploy-02
|
||||
inputs:
|
||||
- from: ready
|
||||
if: inputs["ready"] == 0
|
||||
properties:
|
||||
policies: ["target-prod", "override-annotations-2"]
|
||||
```
|
||||
|
||||
## 兼容性
|
||||
|
||||
KubeVela 的 v1.3 应用相较于之前的版本使用了不同的策略和工作流步骤来分发、管理多集群应用。
|
||||
|
|
|
@ -16,12 +16,79 @@ This guide helps you get started developing KubeVela.
|
|||
|
||||
### Prerequisites
|
||||
|
||||
1. Golang version 1.19+
|
||||
2. Kubernetes version v1.20+ with `~/.kube/config` configured. (Don't have a test cluster? Try [VelaD](https://github.com/kubevela/velad/blob/main/docs/06.develop_kubevela.md) to develop KubeVela)
|
||||
3. ginkgo 1.14.0+ (just for [E2E test](#e2e-test))
|
||||
4. golangci-lint 1.38.0+, it will install automatically if you run `make`, you can [install it manually](https://golangci-lint.run/usage/install/#local-installation) if the installation is too slow.
|
||||
5. kubebuilder v3.1.0+ and you need to manually install the dependency tools for unit test.
|
||||
6. [CUE binary](https://github.com/cue-lang/cue/releases) v0.3.0+
|
||||
* Golang version 1.19+
|
||||
|
||||
<details>
|
||||
<summary>Install Golang</summary>
|
||||
|
||||
1. Install go1.19 from [official site](https://go.dev/dl/). Unpack the binary and place it somewhere, assume it's in the home path `~/go/`, below is an example command, you should choose the right binary according to your system.
|
||||
```
|
||||
wget https://go.dev/dl/go1.20.2.linux-amd64.tar.gz
|
||||
tar xzf go1.20.2.linux-amd64.tar.gz
|
||||
```
|
||||
|
||||
If you want to keep multiple golang version in your local develop environment, you can download the package and unfold it into some place, like `~/go/go1.19.1`, then the following commands should also change according to the path.
|
||||
|
||||
1. Set environment variables for Golang
|
||||
|
||||
```
|
||||
export PATH=~/go/bin/:$PATH
|
||||
export GOROOT=~/go/
|
||||
export GOPATH=~/gopath/
|
||||
```
|
||||
|
||||
Create a gopath folder if not exist `mkdir ~/gopath`. These commands will add the go binary folder to the `PATH` environment (let it to be the primary choice for go), and set the `GOROOT` environment to this go folder. Please add these lines to your `~/.bashrc` or `~/.zshrc` file, so that you don't need to set these environment variables every time you open a new terminal.
|
||||
|
||||
1. (Optional) Some area like China may be too slow to connect to the default go registry, you can configure GOPROXY to speed up the download process.
|
||||
```
|
||||
go env -w GOPROXY=https://goproxy.cn,direct
|
||||
```
|
||||
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
* Kubernetes version v1.20+ with `~/.kube/config` configured. (Don't have a test cluster? Try [VelaD](https://github.com/kubevela/velad/blob/main/docs/06.develop_kubevela.md) to develop KubeVela)
|
||||
|
||||
|
||||
* golangci-lint 1.49.0+, it will install automatically if you run `make`, you can install it manually if the installation broken.
|
||||
|
||||
<details>
|
||||
<summary>Install golangci-lint manually</summary>
|
||||
|
||||
You can install it manually follow [the guide](https://golangci-lint.run/usage/install/#local-installation) or the following command:
|
||||
|
||||
```
|
||||
cd ~/go/ && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.49.0
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
* kustomize 4.5.4+, it will install automatically if you run `make reviewable`, you can install it manually if the installation broken.
|
||||
|
||||
<details>
|
||||
<summary>Install kustomize manually</summary>
|
||||
|
||||
You can install it manually follow [the guide](https://kubectl.docs.kubernetes.io/installation/kustomize/) or the following commands:
|
||||
|
||||
```
|
||||
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
|
||||
```
|
||||
|
||||
Move kustomize binary to your KubeVela repo folder:
|
||||
|
||||
```shell
|
||||
mv kustomize ~/kubevela/bin/
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
* ginkgo 1.14.0+ (just for [E2E test](#e2e-test))
|
||||
```
|
||||
go install github.com/onsi/ginkgo/v2/ginkgo@latest
|
||||
```
|
||||
|
||||
* kubebuilder v3.1.0+ and you need to manually install the dependency tools for unit test.
|
||||
|
||||
<details>
|
||||
<summary>Install Kubebuilder manually</summary>
|
||||
|
@ -48,19 +115,21 @@ For other OS or system architecture, please refer to https://storage.googleapis.
|
|||
|
||||
</details>
|
||||
|
||||
You may also be interested with KubeVela's [design](https://github.com/oam-dev/kubevela/tree/master/design/vela-core) before diving into its code.
|
||||
|
||||
* [CUElang](https://github.com/cue-lang/cue/blob/master/doc/install.md) v0.4.3+
|
||||
```
|
||||
go install cuelang.org/go/cmd/cue@latest
|
||||
```
|
||||
|
||||
* Other tools for running `make reviewable` in KubeVela.
|
||||
```shell
|
||||
go install honnef.co/go/tools/cmd/staticcheck@2022.1
|
||||
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.6.2
|
||||
go install golang.org/x/tools/cmd/goimports@latest
|
||||
```
|
||||
|
||||
:::tip
|
||||
KubeVela v1.6 upgrades some develop tools. You need to upgrade your local development environment with the following guide.
|
||||
|
||||
1. Install go1.19 from [official site](https://go.dev/dl/). If you want to keep multiple golang version in your local develop environment, you can download the package and unfold it into some place, like `~/go/go1.19.1`.
|
||||
2. Set environment variables. `export PATH=~/go/go1.19.1/bin/:$PATH; export GOROOT=~/go/go1.19.1`. Add the go1.19 binary folder to the `PATH` environment (let it to be the primary choice for go), and set the `GOROOT` environment to your latest version go folder.
|
||||
3. Install the tools for running `make reviewable` in KubeVela.
|
||||
```shell
|
||||
cd ~/go/go1.19.1/ && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.49.0
|
||||
go install honnef.co/go/tools/cmd/staticcheck@2022.1
|
||||
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.6.2
|
||||
```
|
||||
You may also be interested with KubeVela's [design](https://github.com/oam-dev/kubevela/tree/master/design/vela-core) before diving into its code.
|
||||
:::
|
||||
|
||||
### Build
|
||||
|
@ -68,7 +137,7 @@ go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.6.2
|
|||
- Clone this project
|
||||
|
||||
```shell script
|
||||
git clone git@github.com:oam-dev/kubevela.git
|
||||
git clone git@github.com:kubevela/kubevela.git
|
||||
```
|
||||
|
||||
KubeVela includes two parts, `vela core` and `vela cli`.
|
||||
|
@ -122,7 +191,7 @@ 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 one, try [VelaD](https://github.com/kubevela/velad/blob/main/docs/06.develop_kubevela.md)
|
||||
locally. If you don't have one, try [VelaD](https://github.com/kubevela/velad/blob/main/docs/06.develop_kubevela.md)
|
||||
to develop KubeVela.
|
||||
|
||||
When you're developing `vela-core`, make sure the controller installed by helm chart is not running.
|
||||
|
@ -180,7 +249,9 @@ To run vela-core locally for debugging with kubevela installed in the remote clu
|
|||
|
||||
Finally, you can use the commands in the above [Build](#build) and [Testing](#Testing) sections, such as `make run`, to code and debug in your local machine.
|
||||
|
||||
> Note you will not be able to test features relate with validating/mutating webhooks in this way.
|
||||
:::caution
|
||||
Note you will not be able to test features relate with validating/mutating webhooks in this way.
|
||||
:::
|
||||
|
||||
## Run VelaUX Locally
|
||||
|
||||
|
|
|
@ -507,6 +507,80 @@ spec:
|
|||
ref: make-release-in-hangzhou
|
||||
```
|
||||
|
||||
### Multi-cluster scheduling with customized workflow steps
|
||||
|
||||
The multi-cluster feature and combine with the [customized workflow steps](../end-user/workflow/overview) to provide a powerful way for multi-cluster scheduling.
|
||||
|
||||
In the following example, we'll deploy the task first into the `local` cluster and `default` namespace, then check the deploy status by `read-object` step, after that we'll deploy the task into the `prod` namespace according the status.
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: deploy-with-override
|
||||
spec:
|
||||
components:
|
||||
- name: mytask
|
||||
type: task
|
||||
properties:
|
||||
image: bash
|
||||
count: 1
|
||||
cmd: ["echo", "hello world"]
|
||||
policies:
|
||||
- name: target-default
|
||||
type: topology
|
||||
properties:
|
||||
clusters: ["local"]
|
||||
namespace: "default"
|
||||
- name: target-prod
|
||||
type: topology
|
||||
properties:
|
||||
clusters: ["local"]
|
||||
namespace: "prod"
|
||||
- name: override-annotations-1
|
||||
type: override
|
||||
properties:
|
||||
components:
|
||||
- type: task
|
||||
traits:
|
||||
- type: annotations
|
||||
properties:
|
||||
"description": "01 cron task - 1"
|
||||
- name: override-annotations-2
|
||||
type: override
|
||||
properties:
|
||||
components:
|
||||
- type: task
|
||||
traits:
|
||||
- type: annotations
|
||||
properties:
|
||||
"description": "02 cron task - 2"
|
||||
workflow:
|
||||
steps:
|
||||
- type: deploy
|
||||
name: deploy-01
|
||||
properties:
|
||||
policies: ["target-default", "override-annotations-1"]
|
||||
- name: read-object
|
||||
type: read-object
|
||||
outputs:
|
||||
- name: ready
|
||||
valueFrom: output.value.status["ready"]
|
||||
properties:
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
name: mytask
|
||||
namespace: default
|
||||
cluster: local
|
||||
- type: deploy
|
||||
name: deploy-02
|
||||
inputs:
|
||||
- from: ready
|
||||
if: inputs["ready"] == 0
|
||||
properties:
|
||||
policies: ["target-prod", "override-annotations-2"]
|
||||
```
|
||||
|
||||
## Backward Compatibility
|
||||
|
||||
KubeVela Application v1.3 uses different policies and workflow steps to configure and managing multi-cluster applications.
|
||||
|
|
|
@ -16,12 +16,79 @@ This guide helps you get started developing KubeVela.
|
|||
|
||||
### Prerequisites
|
||||
|
||||
1. Golang version 1.19+
|
||||
2. Kubernetes version v1.20+ with `~/.kube/config` configured. (Don't have a test cluster? Try [VelaD](https://github.com/kubevela/velad/blob/main/docs/06.develop_kubevela.md) to develop KubeVela)
|
||||
3. ginkgo 1.14.0+ (just for [E2E test](#e2e-test))
|
||||
4. golangci-lint 1.38.0+, it will install automatically if you run `make`, you can [install it manually](https://golangci-lint.run/usage/install/#local-installation) if the installation is too slow.
|
||||
5. kubebuilder v3.1.0+ and you need to manually install the dependency tools for unit test.
|
||||
6. [CUE binary](https://github.com/cue-lang/cue/releases) v0.3.0+
|
||||
* Golang version 1.19+
|
||||
|
||||
<details>
|
||||
<summary>Install Golang</summary>
|
||||
|
||||
1. Install go1.19 from [official site](https://go.dev/dl/). Unpack the binary and place it somewhere, assume it's in the home path `~/go/`, below is an example command, you should choose the right binary according to your system.
|
||||
```
|
||||
wget https://go.dev/dl/go1.20.2.linux-amd64.tar.gz
|
||||
tar xzf go1.20.2.linux-amd64.tar.gz
|
||||
```
|
||||
|
||||
If you want to keep multiple golang version in your local develop environment, you can download the package and unfold it into some place, like `~/go/go1.19.1`, then the following commands should also change according to the path.
|
||||
|
||||
1. Set environment variables for Golang
|
||||
|
||||
```
|
||||
export PATH=~/go/bin/:$PATH
|
||||
export GOROOT=~/go/
|
||||
export GOPATH=~/gopath/
|
||||
```
|
||||
|
||||
Create a gopath folder if not exist `mkdir ~/gopath`. These commands will add the go binary folder to the `PATH` environment (let it to be the primary choice for go), and set the `GOROOT` environment to this go folder. Please add these lines to your `~/.bashrc` or `~/.zshrc` file, so that you don't need to set these environment variables every time you open a new terminal.
|
||||
|
||||
1. (Optional) Some area like China may be too slow to connect to the default go registry, you can configure GOPROXY to speed up the download process.
|
||||
```
|
||||
go env -w GOPROXY=https://goproxy.cn,direct
|
||||
```
|
||||
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
* Kubernetes version v1.20+ with `~/.kube/config` configured. (Don't have a test cluster? Try [VelaD](https://github.com/kubevela/velad/blob/main/docs/06.develop_kubevela.md) to develop KubeVela)
|
||||
|
||||
|
||||
* golangci-lint 1.49.0+, it will install automatically if you run `make`, you can install it manually if the installation broken.
|
||||
|
||||
<details>
|
||||
<summary>Install golangci-lint manually</summary>
|
||||
|
||||
You can install it manually follow [the guide](https://golangci-lint.run/usage/install/#local-installation) or the following command:
|
||||
|
||||
```
|
||||
cd ~/go/ && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.49.0
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
* kustomize 4.5.4+, it will install automatically if you run `make reviewable`, you can install it manually if the installation broken.
|
||||
|
||||
<details>
|
||||
<summary>Install kustomize manually</summary>
|
||||
|
||||
You can install it manually follow [the guide](https://kubectl.docs.kubernetes.io/installation/kustomize/) or the following commands:
|
||||
|
||||
```
|
||||
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
|
||||
```
|
||||
|
||||
Move kustomize binary to your KubeVela repo folder:
|
||||
|
||||
```shell
|
||||
mv kustomize ~/kubevela/bin/
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
* ginkgo 1.14.0+ (just for [E2E test](#e2e-test))
|
||||
```
|
||||
go install github.com/onsi/ginkgo/v2/ginkgo@latest
|
||||
```
|
||||
|
||||
* kubebuilder v3.1.0+ and you need to manually install the dependency tools for unit test.
|
||||
|
||||
<details>
|
||||
<summary>Install Kubebuilder manually</summary>
|
||||
|
@ -48,28 +115,29 @@ For other OS or system architecture, please refer to https://storage.googleapis.
|
|||
|
||||
</details>
|
||||
|
||||
|
||||
* [CUElang](https://github.com/cue-lang/cue/blob/master/doc/install.md) v0.4.3+
|
||||
```
|
||||
go install cuelang.org/go/cmd/cue@latest
|
||||
```
|
||||
|
||||
* Other tools for running `make reviewable` in KubeVela.
|
||||
```shell
|
||||
go install honnef.co/go/tools/cmd/staticcheck@2022.1
|
||||
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.6.2
|
||||
go install golang.org/x/tools/cmd/goimports@latest
|
||||
```
|
||||
|
||||
:::tip
|
||||
KubeVela v1.6 upgrades some develop tools. You need to upgrade your local development environment with the following guide.
|
||||
|
||||
1. Install go1.19 from [official site](https://go.dev/dl/). If you want to keep multiple golang version in your local develop environment, you can download the package and unfold it into some place, like `~/go/go1.19.1`.
|
||||
2. Set environment variables. `export PATH=~/go/go1.19.1/bin/:$PATH; export GOROOT=~/go/go1.19.1`. Add the go1.19 binary folder to the `PATH` environment (let it to be the primary choice for go), and set the `GOROOT` environment to your latest version go folder.
|
||||
3. Install the tools for running `make reviewable` in KubeVela.
|
||||
```shell
|
||||
cd ~/go/go1.19.1/ && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.49.0
|
||||
go install honnef.co/go/tools/cmd/staticcheck@2022.1
|
||||
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.6.2
|
||||
go install golang.org/x/tools/cmd/goimports@latest
|
||||
```
|
||||
:::
|
||||
|
||||
You may also be interested with KubeVela's [design](https://github.com/oam-dev/kubevela/tree/master/design/vela-core) before diving into its code.
|
||||
:::
|
||||
|
||||
### Build
|
||||
|
||||
- Clone this project
|
||||
|
||||
```shell script
|
||||
git clone git@github.com:oam-dev/kubevela.git
|
||||
git clone git@github.com:kubevela/kubevela.git
|
||||
```
|
||||
|
||||
KubeVela includes two parts, `vela core` and `vela cli`.
|
||||
|
|
Loading…
Reference in New Issue