operator-sdk是operator framework的一部分,是一个致力于简化整个opearator creation的整个过程的一个社区项目。有了operator-sdk,我们只需要在control loop里面写定制的operational逻辑就可以了。
三种operator SDK supports:
类型 | 生成的objects | 你需要做 |
---|
Go Operator |
- General go program structure
- Boilerplate code to talk to the Kubernetes API
- Boilerplate code to watch for Kubernetes objects of interest
- An entry point to the reconciliation loop
- An example YAML files based on CRDs
|
- Custom objects via CRDs
- Control loop logic in Go
- Potentially artistic stunts only possible by talking directly to the API from Go
|
Ansible Operator |
- A Go program that runs an Ansible playbook or role every time a certain type of object is detected / modified
|
- Ansible playbook or role
- Custom objects via CRD
|
Helm Operator |
- A custom object via CRD containing the same properties as the chart's values.yaml
- A Go program that reads a helm chart and deploys all its resources
- Watch statements to detect changes in the custom objects specification, re-deploying all resources with updated values
|
- The location / repository of the helm chart
|
其中, go和ansible operator已经非常成熟了,可以支持所有的操作,但是helm operator还不成熟,只能支持简单的安装和升级。