storage

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 27 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

func WorkspaceNeedsStorage added in v0.27.0

func WorkspaceNeedsStorage(workspace *dw.DevWorkspaceTemplateSpec) bool

WorkspaceNeedsStorage returns true if storage will need to be provisioned for the current workspace. Note that ephemeral volumes do not need to provision storage

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 *common.DevWorkspaceWithConfig, clusterAPI sync.ClusterAPI) error

func (*AsyncStorageProvisioner) NeedsStorage

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

func (*AsyncStorageProvisioner) ProvisionStorage

func (p *AsyncStorageProvisioner) ProvisionStorage(podAdditions *v1alpha1.PodAdditions, workspace *common.DevWorkspaceWithConfig, clusterAPI sync.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 (p *CommonStorageProvisioner) CleanupWorkspaceStorage(workspace *common.DevWorkspaceWithConfig, clusterAPI sync.ClusterAPI) error

func (*CommonStorageProvisioner) NeedsStorage

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

func (*CommonStorageProvisioner) ProvisionStorage

func (p *CommonStorageProvisioner) ProvisionStorage(podAdditions *v1alpha1.PodAdditions, workspace *common.DevWorkspaceWithConfig, clusterAPI sync.ClusterAPI) error

type EphemeralStorageProvisioner added in v0.8.0

type EphemeralStorageProvisioner struct{}

The EphemeralStorageProvisioner provisions all workspace storage as emptyDir volumes. Any local changes are lost when the workspace is stopped; its lifetime is tied to the underlying pod.

func (EphemeralStorageProvisioner) CleanupWorkspaceStorage added in v0.8.0

func (EphemeralStorageProvisioner) NeedsStorage added in v0.8.0

func (EphemeralStorageProvisioner) ProvisionStorage added in v0.8.0

func (e EphemeralStorageProvisioner) ProvisionStorage(podAdditions *v1alpha1.PodAdditions, workspace *common.DevWorkspaceWithConfig, _ sync.ClusterAPI) error

type PerWorkspaceStorageProvisioner added in v0.15.0

type PerWorkspaceStorageProvisioner struct{}

The PerWorkspaceStorageProvisioner provisions one PVC per workspace and configures all volumes in the workspace to mount on subpaths within that PVC.

func (*PerWorkspaceStorageProvisioner) CleanupWorkspaceStorage added in v0.15.0

func (*PerWorkspaceStorageProvisioner) CleanupWorkspaceStorage(workspace *common.DevWorkspaceWithConfig, clusterAPI sync.ClusterAPI) error

We rely on Kubernetes to use the owner reference to automatically delete the PVC once the workspace is set for deletion.

func (*PerWorkspaceStorageProvisioner) NeedsStorage added in v0.15.0

This function is used to determine whether a finalizer should be applied to the DevWorkspace. Since the per-workspace PVC are cleaned up/deleted via Owner References when the workspace is deleted, no finalizer needs to be applied

func (*PerWorkspaceStorageProvisioner) ProvisionStorage added in v0.15.0

func (p *PerWorkspaceStorageProvisioner) ProvisionStorage(podAdditions *v1alpha1.PodAdditions, workspace *common.DevWorkspaceWithConfig, clusterAPI sync.ClusterAPI) error

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 *common.DevWorkspaceWithConfig, clusterAPI sync.ClusterAPI) error
	// NeedsStorage returns whether the current workspace needs a PVC to be provisioned, given this storage strategy.
	NeedsStorage(workspace *dw.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 *common.DevWorkspaceWithConfig, clusterAPI sync.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 *common.DevWorkspaceWithConfig) (Provisioner, error)

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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