Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

External volumes #325

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions pkg/apis/workspaces/v1alpha1/volumeComponent.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,38 @@ type Volume struct {
// +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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is always going reference PVC would it be better to go with full name? persistentvolumeclaim?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer the abstraction that persistent gives (plus it's shorter), but I'm fine either way. In general, tying our API 1-1 with kubernetes makes the whole thing feel like a weird indirection layer rather than an API.

// ConfigmapVolumeType specifies a configmap
ConfigmapVolumeType ExistingVolumeType = "configmap"
// SecretVolumeType specifies a secret
SecretVolumeType ExistingVolumeType = "secret"
)
34 changes: 34 additions & 0 deletions pkg/apis/workspaces/v1alpha2/volumeComponent.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,38 @@ type Volume struct {
// +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"
)