Skip to content

Commit

Permalink
Add support for component contributions in DevWorkspace custom resource
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
amisevsk committed Sep 13, 2022
1 parent 351f05b commit 36a1ea5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
21 changes: 21 additions & 0 deletions pkg/apis/workspaces/v1alpha2/component_contribution.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package v1alpha2

import attributes "github.com/devfile/api/v2/pkg/attributes"

type ComponentContribution struct {
// Mandatory name that allows referencing the component
// from other elements (such as commands) or from an external
// devfile that may reference this component through a parent or a plugin.
// +kubebuilder:validation:Pattern=^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
// +kubebuilder:validation:MaxLength=63
Name string `json:"name"`
// Map of implementation-dependant free-form YAML attributes.
// +optional
// +kubebuilder:validation:Type=object
// +kubebuilder:pruning:PreserveUnknownFields
// +kubebuilder:validation:Schemaless
Attributes attributes.Attributes `json:"attributes,omitempty"`
// Reference to a remote Devfile or DevWorkspace resource to be included
// in the DevWorkspace.
PluginComponent `json:",inline"`
}
7 changes: 4 additions & 3 deletions pkg/apis/workspaces/v1alpha2/devworkspace_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import (

// DevWorkspaceSpec defines the desired state of DevWorkspace
type DevWorkspaceSpec struct {
Started bool `json:"started"`
RoutingClass string `json:"routingClass,omitempty"`
Template DevWorkspaceTemplateSpec `json:"template,omitempty"`
Started bool `json:"started"`
RoutingClass string `json:"routingClass,omitempty"`
Template DevWorkspaceTemplateSpec `json:"template,omitempty"`
Contributions []ComponentContribution `json:"contributions,omitempty"`
}

// DevWorkspaceStatus defines the observed state of DevWorkspace
Expand Down

0 comments on commit 36a1ea5

Please sign in to comment.