Skip to content

Commit

Permalink
Implement agreement on issue #9
Browse files Browse the repository at this point in the history
Signed-off-by: David Festal <dfestal@redhat.com>
  • Loading branch information
davidfestal committed Apr 3, 2020
1 parent 8145b87 commit 6c99166
Show file tree
Hide file tree
Showing 13 changed files with 160 additions and 86 deletions.
32 changes: 22 additions & 10 deletions deploy/crds/workspaces.ecd.eclipse.org_devworkspaces_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,6 @@ spec:
cheEditor:
description: CheEditor component
properties:
alias:
type: string
locationType:
description: Type of plugin location
enum:
Expand All @@ -318,6 +316,11 @@ spec:
type: string
memoryLimit:
type: string
name:
description: Optional name that allows referencing the
component in commands, or inside a parent If omitted
it will be infered from the location (uri or registryEntry)
type: string
registryEntry:
description: Location of an entry inside a plugin registry
properties:
Expand All @@ -335,8 +338,6 @@ spec:
chePlugin:
description: ChePlugin component
properties:
alias:
type: string
locationType:
description: Type of plugin location
enum:
Expand All @@ -345,6 +346,11 @@ spec:
type: string
memoryLimit:
type: string
name:
description: Optional name that allows referencing the
component in commands, or inside a parent If omitted
it will be infered from the location (uri or registryEntry)
type: string
registryEntry:
description: Location of an entry inside a plugin registry
properties:
Expand All @@ -362,8 +368,6 @@ spec:
container:
description: Container component
properties:
alias:
type: string
endpoints:
items:
properties:
Expand Down Expand Up @@ -474,32 +478,40 @@ spec:
kubernetes:
description: Kubernetes component
properties:
alias:
type: string
inlined:
description: Reference to the plugin definition
type: string
locationType:
description: Type of Kubernetes-like location
type: string
name:
description: Optional name that allows referencing the
component in commands, or inside a parent
type: string
url:
description: Location in a plugin registry
type: string
required:
- name
type: object
openshift:
description: Openshift component
properties:
alias:
type: string
inlined:
description: Reference to the plugin definition
type: string
locationType:
description: Type of Kubernetes-like location
type: string
name:
description: Optional name that allows referencing the
component in commands, or inside a parent
type: string
url:
description: Location in a plugin registry
type: string
required:
- name
type: object
type:
description: Type of project source
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,6 @@ spec:
cheEditor:
description: CheEditor component
properties:
alias:
type: string
locationType:
description: Type of plugin location
enum:
Expand All @@ -308,6 +306,11 @@ spec:
type: string
memoryLimit:
type: string
name:
description: Optional name that allows referencing the component
in commands, or inside a parent If omitted it will be infered
from the location (uri or registryEntry)
type: string
registryEntry:
description: Location of an entry inside a plugin registry
properties:
Expand All @@ -325,8 +328,6 @@ spec:
chePlugin:
description: ChePlugin component
properties:
alias:
type: string
locationType:
description: Type of plugin location
enum:
Expand All @@ -335,6 +336,11 @@ spec:
type: string
memoryLimit:
type: string
name:
description: Optional name that allows referencing the component
in commands, or inside a parent If omitted it will be infered
from the location (uri or registryEntry)
type: string
registryEntry:
description: Location of an entry inside a plugin registry
properties:
Expand All @@ -352,8 +358,6 @@ spec:
container:
description: Container component
properties:
alias:
type: string
endpoints:
items:
properties:
Expand Down Expand Up @@ -463,32 +467,40 @@ spec:
kubernetes:
description: Kubernetes component
properties:
alias:
type: string
inlined:
description: Reference to the plugin definition
type: string
locationType:
description: Type of Kubernetes-like location
type: string
name:
description: Optional name that allows referencing the component
in commands, or inside a parent
type: string
url:
description: Location in a plugin registry
type: string
required:
- name
type: object
openshift:
description: Openshift component
properties:
alias:
type: string
inlined:
description: Reference to the plugin definition
type: string
locationType:
description: Type of Kubernetes-like location
type: string
name:
description: Optional name that allows referencing the component
in commands, or inside a parent
type: string
url:
description: Location in a plugin registry
type: string
required:
- name
type: object
type:
description: Type of project source
Expand Down
1 change: 1 addition & 0 deletions devfile-support/samples/custom-devfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ projects:
custom-info: "connexion-information"
components:
- kubernetes:
name: "production"
url: "https://somewhere/production-environment.yaml"
- custom:
componentClass: "NewComponentType"
Expand Down
1 change: 1 addition & 0 deletions devfile-support/samples/sample-devfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ components:
field2: ""
name: "myNewComponent"
- kubernetes:
name: "production"
url: "https://somewhere/production-environment.yaml"
1 change: 0 additions & 1 deletion pkg/apis/workspaces/v1alpha1/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const (
// Workspace component: Anything that will bring additional features / tooling / behaviour / context
// to the workspace, in order to make working in it easier.
type BaseComponent struct {
Alias string `json:"alias,omitempty"`
}

type Component struct {
Expand Down
6 changes: 5 additions & 1 deletion pkg/apis/workspaces/v1alpha1/kubernetesLikeComponent.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ package v1alpha1
// +k8s:openapi-gen=true
// +union
type K8sLikeComponentLocation struct {
// Optional name that allows referencing the component
// in commands, or inside a parent
Name string `json:"name"`

// Type of Kubernetes-like location
// +
// +unionDiscriminator
Expand All @@ -20,7 +24,7 @@ type K8sLikeComponentLocation struct {

type K8sLikeComponent struct {
BaseComponent `json:",inline"`
Location K8sLikeComponentLocation `json:",inline"`
Location K8sLikeComponentLocation `json:",inline"`
}

// Component that allows partly importing Kubernetes resources into the workspace POD
Expand Down
15 changes: 11 additions & 4 deletions pkg/apis/workspaces/v1alpha1/pluginLikeComponents.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package v1alpha1

type RegistryEntryPluginLocation struct {
Id string `json:"id"`
Id string `json:"id"`

// +optional
BaseUrl string `json:"baseUrl,omitempty"`
Expand All @@ -13,8 +13,8 @@ type RegistryEntryPluginLocation struct {
type PluginLocationType string

const (
RegistryEntryPluginLocationType PluginLocationType = "RegistryEntry"
UriPluginLocationType PluginLocationType = "Uri"
RegistryEntryPluginLocationType PluginLocationType = "RegistryEntry"
UriPluginLocationType PluginLocationType = "Uri"
)

// +k8s:openapi-gen=true
Expand All @@ -37,7 +37,14 @@ type ChePluginLocation struct {

type PluginLikeComponent struct {
BaseComponent `json:",inline"`
MemoryLimit string `json:"memoryLimit,omitempty"`

// +optional
// Optional name that allows referencing the component
// in commands, or inside a parent
// If omitted it will be infered from the location (uri or registryEntry)
Name string `json:"name,omitempty"`

MemoryLimit string `json:"memoryLimit,omitempty"`
ChePluginLocation `json:",inline"`
}

Expand Down
9 changes: 9 additions & 0 deletions pkg/apis/workspaces/v1alpha1/zz_generated.openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,13 @@ func schema_pkg_apis_workspaces_v1alpha1_K8sLikeComponentLocation(ref common.Ref
SchemaProps: spec.SchemaProps{
Type: []string{"object"},
Properties: map[string]spec.Schema{
"name": {
SchemaProps: spec.SchemaProps{
Description: "Optional name that allows referencing the component in commands, or inside a parent",
Type: []string{"string"},
Format: "",
},
},
"locationType": {
SchemaProps: spec.SchemaProps{
Description: "Type of Kubernetes-like location",
Expand All @@ -320,6 +327,7 @@ func schema_pkg_apis_workspaces_v1alpha1_K8sLikeComponentLocation(ref common.Ref
},
},
},
Required: []string{"name"},
},
VendorExtensible: spec.VendorExtensible{
Extensions: spec.Extensions{
Expand All @@ -328,6 +336,7 @@ func schema_pkg_apis_workspaces_v1alpha1_K8sLikeComponentLocation(ref common.Ref
"discriminator": "locationType",
"fields-to-discriminateBy": map[string]interface{}{
"inlined": "Inlined",
"name": "Name",
"url": "Url",
},
},
Expand Down
1 change: 1 addition & 0 deletions samples/example.devworkspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ spec:
field1: ""
field2: ""
- kubernetes:
name: "production"
url: "https://somewhere/production-environment.yaml"
Loading

0 comments on commit 6c99166

Please sign in to comment.