Documentation ¶
Index ¶
- Constants
- Variables
- func ContainsString(slice []string, s string) bool
- func GetCredentials(k8s kubernetes.Interface, ref *v1.SecretReference) (map[string]string, error)
- func GetDynamicSnapshotContentNameForGroupSnapshot(groupSnapshot *crdv1alpha1.VolumeGroupSnapshot) string
- func GetDynamicSnapshotContentNameForSnapshot(snapshot *crdv1.VolumeSnapshot) string
- func GetSecretReference(secretParams secretParamsMap, snapshotClassParams map[string]string, ...) (*v1.SecretReference, error)
- func GetSnapshotStatusForLogging(snapshot *crdv1.VolumeSnapshot) string
- func GroupSnapshotKey(vgs *crdv1alpha1.VolumeGroupSnapshot) string
- func GroupSnapshotRefKey(vgsref *v1.ObjectReference) string
- func IsBoundVolumeGroupSnapshotContentNameSet(groupSnapshot *crdv1alpha1.VolumeGroupSnapshot) bool
- func IsBoundVolumeSnapshotContentNameSet(snapshot *crdv1.VolumeSnapshot) bool
- func IsDefaultAnnotation(obj metav1.ObjectMeta) bool
- func IsGroupSnapshotCreated(groupSnapshot *crdv1alpha1.VolumeGroupSnapshot) bool
- func IsGroupSnapshotReady(groupSnapshot *crdv1alpha1.VolumeGroupSnapshot) bool
- func IsSnapshotCreated(snapshot *crdv1.VolumeSnapshot) bool
- func IsSnapshotDeletionCandidate(snapshot *crdv1.VolumeSnapshot) bool
- func IsSnapshotReady(snapshot *crdv1.VolumeSnapshot) bool
- func IsVolumeGroupSnapshotRefSet(groupSnapshot *crdv1alpha1.VolumeGroupSnapshot, ...) bool
- func IsVolumeSnapshotRefListSet(groupSnapshot *crdv1alpha1.VolumeGroupSnapshot) bool
- func IsVolumeSnapshotRefSet(snapshot *crdv1.VolumeSnapshot, content *crdv1.VolumeSnapshotContent) bool
- func MapContainsKey(m map[string]string, s string) bool
- func NeedToAddContentFinalizer(content *crdv1.VolumeSnapshotContent) bool
- func NeedToAddSnapshotAsSourceFinalizer(snapshot *crdv1.VolumeSnapshot) bool
- func NeedToAddSnapshotBoundFinalizer(snapshot *crdv1.VolumeSnapshot) bool
- func NoResyncPeriodFunc() time.Duration
- func PatchVolumeGroupSnapshotContent(existingGroupSnapshotContent *crdv1alpha1.VolumeGroupSnapshotContent, ...) (*crdv1alpha1.VolumeGroupSnapshotContent, error)
- func PatchVolumeSnapshot(existingSnapshot *crdv1.VolumeSnapshot, patch []PatchOp, ...) (*crdv1.VolumeSnapshot, error)
- func PatchVolumeSnapshotContent(existingSnapshotContent *crdv1.VolumeSnapshotContent, patch []PatchOp, ...) (*crdv1.VolumeSnapshotContent, error)
- func RemovePrefixedParameters(param map[string]string) (map[string]string, error)
- func RemoveString(slice []string, s string) []string
- func SnapshotKey(vs *crdv1.VolumeSnapshot) string
- func SnapshotRefKey(vsref *v1.ObjectReference) string
- func StoreObjectUpdate(store cache.Store, obj interface{}, className string) (bool, error)
- type PatchOp
Constants ¶
const ( PrefixedSnapshotterSecretNameKey = csiParameterPrefix + "snapshotter-secret-name" // Prefixed name key for DeleteSnapshot secret PrefixedSnapshotterSecretNamespaceKey = csiParameterPrefix + "snapshotter-secret-namespace" // Prefixed namespace key for DeleteSnapshot secret PrefixedSnapshotterListSecretNameKey = csiParameterPrefix + "snapshotter-list-secret-name" // Prefixed name key for ListSnapshots secret PrefixedSnapshotterListSecretNamespaceKey = csiParameterPrefix + "snapshotter-list-secret-namespace" // Prefixed namespace key for ListSnapshots secret PrefixedVolumeSnapshotNameKey = csiParameterPrefix + "volumesnapshot/name" // Prefixed VolumeSnapshot name key PrefixedVolumeSnapshotNamespaceKey = csiParameterPrefix + "volumesnapshot/namespace" // Prefixed VolumeSnapshot namespace key PrefixedVolumeSnapshotContentNameKey = csiParameterPrefix + "volumesnapshotcontent/name" // Prefixed VolumeSnapshotContent name key PrefixedVolumeGroupSnapshotNameKey = csiParameterPrefix + "volumegroupsnapshot/name" // Prefixed VolumeGroupSnapshot name key PrefixedVolumeGroupSnapshotNamespaceKey = csiParameterPrefix + "volumegroupsnapshot/namespace" // Prefixed VolumeGroupSnapshot namespace key PrefixedVolumeGroupSnapshotContentNameKey = csiParameterPrefix + "volumegroupsnapshotcontent/name" // Prefixed VolumeGroupSnapshotContent name key // Name of finalizer on VolumeSnapshotContents that are bound by VolumeSnapshots VolumeSnapshotContentFinalizer = "snapshot.storage.kubernetes.io/volumesnapshotcontent-bound-protection" // Name of finalizer on VolumeSnapshot that is being used as a source to create a PVC VolumeSnapshotBoundFinalizer = "snapshot.storage.kubernetes.io/volumesnapshot-bound-protection" // Name of finalizer on VolumeSnapshot that is used as a source to create a PVC VolumeSnapshotAsSourceFinalizer = "snapshot.storage.kubernetes.io/volumesnapshot-as-source-protection" // Name of finalizer on PVCs that is being used as a source to create VolumeSnapshots PVCFinalizer = "snapshot.storage.kubernetes.io/pvc-as-source-protection" IsDefaultSnapshotClassAnnotation = "snapshot.storage.kubernetes.io/is-default-class" IsDefaultGroupSnapshotClassAnnotation = "groupsnapshot.storage.kubernetes.io/is-default-class" // AnnVolumeSnapshotBeingDeleted annotation applies to VolumeSnapshotContents. // It indicates that the common snapshot controller has verified that volume // snapshot has a deletion timestamp and is being deleted. // Sidecar controller needs to check the deletion policy on the // VolumeSnapshotContentand and decide whether to delete the volume snapshot // backing the snapshot content. AnnVolumeSnapshotBeingDeleted = "snapshot.storage.kubernetes.io/volumesnapshot-being-deleted" // AnnVolumeSnapshotBeingCreated annotation applies to VolumeSnapshotContents. // If it is set, it indicates that the csi-snapshotter // sidecar has sent the create snapshot request to the storage system and // is waiting for a response of success or failure. // This annotation will be removed once the driver's CreateSnapshot // CSI function returns success or a final error (determined by isFinalError()). // If the create snapshot request fails with a non-final error such as timeout, // retry will happen and the annotation will remain. // This only applies to dynamic provisioning of snapshots because // the create snapshot CSI method will not be called for pre-provisioned // snapshots. AnnVolumeSnapshotBeingCreated = "snapshot.storage.kubernetes.io/volumesnapshot-being-created" // AnnVolumeGroupSnapshotBeingCreated annotation applies to VolumeGroupSnapshotContents. // If it is set, it indicates that the csi-snapshotter // sidecar has sent the create group snapshot request to the storage system and // is waiting for a response of success or failure. // This annotation will be removed once the driver's CreateGroupSnapshot // CSI function returns success or a final error (determined by isFinalError()). // If the create group snapshot request fails with a non-final error such as timeout, // retry will happen and the annotation will remain. // This only applies to dynamic provisioning of group snapshots because // the create group snapshot CSI method will not be called for pre-provisioned // group snapshots. AnnVolumeGroupSnapshotBeingCreated = "groupsnapshot.storage.kubernetes.io/volumegroupsnapshot-being-created" // Annotation for secret name and namespace will be added to the content // and used at snapshot content deletion time. AnnDeletionSecretRefName = "snapshot.storage.kubernetes.io/deletion-secret-name" AnnDeletionSecretRefNamespace = "snapshot.storage.kubernetes.io/deletion-secret-namespace" // VolumeSnapshotContentInvalidLabel is applied to invalid content as a label key. The value does not matter. // See https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/177-volume-snapshot/tighten-validation-webhook-crd.md#automatic-labelling-of-invalid-objects VolumeSnapshotContentInvalidLabel = "snapshot.storage.kubernetes.io/invalid-snapshot-content-resource" // VolumeSnapshotInvalidLabel is applied to invalid snapshot as a label key. The value does not matter. // See https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/177-volume-snapshot/tighten-validation-webhook-crd.md#automatic-labelling-of-invalid-objects VolumeSnapshotInvalidLabel = "snapshot.storage.kubernetes.io/invalid-snapshot-resource" // VolumeSnapshotContentManagedByLabel is applied by the snapshot controller to the VolumeSnapshotContent object in case distributed snapshotting is enabled. // The value contains the name of the node that handles the snapshot for the volume local to that node. VolumeSnapshotContentManagedByLabel = "snapshot.storage.kubernetes.io/managed-by" )
Variables ¶
var SnapshotterListSecretParams = secretParamsMap{ // contains filtered or unexported fields }
var SnapshotterSecretParams = secretParamsMap{ // contains filtered or unexported fields }
Functions ¶
func ContainsString ¶
ContainsString checks if a given slice of strings contains the provided string.
func GetCredentials ¶
func GetCredentials(k8s kubernetes.Interface, ref *v1.SecretReference) (map[string]string, error)
GetCredentials retrieves credentials stored in v1.SecretReference
func GetDynamicSnapshotContentNameForGroupSnapshot ¶
func GetDynamicSnapshotContentNameForGroupSnapshot(groupSnapshot *crdv1alpha1.VolumeGroupSnapshot) string
GetDynamicSnapshotContentNameFoGrouprSnapshot returns a unique content name for the passed in VolumeGroupSnapshot to dynamically provision a group snapshot.
func GetDynamicSnapshotContentNameForSnapshot ¶
func GetDynamicSnapshotContentNameForSnapshot(snapshot *crdv1.VolumeSnapshot) string
GetDynamicSnapshotContentNameForSnapshot returns a unique content name for the passed in VolumeSnapshot to dynamically provision a snapshot.
func GetSecretReference ¶
func GetSecretReference(secretParams secretParamsMap, snapshotClassParams map[string]string, snapContentName string, snapshot *crdv1.VolumeSnapshot) (*v1.SecretReference, error)
getSecretReference returns a reference to the secret specified in the given nameTemplate and namespaceTemplate, or an error if the templates are not specified correctly. 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}
supported tokens for namespace resolution: - ${volumesnapshotcontent.name} - ${volumesnapshot.namespace}
an error is returned in the following situations: - the nameTemplate or namespaceTemplate 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 GetSnapshotStatusForLogging ¶
func GetSnapshotStatusForLogging(snapshot *crdv1.VolumeSnapshot) string
Stateless functions
func GroupSnapshotKey ¶
func GroupSnapshotKey(vgs *crdv1alpha1.VolumeGroupSnapshot) string
func GroupSnapshotRefKey ¶
func GroupSnapshotRefKey(vgsref *v1.ObjectReference) string
func IsBoundVolumeGroupSnapshotContentNameSet ¶
func IsBoundVolumeGroupSnapshotContentNameSet(groupSnapshot *crdv1alpha1.VolumeGroupSnapshot) bool
func IsBoundVolumeSnapshotContentNameSet ¶
func IsBoundVolumeSnapshotContentNameSet(snapshot *crdv1.VolumeSnapshot) bool
func IsDefaultAnnotation ¶
func IsDefaultAnnotation(obj metav1.ObjectMeta) bool
IsDefaultAnnotation returns a boolean if the annotation is set
func IsGroupSnapshotCreated ¶
func IsGroupSnapshotCreated(groupSnapshot *crdv1alpha1.VolumeGroupSnapshot) bool
IsGroupSnapshotCreated indicates that the group snapshot has been cut on a storage system
func IsGroupSnapshotReady ¶
func IsGroupSnapshotReady(groupSnapshot *crdv1alpha1.VolumeGroupSnapshot) bool
func IsSnapshotCreated ¶
func IsSnapshotCreated(snapshot *crdv1.VolumeSnapshot) bool
IsSnapshotCreated indicates that the snapshot has been cut on a storage system
func IsSnapshotDeletionCandidate ¶
func IsSnapshotDeletionCandidate(snapshot *crdv1.VolumeSnapshot) bool
IsSnapshotDeletionCandidate checks if a volume snapshot deletionTimestamp is set and any finalizer is on the snapshot.
func IsSnapshotReady ¶
func IsSnapshotReady(snapshot *crdv1.VolumeSnapshot) bool
func IsVolumeGroupSnapshotRefSet ¶
func IsVolumeGroupSnapshotRefSet(groupSnapshot *crdv1alpha1.VolumeGroupSnapshot, content *crdv1alpha1.VolumeGroupSnapshotContent) bool
func IsVolumeSnapshotRefListSet ¶
func IsVolumeSnapshotRefListSet(groupSnapshot *crdv1alpha1.VolumeGroupSnapshot) bool
func IsVolumeSnapshotRefSet ¶
func IsVolumeSnapshotRefSet(snapshot *crdv1.VolumeSnapshot, content *crdv1.VolumeSnapshotContent) bool
func MapContainsKey ¶
MapContainsKey checks if a given map of string to string contains the provided string.
func NeedToAddContentFinalizer ¶
func NeedToAddContentFinalizer(content *crdv1.VolumeSnapshotContent) bool
NeedToAddContentFinalizer checks if a Finalizer needs to be added for the volume snapshot content.
func NeedToAddSnapshotAsSourceFinalizer ¶
func NeedToAddSnapshotAsSourceFinalizer(snapshot *crdv1.VolumeSnapshot) bool
NeedToAddSnapshotAsSourceFinalizer checks if a Finalizer needs to be added for the volume snapshot as a source for PVC.
func NeedToAddSnapshotBoundFinalizer ¶
func NeedToAddSnapshotBoundFinalizer(snapshot *crdv1.VolumeSnapshot) bool
NeedToAddSnapshotBoundFinalizer checks if a Finalizer needs to be added for the bound volume snapshot.
func NoResyncPeriodFunc ¶
NoResyncPeriodFunc Returns 0 for resyncPeriod in case resyncing is not needed.
func PatchVolumeGroupSnapshotContent ¶
func PatchVolumeGroupSnapshotContent( existingGroupSnapshotContent *crdv1alpha1.VolumeGroupSnapshotContent, patch []PatchOp, client clientset.Interface, subresources ...string, ) (*crdv1alpha1.VolumeGroupSnapshotContent, error)
PatchVolumeGroupSnapshotContent patches a volume group snapshot content object
func PatchVolumeSnapshot ¶
func PatchVolumeSnapshot( existingSnapshot *crdv1.VolumeSnapshot, patch []PatchOp, client clientset.Interface, subresources ...string, ) (*crdv1.VolumeSnapshot, error)
PatchVolumeSnapshot patches a volume snapshot object
func PatchVolumeSnapshotContent ¶
func PatchVolumeSnapshotContent( existingSnapshotContent *crdv1.VolumeSnapshotContent, patch []PatchOp, client clientset.Interface, subresources ...string, ) (*crdv1.VolumeSnapshotContent, error)
PatchVolumeSnapshotContent patches a volume snapshot content object
func RemoveString ¶
RemoveString returns a newly created []string that contains all items from slice that are not equal to s.
func SnapshotKey ¶
func SnapshotKey(vs *crdv1.VolumeSnapshot) string
func SnapshotRefKey ¶
func SnapshotRefKey(vsref *v1.ObjectReference) string
func StoreObjectUpdate ¶
storeObjectUpdate updates given cache with a new object version from Informer callback (i.e. with events from etcd) or with an object modified by the controller itself. Returns "true", if the cache was updated, false if the object is an old version and should be ignored.