storage

package
v0.0.0-...-b0bff92 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilesystemInfo

func FilesystemInfo(ctx context.Context, client kubernetes.Interface,
	namespace string, volume corev1.Volume, volumeMount corev1.VolumeMount,
	now time.Time) (*caas.FilesystemInfo, error)

FilesystemInfo returns filesystem info.

func FilesystemStatus

func FilesystemStatus(pvcPhase corev1.PersistentVolumeClaimPhase) status.Status

FilesystemStatus returns filesystem status.

func GetMountPathForFilesystem

func GetMountPathForFilesystem(idx int, appName string, fs storage.KubernetesFilesystemParams) string

GetMountPathForFilesystem returns mount path.

func ParseStorageMode

func ParseStorageMode(attrs map[string]interface{}) (*corev1.PersistentVolumeAccessMode, error)

ParseStorageMode returns k8s persistent volume access mode.

func PersistentVolumeClaimSpec

func PersistentVolumeClaimSpec(params VolumeParams) *corev1.PersistentVolumeClaimSpec

PersistentVolumeClaimSpec returns k8s PVC spec.

func PushUniqueVolume

func PushUniqueVolume(podSpec *corev1.PodSpec, vol corev1.Volume, force bool) error

PushUniqueVolume ensures to only add unique volumes because k8s will not schedule pods if it has duplicated volumes. The existing volume will be replaced if force sets to true.

func PushUniqueVolumeClaimTemplate

func PushUniqueVolumeClaimTemplate(spec *apps.StatefulSetSpec, pvc corev1.PersistentVolumeClaim) error

PushUniqueVolumeClaimTemplate ensures to only add unique volume claim template to a statefulset.

func PushUniqueVolumeMount

func PushUniqueVolumeMount(container *corev1.Container, volMount corev1.VolumeMount)

PushUniqueVolumeMount ensures to only add unique volume mount to a container.

func StorageClassSpec

func StorageClassSpec(cfg k8s.StorageProvisioner, legacyLabels bool) *storagev1.StorageClass

StorageClassSpec converts storage provisioner config to k8s storage class.

func StorageProvisioner

func StorageProvisioner(namespace, model string, params VolumeParams) k8s.StorageProvisioner

StorageProvisioner returns storage provisioner.

func VolumeInfo

func VolumeInfo(pv *resources.PersistentVolume, now time.Time) caas.VolumeInfo

VolumeInfo returns volume info.

func VolumeSourceForFilesystem

func VolumeSourceForFilesystem(fs storage.KubernetesFilesystemParams) (*corev1.VolumeSource, error)

VolumeSourceForFilesystem return k8s volume source.

func VolumeStatus

func VolumeStatus(pvPhase corev1.PersistentVolumePhase) status.Status

VolumeStatus returns volume status.

Types

type StorageConfig

type StorageConfig struct {
	// StorageClass defines a storage class
	// which will be created with the specified
	// provisioner and parameters if it doesn't
	// exist.
	StorageClass string

	// StorageProvisioner is the provisioner class to use.
	StorageProvisioner string

	// Parameters define attributes of the storage class.
	Parameters map[string]string

	// ReclaimPolicy defines the volume reclaim policy.
	ReclaimPolicy corev1.PersistentVolumeReclaimPolicy
}

StorageConfig defines config for storage.

func ParseStorageConfig

func ParseStorageConfig(attrs map[string]interface{}) (*StorageConfig, error)

ParseStorageConfig returns storage config.

type VolumeParams

type VolumeParams struct {
	Name          string
	StorageConfig *StorageConfig
	Size          resource.Quantity
	AccessMode    corev1.PersistentVolumeAccessMode
}

VolumeParams holds PV and PVC related config.

func ParseVolumeParams

func ParseVolumeParams(name string, size resource.Quantity, storageAttr map[string]interface{}) (*VolumeParams, error)

ParseVolumeParams returns a volume param.

Jump to

Keyboard shortcuts

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