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:
- Add functionality for generating PVCs with the appropriate size based on size requests in the devfile
- Devfile API spec is unclear on how mountSources should be handled -- mountPath is assumed to be /projects and volume name is assumed to be "projects" see issues:
- https://github.com/devfile/api/issues/290
- https://github.com/devfile/api/issues/291
Index ¶
- Variables
- type AsyncStorageProvisioner
- func (p *AsyncStorageProvisioner) CleanupWorkspaceStorage(workspace *dw.DevWorkspace, clusterAPI provision.ClusterAPI) error
- func (*AsyncStorageProvisioner) NeedsStorage(workspace *dw.DevWorkspaceTemplateSpec) bool
- func (p *AsyncStorageProvisioner) ProvisionStorage(podAdditions *v1alpha1.PodAdditions, workspace *dw.DevWorkspace, ...) error
- type CommonStorageProvisioner
- func (*CommonStorageProvisioner) CleanupWorkspaceStorage(workspace *dw.DevWorkspace, clusterAPI provision.ClusterAPI) error
- func (*CommonStorageProvisioner) NeedsStorage(workspace *dw.DevWorkspaceTemplateSpec) bool
- func (p *CommonStorageProvisioner) ProvisionStorage(podAdditions *v1alpha1.PodAdditions, workspace *dw.DevWorkspace, ...) error
- type NotReadyError
- type Provisioner
- type ProvisioningError
Constants ¶
This section is empty.
Variables ¶
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