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

Implement agreed-on devfile 2.0 issues #35

Merged
merged 16 commits into from
Apr 22, 2020
Merged
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
38 changes: 30 additions & 8 deletions deploy/crds/workspaces.ecd.eclipse.org_devworkspaces_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ spec:
type: object
type: array
env:
description: Environment variables used in this container
items:
properties:
name:
Expand All @@ -439,22 +440,28 @@ spec:
when `mountSources` is `true`. When omitted, the value
of the `PROJECT_ROOT` environment variable is used.
davidfestal marked this conversation as resolved.
Show resolved Hide resolved
type: string
volumes:
volumeMounts:
description: List of volumes mounts that should be mounted
is this container.
items:
description: Volume that should be mounted to a component
container
properties:
mountPath:
type: string
name:
description: The volume name. If several components
mount the same volume then they will reuse the
volume and will be able to access to the same
files
description: The volume mount name is the name of
an existing `Volume` component. If no corresponding
`Volume` component exist it is implicitly added.
If several containers mount the same volume name
then they will reuse the same volume and will
be able to access to the same files.
type: string
path:
description: The path in the component container
where the volume should be mounted
type: string
required:
- mountPath
- name
- path
type: object
type: array
required:
Expand Down Expand Up @@ -520,9 +527,24 @@ spec:
- Kubernetes
- Openshift
- CheEditor
- Volume
- ChePlugin
- Custom
type: string
volume:
davidfestal marked this conversation as resolved.
Show resolved Hide resolved
description: Volume component
properties:
name:
description: Mandatory name that allows referencing the
Volume component in Container volume mounts or inside
a parent
type: string
size:
description: Size of the volume
type: string
required:
- name
type: object
type: object
type: array
parent:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ spec:
type: object
type: array
env:
description: Environment variables used in this container
items:
properties:
name:
Expand All @@ -429,21 +430,28 @@ spec:
`mountSources` is `true`. When omitted, the value of the
`PROJECT_ROOT` environment variable is used.
type: string
volumes:
volumeMounts:
description: List of volumes mounts that should be mounted
is this container.
items:
description: Volume that should be mounted to a component
container
properties:
mountPath:
type: string
name:
description: The volume name. If several components
mount the same volume then they will reuse the volume
and will be able to access to the same files
description: The volume mount name is the name of an
existing `Volume` component. If no corresponding `Volume`
component exist it is implicitly added. If several
containers mount the same volume name then they will
reuse the same volume and will be able to access to
the same files.
type: string
path:
description: The path in the component container where
the volume should be mounted
type: string
required:
- mountPath
- name
- path
type: object
type: array
required:
Expand Down Expand Up @@ -509,9 +517,23 @@ spec:
- Kubernetes
- Openshift
- CheEditor
- Volume
- ChePlugin
- Custom
type: string
volume:
description: Volume component
properties:
name:
description: Mandatory name that allows referencing the Volume
component in Container volume mounts or inside a parent
type: string
size:
description: Size of the volume
type: string
required:
- name
type: object
type: object
type: array
parent:
Expand Down
7 changes: 6 additions & 1 deletion pkg/apis/workspaces/v1alpha1/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import runtime "k8s.io/apimachinery/pkg/runtime"

// ComponentType describes the type of component.
// Only one of the following component type may be specified.
// +kubebuilder:validation:Enum= Container;Kubernetes;Openshift;CheEditor;ChePlugin;Custom
// +kubebuilder:validation:Enum= Container;Kubernetes;Openshift;CheEditor;Volume;ChePlugin;Custom
type ComponentType string

