Documentation ¶
Overview ¶
Package provisioner provides information about the StorageOS provisioner.
Index ¶
- Constants
- Variables
- func DefaultStorageClass(k8s client.Client) (*storagev1.StorageClass, error)
- func HasStorageOSAnnotation(obj client.Object) bool
- func IsProvisionedPVC(k8s client.Client, pvc corev1.PersistentVolumeClaim, namespace string, ...) (bool, error)
- func IsProvisionedStorageClass(sc *storagev1.StorageClass, provisioners ...string) bool
- func IsProvisionedVolume(k8s client.Client, volume corev1.Volume, namespace string, ...) (bool, error)
- func IsStorageOS(obj client.Object) (bool, error)
- func IsStorageOSNode(obj client.Object) (bool, error)
- func IsStorageOSVolume(k8s client.Client, volume corev1.Volume, namespace string) (bool, error)
- func PVCStorageClassName(pvc *corev1.PersistentVolumeClaim) string
- func StorageClass(k8s client.Client, name string) (*storagev1.StorageClass, error)
- func StorageClassForPVC(k8s client.Client, pvc *corev1.PersistentVolumeClaim) (*storagev1.StorageClass, error)
- func StorageClassReservedParams(sc *storagev1.StorageClass) map[string]string
- func ValidateOrSetStorageClassUID(ctx context.Context, k8s client.Client, sc client.Object, pvc client.Object) (bool, error)
Constants ¶
const ( // DefaultStorageClassKey is the annotation used to denote whether a // StorageClass is the cluster default. DefaultStorageClassKey = "storageclass.kubernetes.io/is-default-class" // StorageClassUUIDAnnotationKey is the annotation on the PVC that stores // the UUID of the StorageClass that was used to provision it. It is used // to detect when the StorageClass was deleted and re-created with the same // name. StorageClassUUIDAnnotationKey = "storageos.com/storageclass" )
const ( // DriverName is the name of the StorageOS CSI driver. DriverName = "csi.storageos.com" // NodeDriverAnnotationKey is the Node annotation that stores the registered CSI // drivers. NodeDriverAnnotationKey = "csi.volume.kubernetes.io/nodeid" // PVCProvisionerAnnotationKey is the PVC annotation that stores the PVC provisioner name. PVCProvisionerAnnotationKey = "volume.beta.kubernetes.io/storage-provisioner" )
Variables ¶
var ( // ErrUnsupportedKind is returned if the object kind being checked is not provisionable. ErrUnsupportedKind = errors.New("only nodes and pvcs have a provisioner set") )
Functions ¶
func DefaultStorageClass ¶
func DefaultStorageClass(k8s client.Client) (*storagev1.StorageClass, error)
DefaultStorageClass returns the default StorageClass, if any.
func HasStorageOSAnnotation ¶
HasStorageOSAnnotation returns true if the object has the StorageOS CSI driver set as the storage provisioner. This will only be set on PVCs.
The annotation is added by Kubernetes core during the PVC provisioning workflow, immediately after the provisioner is determined from the StorageClass. It is only set on dynamically-provisioned PVCs (which is ok).
func IsProvisionedPVC ¶
func IsProvisionedPVC(k8s client.Client, pvc corev1.PersistentVolumeClaim, namespace string, provisioners ...string) (bool, error)
IsProvisionedPVC returns true if the PVC was provided by one of the given provisioners.
func IsProvisionedStorageClass ¶
func IsProvisionedStorageClass(sc *storagev1.StorageClass, provisioners ...string) bool
IsProvisionedStorageClass returns true if the StorageClass has one of the given provisioners.
func IsProvisionedVolume ¶
func IsProvisionedVolume(k8s client.Client, volume corev1.Volume, namespace string, provisioners ...string) (bool, error)
IsProvisionedVolume returns true if the volume's PVC was provided by one of the given provisioners.
func IsStorageOS ¶
IsStorageOS returns true if the Node or PVC provided is a StorageOS provisioner or has been provisioned by StorageOS.
func IsStorageOSNode ¶
IsStorageOSNode returns true if the object has the StorageOS CSI driver annotation. This will only be set on Node objects.
The annotation is added by the drivers' node registrar, so should only be present on node objects that have run StorageOS. Once added, there is currently no code to remove it from a node.
func IsStorageOSVolume ¶
IsStorageOSVolume returns true if the volume's PVC was provisioned by StorageOS. The namespace of the Pod/PVC must be provided.
func PVCStorageClassName ¶
func PVCStorageClassName(pvc *corev1.PersistentVolumeClaim) string
PVCStorageClassName returns the PVC provisioner name.
func StorageClass ¶
StorageClass returns the StorageClass matching the name. If no name was specified, the default StorageClass (if any) is returned instead.
func StorageClassForPVC ¶
func StorageClassForPVC(k8s client.Client, pvc *corev1.PersistentVolumeClaim) (*storagev1.StorageClass, error)
StorageClassForPVC returns the StorageClass of the PVC. If no StorageClass was specified, returns the cluster default if set.
func StorageClassReservedParams ¶
func StorageClassReservedParams(sc *storagev1.StorageClass) map[string]string
StorageClassReservedParams returns a map of StorageClass parameters that are reserved for StorageOS. These are typically feature defaults for any volumes provisioned by the StorageClass.
func ValidateOrSetStorageClassUID ¶
func ValidateOrSetStorageClassUID(ctx context.Context, k8s client.Client, sc client.Object, pvc client.Object) (bool, error)
ValidateOrSetStorageClassUID returns true if the StorageClass annotation on the PVC object matches the UID of the passed in StorageClass or the StorageClass has created before the given PVC.
If the annotation does not exist and the StorageClass has created before the PVC, it sets the UID of the passed in StorageClass as the new StorageClass annotation.
Types ¶
This section is empty.