small fix

small fix

Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com>
This commit is contained in:
楚岳 2022-06-20 16:03:54 +08:00
parent 19f2de1e73
commit 606134deb2
3 changed files with 53 additions and 4 deletions

View File

@ -191,6 +191,23 @@ When an end user enabling the addon, he will be able to specify parameters:
vela addon enable velaux serviceAccountName="my-account"
```
Then the render result will be:
```yaml
kind: Application
...
# application header in template
spec:
components:
- type: webservice
properties:
image: "oamdev/vela-apiserver:v1.4.0"
traits:
- type: service-account
properties:
name: my-account
```
UX/CLI renders all CUE files and `parameter.cue` in one context when the addon is enabled, resulting in a set of components that are appended to the application template.
#### YAML format resource

View File

@ -188,6 +188,23 @@ output: {
vela addon enable velaux serviceAccountName="my-account"
```
这样最终渲染出来的组件如下:
```yaml
kind: Application
...
# application header in template
spec:
components:
- type: webservice
properties:
image: "oamdev/vela-apiserver:v1.4.0"
traits:
- type: service-account
properties:
name: my-account
```
背后的机制是,在启用时 UX/CLI 会把 CUE 定义的资源文件和参数文件放在一个上下文中渲染,得到一系列组件追加到应用当中去。
#### YAML 格式的资源

View File

@ -29,7 +29,7 @@ Typically the directory hierarchy looks like below:
└── template.yaml
```
Not all of these directory or files are necessary, let's explain them one by one.
Not all of these directories or files are necessary, let's explain them one by one.
### metadata.yaml(Required)
@ -47,7 +47,6 @@ tags:
deployTo:
runtimeCluster: false
disableControlPlane: false
dependencies:
- name: addon_name
@ -73,7 +72,6 @@ Here's the usage of every field:
| url | no | string | The official website of the project behind the addon. |
| tags | no | []string | The tags to display and organize the addon. |
| deployTo.runtimeCluster | no | bool | By default, the addon will not be installed in the managed clusters. If it's `true`, it will be delivered to all managed clusters automatically. |
| deployTo.disableControlPlane | no | bool | By default the addon will be installed in the control plane cluster. If it's `true`, the addon will not be installed in the control plane cluster. |
| dependencies | no | []{ name: string } | Names of other addons it depends on. KubeVela will make sure these dependencies are enabled before installing this addon. |
| system.vela | no | string | Required version of vela controller, vela CLI will block the installation if vela controller can't match the requirements. |
| system.kubernetes | no | string | Required version of Kubernetes, vela CLI will block the installation if Kubernetes cluster can't match the requirements. |
@ -114,7 +112,7 @@ The name of Application in template will be replaced by the addon name in `metad
#### Examples
* [velaux](https://github.com/kubevela/catalog/blob/master/addons/velaux/template.yaml), define only the header of application in the template.
* [ocm control plane](https://github.com/kubevela/catalog/blob/master/addons/ocm-hub-control-plane/template.yaml), the addon only be installed in control plane, so it just defines everything in the application template.
* [OCM control plane](https://github.com/kubevela/catalog/blob/master/addons/ocm-hub-control-plane/template.yaml), the addon only be installed in control plane, so it just defines everything in the application template.
### `resources/` directory(Optional)
@ -193,6 +191,23 @@ When an end user enabling the addon, he will be able to specify parameters:
vela addon enable velaux serviceAccountName="my-account"
```
Then the render result will be:
```yaml
kind: Application
...
# application header in template
spec:
components:
- type: webservice
properties:
image: "oamdev/vela-apiserver:v1.4.0"
traits:
- type: service-account
properties:
name: my-account
```
UX/CLI renders all CUE files and `parameter.cue` in one context when the addon is enabled, resulting in a set of components that are appended to the application template.
#### YAML format resource