Skip to content

Commit

Permalink
Finalize workspace -> devworkspace renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
sleshchenko committed Mar 31, 2021
1 parent 2c5cc19 commit 9aff1eb
Show file tree
Hide file tree
Showing 56 changed files with 1,782 additions and 1,764 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ From these Go sources, several files are generated:
- A Kubernetes Custom Resource Definition(CRD) with an embedded OpenApi schema,
- json schemas (in the [schemas](schemas) folder) generated from the above CRD, to specify the syntax of:
- the DevWorkspace CRD itself;
- the DevWorkspaceTemplate CRD (a workspace content, without runtime information);
- the DevWorkspaceTemplate CRD (a devworkspace content, without runtime information);
- the Devfile 2.0.0 format, which is generated from the `DevWorkspace` API.

Generated files are created by a build script (see section [How to build](#how-to-build)).
Expand Down Expand Up @@ -45,7 +45,7 @@ In order to test existing or new Devfile 2.0 or DevWorkspace sample files in a s

[![Contribute](https://www.eclipse.org/che/contribute.svg)](https://che.openshift.io/f/?url=https://github.com/devfile/api)

As soon as the workspace is opened, you should be able to:
As soon as the devworkspace is opened, you should be able to:
- open the `yaml` files in the following folders:
- `samples/`
- `devfile-support/samples`
Expand Down
388 changes: 197 additions & 191 deletions crds/workspace.devfile.io_devworkspaces.v1beta1.yaml

Large diffs are not rendered by default.

388 changes: 197 additions & 191 deletions crds/workspace.devfile.io_devworkspaces.yaml

Large diffs are not rendered by default.

371 changes: 187 additions & 184 deletions crds/workspace.devfile.io_devworkspacetemplates.v1beta1.yaml

Large diffs are not rendered by default.

371 changes: 187 additions & 184 deletions crds/workspace.devfile.io_devworkspacetemplates.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion generator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func main() {

cmd := &cobra.Command{
Use: "generator",
Short: "Generates various types of files from the `workspaces` K8S API source code.",
Short: "Generates various types of files from the `workspace` K8S API source code.",
Long: "Generates additional GO source files (for devfile overriding, union support, deep-copy), K8S CRD YAML files and Json Schemas from the from the `workspaces` K8S API source code.",
Example: `
# Generate Plugin Overrides based on the workspaces/v1alpha2 K8S API
Expand Down
6 changes: 3 additions & 3 deletions pkg/apis/workspaces/v1alpha1/WorkspacePodContribution.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
corev1 "k8s.io/api/core/v1"
)

type WorkspacePodContributions struct {
type DevWorkspacePodContributions struct {
// +optional
// +patchMergeKey=name
// +patchStrategy=merge,retainKeys
Expand All @@ -15,15 +15,15 @@ type WorkspacePodContributions struct {
// +patchMergeKey=name
// +patchStrategy=merge
Containers []corev1.Container `json:"containers" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,2,rep,name=containers"`
// ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by the workspace Pod.
// ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by the devworkspace Pod.
// If specified, these secrets will be passed to individual puller implementations for them to use. For example,
// in the case of docker, only DockerConfig type secrets are honored.
// More info: https://kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-pod
// +optional
// +patchMergeKey=name
// +patchStrategy=merge
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,15,rep,name=imagePullSecrets"`
// List of workspace-wide environment variables to set in all containers of the workspace POD.
// List of devworkspace-wide environment variables to set in all containers of the devworkspace POD.
// +optional
// +patchMergeKey=name
// +patchStrategy=merge
Expand Down
8 changes: 4 additions & 4 deletions pkg/apis/workspaces/v1alpha1/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ type LabeledCommand struct {
// +k8s:openapi-gen=true
// +union
type Command struct {
// Type of workspace command
// Type of devworkspace command
// +unionDiscriminator
// +optional
CommandType CommandType `json:"commandType,omitempty"`
Expand All @@ -72,15 +72,15 @@ type Command struct {
Exec *ExecCommand `json:"exec,omitempty"`

// Command that consists in applying a given component definition,
// typically bound to a workspace event.
// typically bound to a devworkspace event.
//
// For example, when an `apply` command is bound to a `preStart` event,
// and references a `container` component, it will start the container as a
// K8S initContainer in the workspace POD, unless the component has its
// K8S initContainer in the devworkspace POD, unless the component has its
// `dedicatedPod` field set to `true`.
//
// When no `apply` command exist for a given component,
// it is assumed the component will be applied at workspace start
// it is assumed the component will be applied at devworkspace start
// by default.
// +optional
Apply *ApplyCommand `json:"apply,omitempty"`
Expand Down
10 changes: 5 additions & 5 deletions pkg/apis/workspaces/v1alpha1/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ const (
CustomComponentType ComponentType = "Custom"
)

// Workspace component: Anything that will bring additional features / tooling / behaviour / context
// to the workspace, in order to make working in it easier.
// DevWorkspace component: Anything that will bring additional features / tooling / behaviour / context
// to the devworkspace, in order to make working in it easier.
type BaseComponent struct {
}

Expand All @@ -30,7 +30,7 @@ type Component struct {
// +optional
ComponentType ComponentType `json:"componentType,omitempty"`

// Allows adding and configuring workspace-related containers
// Allows adding and configuring devworkspace-related containers
// +optional
Container *ContainerComponent `json:"container,omitempty"`

Expand All @@ -48,14 +48,14 @@ type Component struct {
// +optional
Plugin *PluginComponent `json:"plugin,omitempty"`

// Allows importing into the workspace the Kubernetes resources
// Allows importing into the devworkspace the Kubernetes resources
// defined in a given manifest. For example this allows reusing the Kubernetes
// definitions used to deploy some runtime components in production.
//
// +optional
Kubernetes *KubernetesComponent `json:"kubernetes,omitempty"`

// Allows importing into the workspace the OpenShift resources
// Allows importing into the devworkspace the OpenShift resources
// defined in a given manifest. For example this allows reusing the OpenShift
// definitions used to deploy some runtime components in production.
//
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/workspaces/v1alpha1/containerComponent.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package v1alpha1

// Component that allows the developer to add a configured container into his workspace
// Component that allows the developer to add a configured container into his devworkspace
type ContainerComponent struct {
BaseComponent `json:",inline"`
Container `json:",inline"`
Expand Down
16 changes: 8 additions & 8 deletions pkg/apis/workspaces/v1alpha1/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (

func convertDevWorkspaceTo_v1alpha2(src *DevWorkspace, dest *v1alpha2.DevWorkspace) error {
dest.ObjectMeta = src.ObjectMeta
dest.Status.WorkspaceId = src.Status.WorkspaceId
dest.Status.DevWorkspaceId = src.Status.DevWorkspaceId
dest.Status.IdeUrl = src.Status.IdeUrl
dest.Status.Phase = v1alpha2.WorkspacePhase(src.Status.Phase)
dest.Status.Phase = v1alpha2.DevWorkspacePhase(src.Status.Phase)
dest.Status.Message = src.Status.Message
convertConditionsTo_v1alpha2(src, dest)
dest.Spec.RoutingClass = src.Spec.RoutingClass
Expand All @@ -19,9 +19,9 @@ func convertDevWorkspaceTo_v1alpha2(src *DevWorkspace, dest *v1alpha2.DevWorkspa

func convertDevWorkspaceFrom_v1alpha2(src *v1alpha2.DevWorkspace, dest *DevWorkspace) error {
dest.ObjectMeta = src.ObjectMeta
dest.Status.WorkspaceId = src.Status.WorkspaceId
dest.Status.DevWorkspaceId = src.Status.DevWorkspaceId
dest.Status.IdeUrl = src.Status.IdeUrl
dest.Status.Phase = WorkspacePhase(src.Status.Phase)
dest.Status.Phase = DevWorkspacePhase(src.Status.Phase)
dest.Status.Message = src.Status.Message
convertConditionsFrom_v1alpha2(src, dest)
dest.Spec.RoutingClass = src.Spec.RoutingClass
Expand Down Expand Up @@ -142,24 +142,24 @@ func convertDevWorkspaceTemplateSpecFrom_v1alpha2(src *v1alpha2.DevWorkspaceTemp

func convertConditionsTo_v1alpha2(src *DevWorkspace, dest *v1alpha2.DevWorkspace) {
for _, srcCondition := range src.Status.Conditions {
dstCondition := v1alpha2.WorkspaceCondition{}
dstCondition := v1alpha2.DevWorkspaceCondition{}
dstCondition.Status = srcCondition.Status
dstCondition.LastTransitionTime = srcCondition.LastTransitionTime
dstCondition.Message = srcCondition.Message
dstCondition.Reason = srcCondition.Reason
dstCondition.Type = v1alpha2.WorkspaceConditionType(srcCondition.Type)
dstCondition.Type = v1alpha2.DevWorkspaceConditionType(srcCondition.Type)
dest.Status.Conditions = append(dest.Status.Conditions, dstCondition)
}
}

func convertConditionsFrom_v1alpha2(src *v1alpha2.DevWorkspace, dest *DevWorkspace) {
for _, srcCondition := range src.Status.Conditions {
dstCondition := WorkspaceCondition{}
dstCondition := DevWorkspaceCondition{}
dstCondition.Status = srcCondition.Status
dstCondition.LastTransitionTime = srcCondition.LastTransitionTime
dstCondition.Message = srcCondition.Message
dstCondition.Reason = srcCondition.Reason
dstCondition.Type = WorkspaceConditionType(srcCondition.Type)
dstCondition.Type = DevWorkspaceConditionType(srcCondition.Type)
dest.Status.Conditions = append(dest.Status.Conditions, dstCondition)
}
}
20 changes: 10 additions & 10 deletions pkg/apis/workspaces/v1alpha1/conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import (
const fuzzIterations = 500
const fuzzNilChance = 0.2

var devWorkspaceFuzzFunc = func(workspace *DevWorkspace, c fuzz.Continue) {
c.Fuzz(&workspace.Status)
c.Fuzz(&workspace.Spec)
var devworkspaceFuzzFunc = func(dw *DevWorkspace, c fuzz.Continue) {
c.Fuzz(&dw.Status)
c.Fuzz(&dw.Spec)
}

var devWorkspaceTemplateFuzzFunc = func(workspace *DevWorkspaceTemplate, c fuzz.Continue) {
c.Fuzz(&workspace.Spec)
var devworkspaceTemplateFuzzFunc = func(dwt *DevWorkspaceTemplate, c fuzz.Continue) {
c.Fuzz(&dwt.Spec)
}

var componentFuzzFunc = func(component *Component, c fuzz.Continue) {
Expand Down Expand Up @@ -101,9 +101,9 @@ var parentFuzzFunc = func(parent *Parent, c fuzz.Continue) {
}
}

var conditionFuzzFunc = func(condition *WorkspaceCondition, c fuzz.Continue) {
var conditionFuzzFunc = func(condition *DevWorkspaceCondition, c fuzz.Continue) {
condition.Reason = c.RandString()
condition.Type = WorkspaceConditionType(c.RandString())
condition.Type = DevWorkspaceConditionType(c.RandString())
condition.Message = c.RandString()
}

Expand Down Expand Up @@ -176,7 +176,7 @@ var rawExtFuzzFunc = func(embeddedResource *runtime.RawExtension, c fuzz.Continu

func TestDevWorkspaceConversion_v1alpha1(t *testing.T) {
f := fuzz.New().NilChance(fuzzNilChance).MaxDepth(100).Funcs(
devWorkspaceFuzzFunc,
devworkspaceFuzzFunc,
conditionFuzzFunc,
parentFuzzFunc,
componentFuzzFunc,
Expand Down Expand Up @@ -208,7 +208,7 @@ func TestDevWorkspaceConversion_v1alpha1(t *testing.T) {

func TestDevWorkspaceTemplateConversion_v1alpha1(t *testing.T) {
f := fuzz.New().NilChance(fuzzNilChance).MaxDepth(100).Funcs(
devWorkspaceTemplateFuzzFunc,
devworkspaceTemplateFuzzFunc,
conditionFuzzFunc,
parentFuzzFunc,
componentFuzzFunc,
Expand Down Expand Up @@ -240,7 +240,7 @@ func TestDevWorkspaceTemplateConversion_v1alpha1(t *testing.T) {

func BenchmarkDevWorkspaceConversion(b *testing.B) {
f := fuzz.New().NilChance(fuzzNilChance).MaxDepth(100).Funcs(
devWorkspaceFuzzFunc,
devworkspaceFuzzFunc,
conditionFuzzFunc,
parentFuzzFunc,
componentFuzzFunc,
Expand Down
10 changes: 5 additions & 5 deletions pkg/apis/workspaces/v1alpha1/devworkspaceTemplateSpec.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package v1alpha1

// Structure of the workspace. This is also the specification of a workspace template.
// Structure of the devworkspace. This is also the specification of a devworkspace template.
// +k8s:openapi-gen=true
type DevWorkspaceTemplateSpec struct {
// Parent workspace template
// Parent devworkspace template
// +optional
Parent *Parent `json:"parent,omitempty"`

DevWorkspaceTemplateSpecContent `json:",inline"`
}

type DevWorkspaceTemplateSpecContent struct {
// Predefined, ready-to-use, workspace-related commands
// Predefined, ready-to-use, devworkspace-related commands
// +optional
//
Commands []Command `json:"commands,omitempty" patchStrategy:"merge" patchMergeKey:"id"`
Expand All @@ -21,15 +21,15 @@ type DevWorkspaceTemplateSpecContent struct {
// +optional
Events *Events `json:"events,omitempty"`

// Projects worked on in the workspace, containing names and sources locations
// Projects worked on in the devworkspace, containing names and sources locations
// +optional
Projects []Project `json:"projects,omitempty" patchStrategy:"merge" patchMergeKey:"name"`

// StarterProjects is a project that can be used as a starting point when bootstrapping new projects
// +optional
StarterProjects []StarterProject `json:"starterProjects,omitempty"`

// List of the workspace components, such as editor and plugins,
// List of the devworkspace components, such as editor and plugins,
// user-provided containers, or other types of components
// +optional
Components []Component `json:"components,omitempty" patchStrategy:"merge" patchMergeKey:"name"`
Expand Down
54 changes: 27 additions & 27 deletions pkg/apis/workspaces/v1alpha1/devworkspace_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,34 @@ type DevWorkspaceSpec struct {
// DevWorkspaceStatus defines the observed state of DevWorkspace
// +k8s:openapi-gen=true
type DevWorkspaceStatus struct {
// Id of the workspace
WorkspaceId string `json:"workspaceId"`
// Id of the devworkspace
DevWorkspaceId string `json:"devworkspaceId"`
// URL at which the Worksace Editor can be joined
IdeUrl string `json:"ideUrl,omitempty"`
Phase WorkspacePhase `json:"phase,omitempty"`
IdeUrl string `json:"ideUrl,omitempty"`
Phase DevWorkspacePhase `json:"phase,omitempty"`
// Conditions represent the latest available observations of an object's state
Conditions []WorkspaceCondition `json:"conditions,omitempty"`
Conditions []DevWorkspaceCondition `json:"conditions,omitempty"`
// Message is a short user-readable message giving additional information
// about an object's state
Message string `json:"message,omitempty"`
}

type WorkspacePhase string
type DevWorkspacePhase string

// Valid workspace Statuses
// Valid devworkspace Statuses
const (
WorkspaceStatusStarting WorkspacePhase = "Starting"
WorkspaceStatusRunning WorkspacePhase = "Running"
WorkspaceStatusStopped WorkspacePhase = "Stopped"
WorkspaceStatusStopping WorkspacePhase = "Stopping"
WorkspaceStatusFailed WorkspacePhase = "Failed"
WorkspaceStatusError WorkspacePhase = "Error"
DevWorkspaceStatusStarting DevWorkspacePhase = "Starting"
DevWorkspaceStatusRunning DevWorkspacePhase = "Running"
DevWorkspaceStatusStopped DevWorkspacePhase = "Stopped"
DevWorkspaceStatusStopping DevWorkspacePhase = "Stopping"
DevWorkspaceStatusFailed DevWorkspacePhase = "Failed"
DevWorkspaceStatusError DevWorkspacePhase = "Error"
)

// WorkspaceCondition contains details for the current condition of this workspace.
type WorkspaceCondition struct {
// DevWorkspaceCondition contains details for the current condition of this devworkspace.
type DevWorkspaceCondition struct {
// Type is the type of the condition.
Type WorkspaceConditionType `json:"type"`
Type DevWorkspaceConditionType `json:"type"`
// Phase is the status of the condition.
// Can be True, False, Unknown.
Status corev1.ConditionStatus `json:"status"`
Expand All @@ -55,16 +55,16 @@ type WorkspaceCondition struct {
Message string `json:"message,omitempty"`
}

// Types of conditions reported by workspace
type WorkspaceConditionType string
// Types of conditions reported by devworkspace
type DevWorkspaceConditionType string

const (
WorkspaceComponentsReady WorkspaceConditionType = "ComponentsReady"
WorkspaceRoutingReady WorkspaceConditionType = "RoutingReady"
WorkspaceServiceAccountReady WorkspaceConditionType = "ServiceAccountReady"
WorkspaceReady WorkspaceConditionType = "Ready"
WorkspaceFailedStart WorkspaceConditionType = "FailedStart"
WorkspaceError WorkspaceConditionType = "Error"
DevWorkspaceComponentsReady DevWorkspaceConditionType = "ComponentsReady"
DevWorkspaceRoutingReady DevWorkspaceConditionType = "RoutingReady"
DevWorkspaceServiceAccountReady DevWorkspaceConditionType = "ServiceAccountReady"
DevWorkspaceReady DevWorkspaceConditionType = "Ready"
DevWorkspaceFailedStart DevWorkspaceConditionType = "FailedStart"
DevWorkspaceError DevWorkspaceConditionType = "Error"
)

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand All @@ -73,9 +73,9 @@ const (
// +k8s:openapi-gen=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:path=devworkspaces,scope=Namespaced
// +kubebuilder:printcolumn:name="Workspace ID",type="string",JSONPath=".status.workspaceId",description="The workspace's unique id"
// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="The current workspace startup phase"
// +kubebuilder:printcolumn:name="URL",type="string",JSONPath=".status.ideUrl",description="Url endpoint for accessing workspace"
// +kubebuilder:printcolumn:name="DevWorkspace ID",type="string",JSONPath=".status.devworkspaceId",description="The devworkspace's unique id"
// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="The current devworkspace startup phase"
// +kubebuilder:printcolumn:name="URL",type="string",JSONPath=".status.ideUrl",description="Url endpoint for accessing devworkspace"
type DevWorkspace struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down
8 changes: 4 additions & 4 deletions pkg/apis/workspaces/v1alpha1/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ const (
// Endpoint will be exposed on the public network, typically through
// a K8S ingress or an OpenShift route
PublicEndpointExposure EndpointExposure = "public"
// Endpoint will be exposed internally outside of the main workspace POD,
// Endpoint will be exposed internally outside of the main devworkspace POD,
// typically by K8S services, to be consumed by other elements running
// on the same cloud internal network.
InternalEndpointExposure EndpointExposure = "internal"
// Endpoint will not be exposed and will only be accessible
// inside the main workspace POD, on a local address.
// inside the main devworkspace POD, on a local address.
NoneEndpointExposure EndpointExposure = "none"
)

Expand All @@ -53,12 +53,12 @@ type Endpoint struct {
// - `public` means that the endpoint will be exposed on the public network, typically through
// a K8S ingress or an OpenShift route.
//
// - `internal` means that the endpoint will be exposed internally outside of the main workspace POD,
// - `internal` means that the endpoint will be exposed internally outside of the main devworkspace POD,
// typically by K8S services, to be consumed by other elements running
// on the same cloud internal network.
//
// - `none` means that the endpoint will not be exposed and will only be accessible
// inside the main workspace POD, on a local address.
// inside the main devworkspace POD, on a local address.
//
// Default value is `public`
// +optional
Expand Down
Loading

0 comments on commit 9aff1eb

Please sign in to comment.