storage

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2021 License: EPL-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package storage contains library functions for provisioning volumes and volumeMounts in containers according to the volume components in a devfile. These functions also handle mounting project sources to containers that require it.

TODO:

Index

Constants

This section is empty.

Variables

View Source
var UnsupportedStorageStrategy = errors.New("configured storage type not supported")

UnsupportedStorageStrategy is used when the controller is configured with an invalid storage strategy

Functions

This section is empty.

Types

type AsyncStorageProvisioner

type AsyncStorageProvisioner struct{}

The AsyncStorageProvisioner provisions one PVC per namespace and creates an ssh deployment that syncs data into that PVC. Workspaces are provisioned with sync sidecars that sync data from the workspace to the async ssh deployment. All storage attached to a workspace is emptyDir volumes.

func (*AsyncStorageProvisioner) CleanupWorkspaceStorage

func (p *AsyncStorageProvisioner) CleanupWorkspaceStorage(workspace *dw.DevWorkspace, clusterAPI provision.ClusterAPI) error

func (*AsyncStorageProvisioner) NeedsStorage

func (*AsyncStorageProvisioner) NeedsStorage(workspace *dw.DevWorkspaceTemplateSpec) bool

func (*AsyncStorageProvisioner) ProvisionStorage

func (p *AsyncStorageProvisioner) ProvisionStorage(podAdditions *v1alpha1.PodAdditions, workspace *dw.DevWorkspace, clusterAPI provision.ClusterAPI) error

type CommonStorageProvisioner

type CommonStorageProvisioner struct{}

The CommonStorageProvisioner provisions one PVC per namespace and configures all volumes in a workspace to mount on subpaths within that PVC. Workspace storage is mounted prefixed with the workspace ID.

func (*CommonStorageProvisioner) CleanupWorkspaceStorage

func (*CommonStorageProvisioner) CleanupWorkspaceStorage(workspace *dw.DevWorkspace, clusterAPI provision.ClusterAPI) error

func (*CommonStorageProvisioner) NeedsStorage

func (*CommonStorageProvisioner) NeedsStorage(workspace *dw.DevWorkspaceTemplateSpec) bool

func (*CommonStorageProvisioner) ProvisionStorage

func (p *CommonStorageProvisioner) ProvisionStorage(podAdditions *v1alpha1.PodAdditions, workspace *dw.DevWorkspace, clusterAPI provision.ClusterAPI) error

type NotReadyError

type NotReadyError struct {
	// Message is a user-friendly string explaining why the error occurred
	Message string
	// RequeueAfter represents how long we should wait before checking if storage is ready
	RequeueAfter time.Duration
}

NotReadyError represents the state where no unexpected issues occurred but the storage required for the DevWorkspace is not ready

func (*NotReadyError) Error

func (e *NotReadyError) Error() string

type Provisioner

type Provisioner interface {
	// ProvisionStorage rewrites the volumes and volumeMounts in podAdditions to match the current storage policy and syncs any
	// out-of-pod required objects to the cluster.
	// Returns NotReadyError to signify that storage is not ready, ProvisioningError when a fatal issue is encountered,
	// and other error if there is an unexpected problem.
	ProvisionStorage(podAdditions *v1alpha1.PodAdditions, workspace *devworkspace.DevWorkspace, clusterAPI provision.ClusterAPI) error
	// NeedsStorage returns whether the current workspace needs a PVC to be provisioned, given this storage strategy.
	NeedsStorage(workspace *devworkspace.DevWorkspaceTemplateSpec) bool
	// CleanupWorkspaceStorage removes any objects provisioned by in the ProvisionStorage step that aren't automatically removed when a
	// DevWorkspace is deleted (e.g. delete subfolders in a common PVC assigned to the workspace)
	// Returns nil on success (DevWorkspace can be deleted), NotReadyError if additional reconciles are necessary, ProvisioningError when
	// a fatal issue is encountered, and any other error if an unexpected problem arises.
	CleanupWorkspaceStorage(workspace *devworkspace.DevWorkspace, clusterAPI provision.ClusterAPI) error
}

Provisioner is an interface for rewriting volumeMounts in a pod according to a storage policy (e.g. common PVC for all mounts, etc.)

func GetProvisioner

func GetProvisioner(workspace *devworkspace.DevWorkspace) (Provisioner, error)

GetProvisioner returns the storage provisioner that should be used for the current workspace

type ProvisioningError

type ProvisioningError struct {
	// Err is the underlying error causing the problem. If nil, it is not included in the output of Error()
	Err error
	// Message is a user-friendly string explaining why the error occurred
	Message string
}

ProvisioningError represents an unrecoverable issue in provisioning storage for a DevWorkspace.

func (*ProvisioningError) Error

func (e *ProvisioningError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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