storage

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StateTypePushed means that Storage is present both locally and on cluster
	StateTypePushed StorageStatus = "Pushed"
	// StateTypeNotPushed means that Storage is only in local config, but not on the cluster
	StateTypeNotPushed = "Not Pushed"
	// StateTypeLocallyDeleted means that Storage was deleted from the local config, but it is still present on the cluster
	StateTypeLocallyDeleted = "Locally Deleted"
)

Variables

This section is empty.

Functions

func Create

func Create(client *occlient.Client, name string, size string, componentName string, applicationName string) (*corev1.PersistentVolumeClaim, error)

Create adds storage to given component of given application

func Delete

func Delete(client *occlient.Client, name string) error

Delete removes storage from the given application. Delete returns the component name, if it is mounted to a component, or "" and the error, if any

func Exists

func Exists(client *occlient.Client, storageName string, applicationName string) (bool, error)

Exists checks if the given storage exists in the given application

func GetComponentNameFromStorageName

func GetComponentNameFromStorageName(client *occlient.Client, storageName string) (string, error)

GetComponentNameFromStorageName returns the component name associated with the storageName, if any, or ""

func GetStorageNameFromMountPath

func GetStorageNameFromMountPath(client *occlient.Client, path string, componentName string, applicationName string) (string, error)

Gets the storageName mounted to the given path in the given component and application GetStorageNameFromMountPath returns the name of the storage or the error

func IsMounted

func IsMounted(client *occlient.Client, storageName string, componentName string, applicationName string) (bool, error)

IsMounted checks if the given storage is mounted to the given component IsMounted returns a bool indicating the storage is mounted to the component or not

func MachineReadableSuccessOutput

func MachineReadableSuccessOutput(storageName string, message string)

MachineReadableSuccessOutput outputs a success output that includes storage information

func Mount

func Mount(client *occlient.Client, path string, storageName string, componentName string, applicationName string) error

Mount mounts the given storage to the given component

func Push

func Push(client *occlient.Client, storageList StorageList, componentName, applicationName string, isComponentExits bool) (map[string]*corev1.PersistentVolumeClaim, map[string]string, error)

Push creates/deletes the required storage during `odo push` storageList are the storage mentioned in the config isComponentExists indicates if the component exists or not, if not, we don't run the list operation returns the storage for mounting and unMounting from the DC StorageToBeMounted describes the storage to be mounted StorageToBeMounted : storagePath is the key of the map, the generatedPVC is the value of the map StorageToBeUnMounted describes the storage to be unmounted StorageToBeUnMounted : path is the key of the map,storageName is the value of the map

func Unmount

func Unmount(client *occlient.Client, storageName string, componentName string, applicationName string, updateLabels bool) error

Unmount unmounts the given storage from the given component updateLabels is a flag to whether update Label or not, so updation of label is not required in delete call but required in unmount call this is introduced as causing unnecessary delays

Types

type Storage

type Storage struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              StorageSpec   `json:"spec,omitempty"`
	Status            StorageStatus `json:"status,omitempty"`
}

Storage holds the information about storage attached to the component

func GetMachineFormatWithContainer

func GetMachineFormatWithContainer(storageName, storageSize, storagePath string, container string) Storage

GetMachineFormatWithContainer gives machine readable Storage definition storagePath indicates the path to which the storage is mounted to, "" if not mounted

func GetMachineReadableFormat

func GetMachineReadableFormat(storageName, storageSize, storagePath string) Storage

GetMachineReadableFormat gives machine readable Storage definition storagePath indicates the path to which the storage is mounted to, "" if not mounted

type StorageList

type StorageList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Storage `json:"items"`
}

StorageList is a list of storages

func ConvertListLocalToMachine

func ConvertListLocalToMachine(storageListConfig []config.ComponentStorageSettings) StorageList

It converts storage config list to StorageList type

func DevfileList

func DevfileList(kClient *kclient.Client, devfileData data.DevfileData, componentName string) (StorageList, error)

DevfileList lists the storage from the local devfile and cluster with their respective state

func GetMachineReadableFormatForList

func GetMachineReadableFormatForList(storage []Storage) StorageList

GetMachineReadableFormatForList gives machine readable StorageList definition

func List

func List(client *occlient.Client, componentName string, applicationName string) (StorageList, error)

List lists all the mounted storage associated with the given component of the given application and the unmounted storage in the given application

func ListMounted

func ListMounted(client *occlient.Client, componentName string, applicationName string) (StorageList, error)

ListMounted lists all the mounted storage associated with the given component and application

func ListStorageWithState

func ListStorageWithState(client *occlient.Client, localConfig *config.LocalConfigInfo, componentName string, applicationName string) (StorageList, error)

func ListUnmounted

func ListUnmounted(client *occlient.Client, applicationName string) (StorageList, error)

ListUnmounted lists all the unmounted storage associated with the given application

func (StorageList) Get

func (storages StorageList) Get(storageName string) Storage

Get returns Storage defination for given Storage name

type StorageSpec

type StorageSpec struct {
	Size string `json:"size,omitempty"`
	// if path is empty, it indicates that the storage is not mounted in any component
	Path string `json:"path,omitempty"`

	ContainerName string `json:"containerName,omitempty"`
}

StorageSpec indicates size and path of storage

type StorageStatus

type StorageStatus string

StorageState

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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