forked from devfile/api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvolumeComponent.go
52 lines (45 loc) · 1.94 KB
/
volumeComponent.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package v1alpha1
// Component that allows the developer to declare and configure a volume into his workspace
type VolumeComponent struct {
BaseComponent `json:",inline"`
Volume `json:",inline"`
}
// Volume that should be mounted to a component container
type Volume struct {
// Mandatory name that allows referencing the Volume component
// in Container volume mounts or inside a parent
Name string `json:"name"`
// +optional
// Size of the volume
Size string `json:"size,omitempty"`
// External defines information about volumes that exist outside of the current workspace.
// They are not created or deleted while processing a devfile but are still mounted into
// component containers. When left empty, it is assumed that a new volume is to be created.
//
// Note: External volumes should be used with care, as they make devfiles less portable. It
// is assumed that external volumes exist already.
// +optional
External ExistingVolumeRef `json:"external,omitempty"`
}
// ExistingVolumeRef is a refernce to a volume that exists outside the lifecycle of components
type ExistingVolumeRef struct {
// Name defines the name of the resource
Name string `json:"name"`
// Type defines the type of the resource:
//
// - `storage` specifies that this volume refers to a PersistentVolumeClaim
// - `configmap` specifies that this volume refers to a ConfigMap
// - `secret` specifies that this volume refers to a Secret
// kubebuilder:validation:Enum="persistent,configmap,secret"
Type ExistingVolumeType `json:"type"`
}
// ExistingVolumeType defines the type of an external Volume
type ExistingVolumeType string
const (
// PersistentVolumeType specifies persistent storage, e.g. a PersistentVolumeClaim
PersistentVolumeType ExistingVolumeType = "persistent"
// ConfigmapVolumeType specifies a configmap
ConfigmapVolumeType ExistingVolumeType = "configmap"
// SecretVolumeType specifies a secret
SecretVolumeType ExistingVolumeType = "secret"
)