storage

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Copyright (c) 2019-2022 Red Hat, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

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 sync.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 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 (*CommonStorageProvisioner) CleanupWorkspaceStorage(workspace *dw.DevWorkspace, 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 *dw.DevWorkspace, 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 (e EphemeralStorageProvisioner) CleanupWorkspaceStorage(_ *dw.DevWorkspace, _ sync.ClusterAPI) error

func (EphemeralStorageProvisioner) NeedsStorage added in v0.8.0

func (EphemeralStorageProvisioner) ProvisionStorage added in v0.8.0

func (e EphemeralStorageProvisioner) ProvisionStorage(podAdditions *v1alpha1.PodAdditions, workspace *dw.DevWorkspace, _ sync.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 *dw.DevWorkspace, 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 *dw.DevWorkspace, 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 *dw.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