generator

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

README

负责本地盘的创建、删除操作:通过在每个节点上启动agent,并watch PVC、PV,通过label来实现与provisioner之间的协作;

优点:复用K8S网络,而不依赖集群端口和网络,在边缘、混合云等场景下无缝衔接;

缺点:集群非常大时,由于每个节点都需要watch pvc、pv,会产生大量长连接;

创建过程:跟踪PVC

  1. 添加PVC Annotations:

    provisioner 给pvc添加Annotations:pv.csi.alibabacloud.com/volume.lifecycle为creating:

  2. nodeServer跟踪PVC的标签:pv.csi.alibabacloud.com/volume.lifecycle为creating时:

    查看pv.csi.alibabacloud.com/volume.spec,拿到创建lvm所需的配置信息;

  3. 创建LVM卷;

  4. 创建成功后更新PVC Annotations: pv.csi.alibabacloud.com/volume.lifecycle 为created;

创建流程结束;

删除过程:跟踪PV

  1. Provisioner为PV添加Annotations:pv.csi.alibabacloud.com/volume.lifecycle为deleting:

  2. nodeServer跟踪PV的Annotations:pv.csi.alibabacloud.com/volume.lifecycle 为deleting时:

    查看PV的Annotations:pv.csi.alibabacloud.com/volume.spec,拿到删除lvm所需的信息;

  3. 删除LVM卷;

  4. 成功后更新PV Annotations: pv.csi.alibabacloud.com/volume.lifecycle 为deleted;

删除流程结束;

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ActualStateOfPv = ActualStateOfWordPv{}

ActualStateOfPv actual pv

View Source
var ActualStateOfPvc = ActualStateOfWordPvc{}

ActualStateOfPvc record actual pvc

View Source
var DesiredStateOfPv = DesiredStateOfWordPv{}

DesiredStateOfPv desired pv

View Source
var DesiredStateOfPvc = DesiredStateOfWordPvc{}

DesiredStateOfPvc record desired pvc

Functions

func CreateVolumeWithAnnotations added in v1.1.1

func CreateVolumeWithAnnotations(namespace, pvcName string, annotations map[string]string) error

CreateVolumeWithAnnotations create volume

func DeleteVolumeWithAnnotations added in v1.1.1

func DeleteVolumeWithAnnotations(pvName string, annotations map[string]string) error

DeleteVolumeWithAnnotations delete volume

func SetupSignalHandlerPV

func SetupSignalHandlerPV() (stopCh <-chan struct{})

SetupSignalHandlerPV set signal handler

func SetupSignalHandlerPVC

func SetupSignalHandlerPVC() (stopCh <-chan struct{})

SetupSignalHandlerPVC registered for SIGTERM and SIGINT. A stop channel is returned which is closed on one of these signals. If a second signal is caught, the program is terminated with exit code 1.

func UpdatePvWithAnnotations added in v1.1.1

func UpdatePvWithAnnotations(ctx context.Context, pvName string, annotations map[string]string) error

UpdatePvWithAnnotations udpate pv

func UpdatePvcWithAnnotations added in v1.1.1

func UpdatePvcWithAnnotations(ctx context.Context, namespace, pvcName string, annotations map[string]string) error

UpdatePvcWithAnnotations update pvc

func VolumeHandler

func VolumeHandler()

VolumeHandler watch pv/pvc

Types

type ActualStateOfWordPv

type ActualStateOfWordPv struct {
	ActualPvMap map[string]*corev1.PersistentVolume
	sync.RWMutex
}

ActualStateOfWordPv save the actual state of volume in node.

func (*ActualStateOfWordPv) Add

Add pv object

func (*ActualStateOfWordPv) Remove

func (dsw *ActualStateOfWordPv) Remove(pv *corev1.PersistentVolume)

Remove pv object

type ActualStateOfWordPvc

type ActualStateOfWordPvc struct {
	ActualPvcMap map[string]*corev1.PersistentVolumeClaim
	sync.RWMutex
}

ActualStateOfWordPvc the actual pvc state

func (*ActualStateOfWordPvc) Add

Add object

func (*ActualStateOfWordPvc) Remove

Remove object

type DesiredStateOfWordPv

type DesiredStateOfWordPv struct {
	DesiredPvMap map[string]*corev1.PersistentVolume
	sync.RWMutex
}

DesiredStateOfWordPv desired pv

func (*DesiredStateOfWordPv) Add

Add add pv

func (*DesiredStateOfWordPv) Remove

func (dsw *DesiredStateOfWordPv) Remove(pv *corev1.PersistentVolume)

Remove remove pv

type DesiredStateOfWordPvc

type DesiredStateOfWordPvc struct {
	DesiredPvcMap map[string]*corev1.PersistentVolumeClaim
	sync.RWMutex
}

DesiredStateOfWordPvc the desired pvc state

func (*DesiredStateOfWordPvc) Add

Add object

func (*DesiredStateOfWordPvc) Remove

Remove object

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL