Skip to content

Commit aad39b0

Browse files
author
David Festal
committed
Add UserRuntimes
1 parent 3aae084 commit aad39b0

File tree

3 files changed

+130
-10
lines changed

3 files changed

+130
-10
lines changed

pkg/apis/workspaces/v1alpha1/devworkspace_types.go

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,22 @@ type DevWorkspaceSpec struct {
1515
Template DevWorkspaceTemplateSpec `json:"template,omitempty"`
1616
}
1717

18-
// This schema describes the structure of the devfile object
18+
// Structure of the workspace. This is also the specification of a workspace template.
1919
type DevWorkspaceTemplateSpec struct {
20-
Commands []Command `json:"commands,omitempty"` // Description of the predefined commands to be available in workspace
21-
Projects []Project `json:"projects,omitempty"` // Description of the projects, containing names and sources locations
22-
Components []Component `json:"components"` // Description of the workspace components, such as editor and plugins
20+
// Predefined, ready-to-use, workspace-related commands
21+
Commands []Command `json:"commands,omitempty"`
22+
23+
// Projects worked on in the workspace, containing names and sources locations
24+
Projects []Project `json:"projects,omitempty"`
25+
26+
// List of runtimes the developer wants to add into his workspace
27+
// +optional
28+
// +patchMergeKey=name
29+
// +patchStrategy=merge,retainKeys
30+
DeveloperRuntimes []DeveloperRuntime `json:"userRuntimes,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name"`
31+
32+
// Description of the workspace components, such as editor and plugins
33+
Components []Component `json:"components,omitempty"`
2334
}
2435

2536
// DevWorkspaceStatus defines the observed state of DevWorkspace
@@ -31,8 +42,8 @@ type DevWorkspaceStatus struct {
3142

3243
// Id of the workspace
3344
WorkspaceId string `json:"workspaceId"`
34-
// URL at which the Editor can be joined
35-
IdeUrl string `json:"ideUrl,omitempty"`
45+
// URL at which the Worksace Editor can be joined
46+
MainIdeUrl string `json:"mainIdeUrl,omitempty"`
3647
// AdditionalInfo
3748
AdditionalInfo map[string]string `json:"additionalInfo,omitempty"`
3849
}

pkg/apis/workspaces/v1alpha1/model.go

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,49 @@ type ProjectSource struct {
2626
Type string `json:"type"` // Project's source type.
2727
}
2828

29-
// Describes a workspace component
29+
// Workspace component: Anything that will bring additional features / tooling / behaviour / context
30+
// to the workspace, in order to make working in it easier.
3031
type Component struct {
31-
Name string `json:"name"`
32-
MemoryLimit string `json:"memoryLimit"`
32+
Name string `json:"name"`
3333
}
34+
35+
// Component that allows the developer to add a configured container into his workspace
36+
type DeveloperRuntime struct {
37+
Component
38+
MemoryLimit string `json:"memoryLimit,omitempty"`
39+
Endpoints []Endpoint `json:"endpoints,omitempty"`
40+
Container
41+
}
42+
43+
type Endpoint struct {
44+
Name string `json:"name"`
45+
TargetPort int `json:"targetPort"`
46+
Configuration *EndpointConfiguration `json:"configuration,omitEmpty"`
47+
attributes map[string]string `json:"attributes,omitempty"`
48+
}
49+
50+
type EndpointConfiguration struct {
51+
Public bool `json:"public"`
52+
Discoverable bool `json:"discoverable"`
53+
Protocol string `json:"protocol,omitmepty"`
54+
Schema string `json:"schema,omitmepty"`
55+
Secure bool `json:"secure"`
56+
CookiesAuthEnabled bool `json:"public"`
57+
Path string `json:"path",omitempty`
58+
59+
// +kubebuilder:validation:Enum=ide,terminal
60+
Type string `json:"type,omitmepty"`
61+
}
62+
63+
64+
type Container struct {
65+
Name string `json:"name" yaml:"name"`
66+
Image string `json:"image" yaml:"image"`
67+
// Env []EnvVar `json:"env" yaml:"env"`
68+
// EditorCommands []EditorCommand `json:"editorCommands" yaml:"editorCommands"`
69+
// Volumes []Volume `json:"volumes" yaml:"volumes"`
70+
// Ports []ExposedPort `json:"ports" yaml:"ports"`
71+
MemoryLimit string `json:"memoryLimit" yaml:"memoryLimit"`
72+
MountSources bool `json:"mountSources" yaml:"mountSources"`
73+
}
74+

pkg/apis/workspaces/v1alpha1/zz_generated.deepcopy.go

Lines changed: 69 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)