const (
// OdoSourceVolume is the constant containing the name of the emptyDir volume containing the project source
OdoSourceVolume = "odo-projects"
// SharedDataVolumeName is the constant containing the name of the emptyDir volume containing shared data for odo
= "odo-shared-data"
// SharedDataMountPath The Mount Path for the container mounting the odo volume
= "/opt/odo/"
// OdoSourceVolumeSize specifies size for odo source volume.
OdoSourceVolumeSize = "2Gi"
)
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"
)
const (
// DefaultVolumeSize Default volume size for volumes defined in a devfile
DefaultVolumeSize = "1Gi"
)
const StorageKind = "Storage"
func Push(client Client, devfileObj parser.DevfileObj) (ephemerals map[string]Storage, _ error)
Push creates and deletes the required persistent storages and returns the list of ephemeral storages it compares the local storage against the storage on the cluster
type Client interface {
Create(Storage) error
Delete(string) error
List() (StorageList, error)
}
func NewClient(componentName string, appName string, options ClientOptions) Client
NewClient gets the appropriate Storage client based on the parameters
type ClientOptions struct {
Client kclient.ClientInterface
Deployment *v1.Deployment
Runtime string
}
LocalStorage holds storage related information
type LocalStorage struct {
// Name of the storage
Name string `yaml:"Name,omitempty"`
// Size of the storage
Size string `yaml:"Size,omitempty"`
// Boolean indicating if the volume should be ephemeral. A nil pointer indicates to use the default behaviour
Ephemeral *bool `yaml:"Ephemeral,omitempty"`
// Path of the storage to which it will be mounted on the container
Path string `yaml:"Path,omitempty"`
// Container is the container name on which this storage is mounted
Container string `yaml:"-" json:"-"`
}
func ListStorage(devfileObj parser.DevfileObj) ([]LocalStorage, error)
ListStorage gets all the storage from the devfile.yaml
MockClient is a mock of Client interface.
type MockClient struct {
// contains filtered or unexported fields
}
func NewMockClient(ctrl *gomock.Controller) *MockClient
NewMockClient creates a new mock instance.
func (m *MockClient) Create(arg0 Storage) error
Create mocks base method.
func (m *MockClient) Delete(arg0 string) error
Delete mocks base method.
func (m *MockClient) EXPECT() *MockClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockClient) List() (StorageList, error)
List mocks base method.
MockClientMockRecorder is the mock recorder for MockClient.
type MockClientMockRecorder struct {
// contains filtered or unexported fields
}
func (mr *MockClientMockRecorder) Create(arg0 interface{}) *gomock.Call
Create indicates an expected call of Create.
func (mr *MockClientMockRecorder) Delete(arg0 interface{}) *gomock.Call
Delete indicates an expected call of Delete.
func (mr *MockClientMockRecorder) List() *gomock.Call
List indicates an expected call of List.
Storage holds the information about storage attached to the component
type Storage struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec StorageSpec `json:"spec,omitempty"`
Status StorageStatus `json:"status,omitempty"`
}
func NewStorage(storageName, storageSize, storagePath string, ephemeral *bool) Storage
NewStorage returns an instance of Storage storagePath indicates the path to which the storage is mounted to, "" if not mounted
func NewStorageWithContainer(storageName, storageSize, storagePath string, container string, ephemeral *bool) Storage
NewStorageWithContainer returns an instance of Storage with container specified storagePath indicates the path to which the storage is mounted to, "" if not mounted
StorageList is a list of storages
type StorageList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Storage `json:"items"`
}
func ConvertListLocalToMachine(storageListConfig []LocalStorage) StorageList
ConvertListLocalToMachine converts storage config list to StorageList type
func NewStorageList(items []Storage) StorageList
NewStorageList returns an instance of a list containning the `items` storages
StorageSpec indicates size and path of storage
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"`
// indicates if storage should be ephemeral, if nil the default behaviour will be used
Ephemeral *bool `json:"ephemeral,omitempty"`
ContainerName string `json:"containerName,omitempty"`
}
StorageState
type StorageStatus string