parent
47d268de07
commit
33fb5cf491
|
|
@ -2,11 +2,11 @@
|
|||
title: 云服务
|
||||
---
|
||||
|
||||
KubeVela 允许你在一致的 API 中声明你的应用程序所需的云服务。 目前,我们同时支持 Terraform 和 Crossplane。
|
||||
KubeVela 允许你在一致的 API 中声明你的应用程序所需的云服务。 目前,我们推荐使用 Terraform 来支持。
|
||||
|
||||
> 如果你对 KubeVela 中如何维护这些功能感兴趣,请查看 [云服务平台团队指南](../../platform-engineers/cloud-services)。
|
||||
> 如果你对 KubeVela 中如何维护这些功能感兴趣,请查看 [云服务平台团队指南](../../platform-engineers/components/component-terraform)。
|
||||
|
||||
应用程序将通过 [Service Binding Trait](../traits/service-binding) 使用云服务。
|
||||
应用部署计划将通过 [Service Binding Trait](../traits/service-binding) 使用云服务。
|
||||
|
||||
## Terraform
|
||||
|
||||
|
|
@ -100,98 +100,4 @@ spec:
|
|||
name: oss-conn
|
||||
|
||||
|
||||
```
|
||||
|
||||
## Crossplane
|
||||
|
||||
> ⚠️ 本节假设你的平台已经安装了【Crossplane 相关功能】(../../platform-engineers/crossplane)。
|
||||
|
||||
### 阿里云RDS和OSS
|
||||
|
||||
查看云服务组件参数:
|
||||
|
||||
```shell
|
||||
kubectl vela show alibaba-rds
|
||||
```
|
||||
```console
|
||||
# Properties
|
||||
+---------------+------------------------------------------------+--------+----------+--------------------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+---------------+------------------------------------------------+--------+----------+--------------------+
|
||||
| engine | RDS engine | string | true | mysql |
|
||||
| engineVersion | The version of RDS engine | string | true | 8.0 |
|
||||
| instanceClass | The instance class for the RDS | string | true | rds.mysql.c1.large |
|
||||
| username | RDS username | string | true | |
|
||||
| secretName | Secret name which RDS connection will write to | string | true | |
|
||||
+---------------+------------------------------------------------+--------+----------+--------------------+
|
||||
```
|
||||
示例应用程序如下。
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: webapp
|
||||
spec:
|
||||
components:
|
||||
- name: express-server
|
||||
type: webservice
|
||||
properties:
|
||||
image: zzxwill/flask-web-application:v0.3.1-crossplane
|
||||
ports: 80
|
||||
traits:
|
||||
- type: service-binding
|
||||
properties:
|
||||
envMappings:
|
||||
# environments refer to db-conn secret
|
||||
DB_PASSWORD:
|
||||
secret: db-conn
|
||||
key: password # 1) If the env name is different from secret key, secret key has to be set.
|
||||
endpoint:
|
||||
secret: db-conn # 2) If the env name is the same as the secret key, secret key can be omitted.
|
||||
username:
|
||||
secret: db-conn
|
||||
# environments refer to oss-conn secret
|
||||
BUCKET_NAME:
|
||||
secret: oss-conn
|
||||
key: Bucket
|
||||
|
||||
- name: sample-db
|
||||
type: alibaba-rds
|
||||
properties:
|
||||
name: sample-db
|
||||
engine: mysql
|
||||
engineVersion: "8.0"
|
||||
instanceClass: rds.mysql.c1.large
|
||||
username: oamtest
|
||||
secretName: db-conn
|
||||
|
||||
- name: sample-oss
|
||||
type: alibaba-oss
|
||||
properties:
|
||||
name: velaweb
|
||||
secretName: oss-conn
|
||||
```
|
||||
|
||||
## 验证
|
||||
|
||||
部署并验证应用程序(通过任一提供商都可以)。
|
||||
|
||||
```shell
|
||||
kubectl get application
|
||||
```
|
||||
```console
|
||||
NAME AGE
|
||||
webapp 46m
|
||||
```
|
||||
```shell
|
||||
kubectl port-forward deployment/express-server 80:80
|
||||
```
|
||||
```console
|
||||
Forwarding from 127.0.0.1:80 -> 80
|
||||
Forwarding from [::1]:80 -> 80
|
||||
Handling connection for 80
|
||||
Handling connection for 80
|
||||
```
|
||||
|
||||

