Documentation ¶
Index ¶
- Constants
- func GetCredentials(k8s kubernetes.Interface, ref *v1.SecretReference) (map[string]string, error)
- func GetSecretReference(snapshotClassParams map[string]string, snapContentName string, ...) (*v1.SecretReference, error)
- func GetSnapshotContentNameForSnapshot(snapshot *crdv1.VolumeSnapshot) string
- func IsDefaultAnnotation(obj metav1.ObjectMeta) bool
- func IsSnapshotBound(snapshot *crdv1.VolumeSnapshot, content *crdv1.VolumeSnapshotContent) bool
- func NewCSISnapshotController(clientset clientset.Interface, client kubernetes.Interface, ...) *csiSnapshotController
- func NoResyncPeriodFunc() time.Duration
- type Handler
Constants ¶
const IsDefaultSnapshotClassAnnotation = "snapshot.storage.kubernetes.io/is-default-class"
Variables ¶
This section is empty.
Functions ¶
func GetCredentials ¶
func GetCredentials(k8s kubernetes.Interface, ref *v1.SecretReference) (map[string]string, error)
GetCredentials retrieves credentials stored in v1.SecretReference
func GetSecretReference ¶
func GetSecretReference(snapshotClassParams map[string]string, snapContentName string, snapshot *crdv1.VolumeSnapshot) (*v1.SecretReference, error)
GetSecretReference returns a reference to the secret specified in the given nameKey and namespaceKey parameters, or an error if the parameters are not specified correctly. if neither the name or namespace parameter are set, a nil reference and no error is returned. no lookup of the referenced secret is performed, and the secret may or may not exist.
supported tokens for name resolution: - ${volumesnapshotcontent.name} - ${volumesnapshot.namespace} - ${volumesnapshot.name} - ${volumesnapshot.annotations['ANNOTATION_KEY']} (e.g. ${pvc.annotations['example.com/snapshot-create-secret-name']})
supported tokens for namespace resolution: - ${volumesnapshotcontent.name} - ${volumesnapshot.namespace}
an error is returned in the following situations: - only one of name or namespace is provided - the name or namespace parameter contains a token that cannot be resolved - the resolved name is not a valid secret name - the resolved namespace is not a valid namespace name
func GetSnapshotContentNameForSnapshot ¶
func GetSnapshotContentNameForSnapshot(snapshot *crdv1.VolumeSnapshot) string
GetSnapshotContentNameForSnapshot returns SnapshotContent.Name for the create VolumeSnapshotContent. The name must be unique.
func IsDefaultAnnotation ¶
func IsDefaultAnnotation(obj metav1.ObjectMeta) bool
IsDefaultAnnotation returns a boolean if the annotation is set
func IsSnapshotBound ¶
func IsSnapshotBound(snapshot *crdv1.VolumeSnapshot, content *crdv1.VolumeSnapshotContent) bool
func NewCSISnapshotController ¶
func NewCSISnapshotController( clientset clientset.Interface, client kubernetes.Interface, snapshotterName string, volumeSnapshotInformer storageinformers.VolumeSnapshotInformer, volumeSnapshotContentInformer storageinformers.VolumeSnapshotContentInformer, volumeSnapshotClassInformer storageinformers.VolumeSnapshotClassInformer, createSnapshotContentRetryCount int, createSnapshotContentInterval time.Duration, conn connection.CSIConnection, timeout time.Duration, resyncPeriod time.Duration, snapshotNamePrefix string, snapshotNameUUIDLength int, ) *csiSnapshotController
NewCSISnapshotController returns a new *csiSnapshotController
func NoResyncPeriodFunc ¶
Returns 0 for resyncPeriod in case resyncing is not needed.
Types ¶
type Handler ¶
type Handler interface { CreateSnapshot(snapshot *crdv1.VolumeSnapshot, volume *v1.PersistentVolume, parameters map[string]string, snapshotterCredentials map[string]string) (string, string, int64, int64, *csi.SnapshotStatus, error) DeleteSnapshot(content *crdv1.VolumeSnapshotContent, snapshotterCredentials map[string]string) error GetSnapshotStatus(content *crdv1.VolumeSnapshotContent) (*csi.SnapshotStatus, int64, int64, error) }
Handler is responsible for handling VolumeSnapshot events from informer.
func NewCSIHandler ¶
func NewCSIHandler( csiConnection connection.CSIConnection, timeout time.Duration, snapshotNamePrefix string, snapshotNameUUIDLength int, ) Handler