const (
Expand All @@ -13,6 +13,7 @@ const (
OpenshiftComponentType ComponentType = "Openshift"
CheEditorComponentType ComponentType = "CheEditor"
ChePluginComponentType ComponentType = "ChePlugin"
VolumeComponentType ComponentType = "Volume"
CustomComponentType ComponentType = "Custom"
)

Expand Down Expand Up @@ -40,6 +41,10 @@ type PolymorphicComponent struct {
// +optional
Container *ContainerComponent `json:"container,omitempty"`

// Volume component
// +optional
Volume *VolumeComponent `json:"volume,omitempty"`

// CheEditor component
// +optional
CheEditor *CheEditorComponent `json:"cheEditor,omitempty"`
Expand Down
22 changes: 14 additions & 8 deletions pkg/apis/workspaces/v1alpha1/containerComponent.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,19 @@ type Container struct {
Name string `json:"name"`
Image string `json:"image"`
// +optional
// Environment variables used in this container
Env []EnvVar `json:"env,omitempty"`

// +optional
Volumes []Volume `json:"volumes,omitempty"`
// List of volumes mounts that should be mounted is this container.
VolumeMounts []VolumeMount `json:"volumeMounts,omitempty"`

//+optional
MemoryLimit string `json:"memoryLimit,omitempty"`

//+optional
MountSources bool `json:"mountSources"`

//+optional
//
// Optional specification of the path in the container where
Expand All @@ -67,11 +71,13 @@ type EnvVar struct {
}

// Volume that should be mounted to a component container
type Volume struct {
// The volume name.
// If several components mount the same volume then they will reuse the volume
// and will be able to access to the same files
type VolumeMount struct {
// The volume mount name is the name of an existing `Volume` component.
// If no corresponding `Volume` component exist it is implicitly added.
// If several containers mount the same volume name
// then they will reuse the same volume and will be able to access to the same files.
Name string `json:"name"`

MountPath string `json:"mountPath"`
// The path in the component container where the volume should be mounted
Path string `json:"path"`
}
18 changes: 18 additions & 0 deletions pkg/apis/workspaces/v1alpha1/volumeComponent.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
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"`
}
45 changes: 42 additions & 3 deletions pkg/apis/workspaces/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion pkg/apis/workspaces/v1alpha1/zz_generated.openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,12 @@ func schema_pkg_apis_workspaces_v1alpha1_PolymorphicComponent(ref common.Referen
Ref: ref("github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.ContainerComponent"),
},
},
"volume": {
SchemaProps: spec.SchemaProps{
Description: "Volume component",
Ref: ref("github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.VolumeComponent"),
},
},
"cheEditor": {
SchemaProps: spec.SchemaProps{
Description: "CheEditor component",
Expand Down Expand Up @@ -532,14 +538,15 @@ func schema_pkg_apis_workspaces_v1alpha1_PolymorphicComponent(ref common.Referen
"custom": "Custom",
"kubernetes": "Kubernetes",
"openshift": "Openshift",
"volume": "Volume",
},
},
},
},
},
},
Dependencies: []string{
"github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.CheEditorComponent", "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.ChePluginComponent", "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.ContainerComponent", "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.CustomComponent", "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.KubernetesComponent", "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.OpenshiftComponent"},
"github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.CheEditorComponent", "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.ChePluginComponent", "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.ContainerComponent", "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.CustomComponent", "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.KubernetesComponent", "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.OpenshiftComponent", "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.VolumeComponent"},
}
}

Expand Down
33 changes: 27 additions & 6 deletions schemas/devfile.json
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@
"type": "array"
},
"env": {
"description": "Environment variables used in this container",
"items": {
"properties": {
"name": {
Expand Down Expand Up @@ -503,21 +504,23 @@
"description": "Optional specification of the path in the container where project sources should be transferred/mounted when `mountSources` is `true`. When omitted, the value of the `PROJECT_ROOT` environment variable is used.",
"type": "string"
},
"volumes": {
"volumeMounts": {
"description": "List of volumes mounts that should be mounted is this container.",
"items": {
"description": "Volume that should be mounted to a component container",
"properties": {
"mountPath": {
"name": {
"description": "The volume mount name is the name of an existing `Volume` component. If no corresponding `Volume` component exist it is implicitly added. If several containers mount the same volume name then they will reuse the same volume and will be able to access to the same files.",
"type": "string"
},
"name": {
"description": "The volume name. If several components mount the same volume then they will reuse the volume and will be able to access to the same files",
"path": {
"description": "The path in the component container where the volume should be mounted",
"type": "string"
}
},
"required": [
"mountPath",
"name"
"name",
"path"
],
"type": "object"
},
Expand Down Expand Up @@ -607,10 +610,28 @@
"Kubernetes",
"Openshift",
"CheEditor",
"Volume",
"ChePlugin",
"Custom"
],
"type": "string"
},
"volume": {
"description": "Volume component",
"properties": {
"name": {
"description": "Mandatory name that allows referencing the Volume component in Container volume mounts or inside a parent",
"type": "string"
},
"size": {
"description": "Size of the volume",
"type": "string"
}
},
"required": [
"name"
],
"type": "object"
}
},
"type": "object"
Expand Down
Loading