|
||||
```
|
||||
|
|
@ -1,5 +1,34 @@
|
|||
---
|
||||
title: Cue 组件
|
||||
title: CUE 组件
|
||||
---
|
||||
|
||||
TBD
|
||||
作为用户的你,一定希望随时可以找到开箱即用的组件,同时如果没有找到满足需求的组件,又可以灵活地自定义你想要的组件。
|
||||
|
||||
KubeVela 通过强大的 CUE 配置语言去粘合开源社区里的所有相关能力。我们给你提供了一些开箱即用的组件能力,也为你们的平台管理员,开放了灵活的自定义组件开发方式。
|
||||
|
||||
可以先使用指令看看我们已经通过 CUE 内置的组件能力:
|
||||
|
||||
```
|
||||
$ vela components
|
||||
NAME NAMESPACE WORKLOAD DESCRIPTION
|
||||
alibaba-rds default configurations.terraform.core.oam.dev Terraform configuration for Alibaba Cloud RDS object
|
||||
stateless default deployments.apps description not defined
|
||||
task default jobs.batch Describes jobs that run code or a script to completion.
|
||||
webserver default deployments.apps webserver is a combo of Deployment + Service
|
||||
helm vela-system autodetects.core.oam.dev helm release is a group of K8s resources from either git
|
||||
repository or helm repo
|
||||
kustomize vela-system autodetects.core.oam.dev kustomize can fetching, building, updating and applying
|
||||
Kustomize manifests from git repo.
|
||||
raw vela-system autodetects.core.oam.dev raw allow users to specify raw K8s object in properties
|
||||
task vela-system jobs.batch Describes jobs that run code or a script to completion.
|
||||
webservice vela-system deployments.apps Describes long-running, scalable, containerized services
|
||||
that have a stable network endpoint to receive external
|
||||
network traffic from customers.
|
||||
worker vela-system deployments.apps Describes long-running, scalable, containerized services
|
||||
that running at backend. They do NOT have network endpoint
|
||||
to receive external network traffic.
|
||||
```
|
||||
|
||||
你所看到,在 vela-system 命令空间下的 webservice、task 和 worker 等组件类型,都是通过 CUE 模版来内置的。
|
||||
|
||||
在你想要通过自定义组件来满足需求的时候,可以自己查看管理员手册里的[自定义组件](../../platform-engineers/components/custom-component)进行开发,或者请求你们的平台管理员进行开发。
|
||||
|
|
@ -4,51 +4,6 @@ title: 环境差异化配置
|
|||
|
||||
本章节会介绍,如何使用环境差异化配置(env-binding)为应用提供差异化配置和环境调度策略。
|
||||
|
||||
## 属性
|
||||
|
||||
环境差异化配置应用策略的所有配置项
|
||||
|
||||
名称 | 描述 | 类型 | 是否必须 | 默认值
|
||||
:---------- | :----------- | :----------- | :----------- | :-----------
|
||||
engine|集群管理方案,可选值 local (单集群部署)、ocm|string|否|当该字段为空时,默认认为用户使用 ocm 多集群管理方案
|
||||
envs|环境差异化配置| env 数组|是|无
|
||||
created|是否创建差异化配置后的资源| bool |否|ture,默认创建差异化配置后的资源
|
||||
|
||||
env 的属性
|
||||
|
||||
名称 | 描述 | 类型 | 是否必须 | 默认值
|
||||
:----------- | :------------ | :------------ | :------------ | :------------
|
||||
name|环境配置名称|string|是|无
|
||||
patch|对应用部署计划进行差异化配置|patch 结构体|是|无
|
||||
placement|资源调度策略,选择将配置化的资源部署到指定的集群上| placement 结构体|是|无
|
||||
|
||||
patch 的属性
|
||||
|
||||
名称 | 描述 | 类型 | 是否必须 | 默认值
|
||||
:----------- | :------------ | :------------ | :------------ | :------------
|
||||
components|对应用部署计划中的组件差异化配置| component 数组|是|无
|
||||
|
||||
placement 的属性
|
||||
|
||||
名称 | 描述 | 类型 | 是否必须 | 默认值
|
||||
:----------- | :------------ | :------------ | :------------ | :------------
|
||||
clusterSelector|集群选择器,通过标签或者名称筛选集群| clusterSelector 结构体|是|无
|
||||
namespaceSelector|命名空间选择器,通过标签或者名称筛选命名空间| namespaceSelector 结构体|是|无
|
||||
|
||||
clusterSelector 的属性 (该属性只在 engine 为 ocm 时候有效)
|
||||
|
||||
名称 | 描述 | 类型 | 是否必须 | 默认值
|
||||
:----------- | :------------ | :------------ | :------------ | :------------
|
||||
labels |集群标签| map[string]string |否|无
|
||||
name |集群名称| string |否|无
|
||||
|
||||
namespaceSelector 的属性 (该属性只在 engine 为 local 时候有效)
|
||||
|
||||
名称 | 描述 | 类型 | 是否必须 | 默认值
|
||||
:----------- | :------------ | :------------ | :------------ | :------------
|
||||
labels |命名空间的标签| map[string]string |否|无
|
||||
name |命名空间的名称| string |否|无
|
||||
|
||||
## 背景
|
||||
|
||||
用户在日常开发中会经常将应用部署计划(Application)部署到不同的环境。例如,在开发环境中对应用部署计划进行调试,在生产环境中部署应用部署计划对外提供服务。
|
||||
|
|
@ -120,4 +75,49 @@ NAME COMPONENT TYPE PHASE HEALTHY STATU
|
|||
patch-test-workflow-demo nginx-server webservice running true 22s
|
||||
```
|
||||
|
||||
如果你想使用 `env-binding` 在多集群环境下创建应用部署计划,请参考实践案例中的 **[多集群部署](../../case-studies/workflow-with-ocm)** 。
|
||||
如果你想使用 `env-binding` 在多集群环境下创建应用部署计划,请参考实践案例中的 **[多集群部署](../../case-studies/workflow-with-ocm)** 。
|
||||
|
||||
## 附录:属性列表
|
||||
|
||||
环境差异化配置应用策略的所有配置项
|
||||
|
||||
名称 | 描述 | 类型 | 是否必须 | 默认值
|
||||
:---------- | :----------- | :----------- | :----------- | :-----------
|
||||
engine|集群管理方案,可选值 local (单集群部署)、ocm|string|否|当该字段为空时,默认认为用户使用 ocm 多集群管理方案
|
||||
envs|环境差异化配置| env 数组|是|无
|
||||
created|是否创建差异化配置后的资源| bool |否|ture,默认创建差异化配置后的资源
|
||||
|
||||
env 的属性
|
||||
|
||||
名称 | 描述 | 类型 | 是否必须 | 默认值
|
||||
:----------- | :------------ | :------------ | :------------ | :------------
|
||||
name|环境配置名称|string|是|无
|
||||
patch|对应用部署计划进行差异化配置|patch 结构体|是|无
|
||||
placement|资源调度策略,选择将配置化的资源部署到指定的集群上| placement 结构体|是|无
|
||||
|
||||
patch 的属性
|
||||
|
||||
名称 | 描述 | 类型 | 是否必须 | 默认值
|
||||
:----------- | :------------ | :------------ | :------------ | :------------
|
||||
components|对应用部署计划中的组件差异化配置| component 数组|是|无
|
||||
|
||||
placement 的属性
|
||||
|
||||
名称 | 描述 | 类型 | 是否必须 | 默认值
|
||||
:----------- | :------------ | :------------ | :------------ | :------------
|
||||
clusterSelector|集群选择器,通过标签或者名称筛选集群| clusterSelector 结构体|是|无
|
||||
namespaceSelector|命名空间选择器,通过标签或者名称筛选命名空间| namespaceSelector 结构体|是|无
|
||||
|
||||
clusterSelector 的属性 (该属性只在 engine 为 ocm 时候有效)
|
||||
|
||||
名称 | 描述 | 类型 | 是否必须 | 默认值
|
||||
:----------- | :------------ | :------------ | :------------ | :------------
|
||||
labels |集群标签| map[string]string |否|无
|
||||
name |集群名称| string |否|无
|
||||
|
||||
namespaceSelector 的属性 (该属性只在 engine 为 local 时候有效)
|
||||
|
||||
名称 | 描述 | 类型 | 是否必须 | 默认值
|
||||
:----------- | :------------ | :------------ | :------------ | :------------
|
||||
labels |命名空间的标签| map[string]string |否|无
|
||||
name |命名空间的名称| string |否|无
|
||||
67
sidebars.js
67
sidebars.js
|
|
@ -25,36 +25,24 @@ module.exports = {
|
|||
label: 'End User Guide',
|
||||
collapsed: false,
|
||||
items: [
|
||||
'end-user/initializer-end-user',
|
||||
{
|
||||
'Workflow': [
|
||||
'end-user/workflow/apply-component',
|
||||
'end-user/workflow/apply-remaining',
|
||||
'end-user/workflow/multi-env',
|
||||
]
|
||||
},
|
||||
// 'end-user/initializer-end-user',
|
||||
{
|
||||
'Components': [
|
||||
'end-user/components/helm',
|
||||
'end-user/components/kustomize',
|
||||
{
|
||||
'CUE': [
|
||||
'end-user/components/cue/webservice',
|
||||
'end-user/components/cue/task',
|
||||
'end-user/components/cue/worker',
|
||||
]
|
||||
},
|
||||
{
|
||||
'Cloud Services': [
|
||||
{
|
||||
'Terraform': [
|
||||
'end-user/components/cloud-services/terraform/sls',
|
||||
'end-user/components/cloud-services/terraform/rds',
|
||||
]
|
||||
},
|
||||
'end-user/components/cloud-services/alibaba-ros',
|
||||
]
|
||||
},
|
||||
'end-user/components/cue',
|
||||
'end-user/components/cloud-services',
|
||||
// {
|
||||
// 'Cloud Services': [
|
||||
// {
|
||||
// 'Terraform': [
|
||||
// 'end-user/components/cloud-services/terraform/sls',
|
||||
// 'end-user/components/cloud-services/terraform/rds',
|
||||
// ]
|
||||
// },
|
||||
// 'end-user/components/cloud-services/alibaba-ros',
|
||||
// ]
|
||||
// },
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -81,6 +69,13 @@ module.exports = {
|
|||
'end-user/policies/envbinding',
|
||||
]
|
||||
},
|
||||
{
|
||||
'Workflow': [
|
||||
'end-user/workflow/apply-component',
|
||||
'end-user/workflow/apply-remaining',
|
||||
'end-user/workflow/multi-env',
|
||||
]
|
||||
},
|
||||
{
|
||||
'Addons': [
|
||||
'end-user/addons/introduction',
|
||||
|
|
@ -101,7 +96,7 @@ module.exports = {
|
|||
label: 'Case Studies',
|
||||
collapsed: false,
|
||||
items: [
|
||||
'case-studies/workflow-edge-computing', // 待完成
|
||||
// 'case-studies/workflow-edge-computing', // 待完成
|
||||
'case-studies/li-auto-inc',
|
||||
'case-studies/workflow-with-ocm',
|
||||
],
|
||||
|
|
@ -131,14 +126,6 @@ module.exports = {
|
|||
'platform-engineers/initializer/basic-initializer',
|
||||
]
|
||||
},
|
||||
{
|
||||
'Worfklow System': [
|
||||
'platform-engineers/workflow/steps',
|
||||
'platform-engineers/workflow/context',
|
||||
'platform-engineers/workflow/data-flow',
|
||||
'platform-engineers/workflow/cue-actions',
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'category',
|
||||
label: 'Component System',
|
||||
|
|
@ -157,7 +144,14 @@ module.exports = {
|
|||
'platform-engineers/traits/advanced',
|
||||
]
|
||||
},
|
||||
'platform-engineers/advanced-install',
|
||||
{
|
||||
'Worfklow System': [
|
||||
'platform-engineers/workflow/steps',
|
||||
'platform-engineers/workflow/context',
|
||||
'platform-engineers/workflow/data-flow',
|
||||
'platform-engineers/workflow/cue-actions',
|
||||
]
|
||||
},
|
||||
{
|
||||
'Debugging': [
|
||||
'platform-engineers/debug/dry-run',
|
||||
|
|
@ -191,6 +185,7 @@ module.exports = {
|
|||
type: 'category',
|
||||
label: 'References',
|
||||
items: [
|
||||
'platform-engineers/advanced-install',
|
||||
{
|
||||
type: 'category',
|
||||
label: 'CLI',
|
||||
|
|
|
|||
Loading…
Reference in New Issue