operator sdk v0.x和v1.x的区别
operator sdk和kubebuilder整合后(以kubebuilder为主),operator sdk发布了v1.x版本,operator sdk的项目layout、scaffold、dependency、 usage、code等发生了变化
- 底层相似:under the hood using controller-runtime、controller-tools to adding a manager, api scheme and creates an structs implements a reconciler interface
- 整合项目:https://github.com/kubernetes-sigs/kubebuilder/projects/7, 2019年7月25日开始,2020年11月7日关闭了
- 未来规划:operator-sdk commit参与kubebuilder的开发维护;文档会将基于go的operator文档集成到kubebuilder文档,未来共同维护kubebuilder文档的更新
| operator-sdk | kubebuilder |
---|
project | part of operator-framework,coreos开发维护 | one of the kubernetes-sigs |
commits | most are google, redhat | most are redhat |
integration | The operator-sdk has better integration with helm, and having better integration with the operator-framework ecosystem | the kuebuilder integrates with existing kubernetes-sigs projects |
版本主要变化
主要参考链接:https://sdk.operatorframework.io/docs/building-operators/golang/migration/
- new layout:operator-sdk在向kubebuilder的layout靠拢
- scaffold:新增kustomize、kube-auth-proxy、envtest等
- dependency
- kubebuilder go CLI v2 to v3(operator-sdk v1.2对应kubebuilder v2; operator-sdk v1.4对应kubebuilder v3)
- The minimum Go version is now 1.15
- controller-runtime to v0.8.0(https://master.book.kubebuilder.io/migration/v2vsv3.html
- controller-tools to v0.4.1
- 新增:因为operator metrics需要kustomize ,Support for kustomize v3.8.7
- operator-lib v0.4.0 ,because of controller-runtime v0.8.0
- kubernetes:最高支持版本v1.19,低版本也支持(https://github.com/operator-framework/operator-sdk/releases/tag/v1.3.0)
- command
- operator-sdk generate crds is replaced with make manifests, which generates CRDs and RBAC rules.
- operator-sdk build is replaced with make docker-build IMG=/:tag
- …等
- code:func、interface等发生变化