nfs-client-provisioner源码分析
1. Dynamic Provisioner
1.1. Provisioner Interface
// Provisioner is an interface that creates templates for PersistentVolumes
// and can create the volume as a new resource in the infrastructure provider.
// It can also remove the volume it created from the underlying storage
// provider.
type Provisioner interface {
// Provision creates a volume i.e. the storage asset and returns a PV object
// for the volume
Provision(VolumeOptions) (*v1.PersistentVolume, error)
// Delete removes the storage asset that was created by Provision backing the
// given PV. Does not delete the PV object itself.
//
// May return IgnoredError to indicate that the call has been ignored and no
// action taken.
Delete(*v1.PersistentVolume) error
}1.2. VolumeOptions
1.3. ProvisionController
1.4. 开发provisioner的步骤
2. NFS Client Provisioner
2.1. Main函数
2.1.1. 读取环境变量
2.1.2. 获取clientset对象
2.1.3. 构造nfsProvisioner对象
2.1.4. 构建并运行ProvisionController
2.2.1. Provision方法
2.2.2. Delete方法
3.1. ProvisionController结构体
3.1.1. 入参
3.1.2. Controller和Informer
3.1.3. workqueue
3.1.4. 其他
3.2. NewProvisionController方法
3.2.1. 初始化默认值
3.2.2. 初始化任务队列
3.2.3. ListWatch
3.2.4. ResourceEventHandlerFuncs
3.2.5. 构造Store和Controller
3.3. ProvisionController.Run方法
3.3.1. prometheus数据收集
3.3.2. Controller.Run
3.3.3. Worker
3.4. Operation
3.4.1. provisionClaimOperation
3.4.2. deleteVolumeOperation
4. 总结
最后更新于