Skip to content

Commit 36a1ea5

Browse files
committed
Add support for component contributions in DevWorkspace custom resource
Add field `.spec.contributions` to the DevWorkspace custom resource to allow specifying additional resources (e.g. editors, etc.) that should be included in a DevWorkspace. This allows for adding additional components to a workspace while using the .spec.template field to store a devfile. Signed-off-by: Angel Misevski <[email protected]>
1 parent 351f05b commit 36a1ea5

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package v1alpha2
2+
3+
import attributes "github.com/devfile/api/v2/pkg/attributes"
4+
5+
type ComponentContribution struct {
6+
// Mandatory name that allows referencing the component
7+
// from other elements (such as commands) or from an external
8+
// devfile that may reference this component through a parent or a plugin.
9+
// +kubebuilder:validation:Pattern=^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
10+
// +kubebuilder:validation:MaxLength=63
11+
Name string `json:"name"`
12+
// Map of implementation-dependant free-form YAML attributes.
13+
// +optional
14+
// +kubebuilder:validation:Type=object
15+
// +kubebuilder:pruning:PreserveUnknownFields
16+
// +kubebuilder:validation:Schemaless
17+
Attributes attributes.Attributes `json:"attributes,omitempty"`
18+
// Reference to a remote Devfile or DevWorkspace resource to be included
19+
// in the DevWorkspace.
20+
PluginComponent `json:",inline"`
21+
}

pkg/apis/workspaces/v1alpha2/devworkspace_types.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ import (
77

88
// DevWorkspaceSpec defines the desired state of DevWorkspace
99
type DevWorkspaceSpec struct {
10-
Started bool `json:"started"`
11-
RoutingClass string `json:"routingClass,omitempty"`
12-
Template DevWorkspaceTemplateSpec `json:"template,omitempty"`
10+
Started bool `json:"started"`
11+
RoutingClass string `json:"routingClass,omitempty"`
12+
Template DevWorkspaceTemplateSpec `json:"template,omitempty"`
13+
Contributions []ComponentContribution `json:"contributions,omitempty"`
1314
}
1415

1516
// DevWorkspaceStatus defines the observed state of DevWorkspace

0 commit comments

Comments
 (0)