File tree Expand file tree Collapse file tree 2 files changed +37
-2
lines changed
Expand file tree Collapse file tree 2 files changed +37
-2
lines changed Original file line number Diff line number Diff line change 243243* [ 开发指南概览] ( develop/index.md )
244244* [ SIG和工作组] ( develop/sigs-and-working-group.md )
245245* [ 开发环境搭建] ( develop/developing-environment.md )
246- * [ 本地分布式开发环境搭建(使用Vagrant和Virtualbox)] ( develop/using-vagrant-and-virtualbox-for-development.md )
246+ * [ 本地分布式开发环境搭建(使用Vagrant和Virtualbox)] ( develop/using-vagrant-and-virtualbox-for-development.md )
247247* [ 单元测试和集成测试] ( develop/testing.md )
248248* [ client-go示例] ( develop/client-go-sample.md )
249249* [ Operator] ( develop/operator.md )
250- * [ operator-sdk] ( develop/operator-sdk.md )
250+ * [ operator-sdk] ( develop/operator-sdk.md )
251+ * [ kubebuilder] ( develop/kubebuilder.md )
251252* [ 高级开发指南] ( develop/advance-developer.md )
252253* [ 社区贡献] ( develop/contribute.md )
253254* [ Minikube] ( develop/minikube.md )
Original file line number Diff line number Diff line change 1+ # Kubebuilder
2+
3+ Kubebuilder 是一个基于 [ CRD] ( ../concepts/crd.md ) 来构建 Kubernetes API 的框架,可以使用 CRD 来构建 API、Controller 和 Admission Webhook。
4+
5+ 请参考 [ Kubebuilder quick start] ( https://book.kubebuilder.io/quick_start.html ) 来安装 kubebuilder。
6+
7+ ## 动机
8+
9+ 目前扩展 Kubernetes 的 API 的方式有创建 [ CRD] ( ../concepts/crd.md ) 、使用 [ Operator] ( operator.md ) SDK 等方式,都需要写很多的样本文件(boilerplate),使用起来十分麻烦。为了能够更方便构建 Kubernetes API 和工具,就需要一款能够事半功倍的工具,与其他 Kubernetes API 扩展方案相比,kubebuilder 更加简单易用,并获得了社区的广泛支持。
10+
11+ ## 工作流程
12+
13+ Kubebuilder 的工作流程如下:
14+
15+ 1 . 创建一个新的工程目录
16+ 2 . 创建一个或多个资源 API CRD 然后将字段添加到资源
17+ 3 . 在控制器中实现协调循环(reconcile loop),watch 额外的资源
18+ 4 . 在集群中运行测试(自动安装 CRD 并自动启动控制器)
19+ 5 . 更新引导集成测试测试新字段和业务逻辑
20+ 6 . 使用用户提供的 Dockerfile 构建和发布容器
21+
22+ ## 设计哲学
23+
24+ Kubebuilder 提供基于简洁的精心设计的示例 godoc 来提供整洁的库抽象。
25+
26+ - 能使用 go 接口和库,就不使用代码生成
27+ - 能使用代码生成,就不用使用多于一次的存根初始化
28+ - 能使用一次存根,就不 fork 和修改 boilerplate
29+ - 绝不 fork 和修改 boilerplate
30+
31+ ## 参考
32+
33+ - [ Kubebuilder quick start - book.kubebuilder.io] ( https://book.kubebuilder.io/quick_start.html )
34+ - [ kubebuilder - github.com] ( https://github.com/kubernetes-sigs/kubebuilder/ )
You can’t perform that action at this time.
0 commit comments