Merge pull request #145 from BinaryHB0916/add-core-concerps-application

adding core concerpts of application
This commit is contained in:
Wei (段少) 2021-08-06 15:19:03 +08:00 committed by GitHub
commit 2185340b5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 123 additions and 7 deletions

View File

@ -0,0 +1,5 @@
---
title: Cue Component
---
TBD

View File

@ -0,0 +1,5 @@
---
title: Rollout
---
TBD

View File

@ -2,3 +2,102 @@
title: 应用部署计划
---
KubeVela 将 Application 应用程序作为建模的基础,使用 Components 组件和 Traits 运维特征,完成一整套的应用部署计划。在熟悉这些核心概念后,你可以根据需求,对应按照 [用户手册](../end-user/initializer-end-user) 和 [管理员手册](../platform-engineers/advanced-install.mdx) 进行开发。
### Application 应用程序
在技术建模中YAML 文件是应用部署计划的承载。一个典型的 YAML 样例如下:
```
# sample.yaml
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: website
spec:
components:
- name: frontend # This is the component I want to deploy
type: webservice
properties:
image: nginx
traits:
- type: cpuscaler # Automatically scale the component by CPU usage after deployed
properties:
min: 1
max: 10
cpuPercent: 60
- type: sidecar # Inject a fluentd sidecar before applying the component to runtime cluster
properties:
name: "sidecar-test"
image: "fluentd"
- name: backend
type: worker
properties:
image: busybox
cmd:
- sleep
- '1000'
```
这里的字段对应着:
- `apiVersion`:所使用的 OAM API 版本。
- `kind`:种类。我们最经常用到的就是 Pod 了。
- `metadata`:业务相关信息。比如这次要创建的是一个网站。
- `Spec`:描述我们需要应用去交付什么,告诉 Kubernetes 做成什么样。这里我们放入 KubeVela 的 `components`
- `components`KubeVela 的组件系统。
- `traits`KubeVela 的运维特征系统。
下面这张示意图诠释了它们之间的关系:
![image.png](../resources/concepts.png)
先有一个应用程序 Application。在此基础之上我们申明应用主体为可配置、可部署的组件 Components并同时对应地去申明期望每个组件要拥有的相关运维特征 Traits。
你使用 KubeVela 的时候,就像在玩“乐高“积木:先拿起一块大的“应用程序”,然后往上固定一块或几块“组件”,组件上又可以贴上任何颜色大小的“运维特征”。同时根据需求的变化,你随时可以重新组装,形成新的应用部署计划。
### Components 组件
KubeVela 内置了常用的组件类型,使用 [KubeVela CLI](../getting-started/quick-install.mdx##3) 命令查看:
```
vela components
```
返回结果:
```
NAME NAMESPACE WORKLOAD DESCRIPTION
alibaba-rds default configurations.terraform.core.oam.dev Terraform configuration for Alibaba Cloud RDS object
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.
```
作为用户的你,可以继续使用 [CUE 组件](../end-user/components/cue)、[Helm 组件](../end-user/components/helm)、[Kustomize 组件](../end-user/components/kustomize)和[云服务组件](../end-user/components/cloud-services/terraform/rds)来实现你需要的任何组件类型。
同时作为管理员的你,也可以使用 [自定义组件](../platform-engineers/components/component-cue)、[Terraform 组件](../platform-engineers/components/component-terraform) 来自定义你的用户所需要的任何组件类型。
### Traits 运维特征
KubeVela 也内置了常用的运维特征类型,使用 [KubeVela CLI](../getting-started/quick-install.mdx##3) 命令查看:
```
vela traits
```
返回结果:
```
NAME NAMESPACE APPLIES-TO CONFLICTS-WITH POD-DISRUPTIVE DESCRIPTION
annotations vela-system deployments.apps true Add annotations for your Workload.
cpuscaler vela-system webservice,worker false Automatically scale the component based on CPU usage.
ingress vela-system webservice,worker false Enable public web traffic for the component.
labels vela-system deployments.apps true Add labels for your Workload.
scaler vela-system webservice,worker false Manually scale the component.
sidecar vela-system deployments.apps true Inject a sidecar container to the component.
```
作为用户的你,可以继续阅读用户手册里的 [挂载运维特征](../end-user/traits/ingress) ,具体查看如何完成各种运维特征的开发。
同时作为管理员的你,也可以继续使用 [自定义运维特征](../platform-engineers/traits/trait) 为你的用户,自定义任何需要的运维特征类型。
## 下一步
在理解了应用部署计划这套核心概念后,你可以进一步阅读关于 Workflow 交付工作流的概念。

View File

@ -0,0 +1,5 @@
---
title: Cue 组件
---
TBD

View File

@ -1,5 +0,0 @@
---
title: 默认组件
---
TBD

View File

@ -0,0 +1,5 @@
---
title: 滚动更新
---
TBD

View File

@ -54,7 +54,7 @@ status:
`Sepc` 字段里,我们也看到比如 `components``traits` 这样陌生的字段。
在下一章节中,我们将带你进一步深入它们背后 KubeVlea 的核心概念:应用程序、组件系统和特征系统。
在下一章节中,我们将带你进一步深入它们背后 KubeVela 的核心概念:应用程序、组件系统和运维特征系统。
同时,在底层的 K8s 资源也被创建了出来:
@ -91,7 +91,7 @@ Hello World
```
**太棒了!** 你已经全都部署成功了。
也就是说 KubeVlea 的应用交付,围绕 Application、Components 和 Traits 这三个核心概念展开
也就是说 KubeVlea 的应用交付,围绕应用程序、组件系统和运维特征系统这一整套应用部署计划的核心概念展开,同时通过 Workflow 工作流、CUE 粘合开源生态等进行场景和能力的按需扩展,达成跨云、标准和统一的交付目标
## 下一步

View File

@ -28,6 +28,7 @@ module.exports = {
'end-user/initializer-end-user',
{
'Components': [
'end-user/components/cue',
'end-user/components/helm',
'end-user/components/kustomize',
{
@ -69,6 +70,7 @@ module.exports = {
'end-user/traits/annotations-and-labels',
'end-user/traits/sidecar',
'end-user/traits/metrics',
'end-user/traits/rollout',
]
},
{