From f95e0f80877f87e8ef9fd61faa36a690aec15333 Mon Sep 17 00:00:00 2001 From: David Kwon Date: Mon, 13 Dec 2021 12:59:07 -0500 Subject: [PATCH 1/2] feat: set CHECLUSTER_CR_NAMESPACE and CHECLUSTER_CR_NAME env vars for dashboard Signed-off-by: David Kwon --- .../dashboard/dashboard_deployment_test.go | 24 +++++++++++++++++++ pkg/deploy/dashboard/deployment_dashboard.go | 6 +++++ 2 files changed, 30 insertions(+) diff --git a/pkg/deploy/dashboard/dashboard_deployment_test.go b/pkg/deploy/dashboard/dashboard_deployment_test.go index 5538a7b868..0859dc4a73 100644 --- a/pkg/deploy/dashboard/dashboard_deployment_test.go +++ b/pkg/deploy/dashboard/dashboard_deployment_test.go @@ -136,6 +136,14 @@ func TestDashboardDeploymentEnvVars(t *testing.T) { Name: "CHE_URL", Value: "http://che.com", }, + { + Name: "CHECLUSTER_CR_NAMESPACE", + Value: "eclipse-che", + }, + { + Name: "CHECLUSTER_CR_NAME", + Value: "eclipse-che", + }, { Name: "CHE_INTERNAL_URL", Value: "http://che-host.eclipse-che.svc:8080/api", @@ -168,6 +176,14 @@ func TestDashboardDeploymentEnvVars(t *testing.T) { Name: "CHE_URL", Value: "http://che.com", }, + { + Name: "CHECLUSTER_CR_NAMESPACE", + Value: "eclipse-che", + }, + { + Name: "CHECLUSTER_CR_NAME", + Value: "eclipse-che", + }, { Name: "OPENSHIFT_CONSOLE_URL", }, @@ -208,6 +224,14 @@ func TestDashboardDeploymentEnvVars(t *testing.T) { Name: "CHE_URL", Value: "http://che.com", }, + { + Name: "CHECLUSTER_CR_NAMESPACE", + Value: "eclipse-che", + }, + { + Name: "CHECLUSTER_CR_NAME", + Value: "eclipse-che", + }, { Name: "CHE_INTERNAL_URL", Value: "http://che-host.eclipse-che.svc:8080/api", diff --git a/pkg/deploy/dashboard/deployment_dashboard.go b/pkg/deploy/dashboard/deployment_dashboard.go index 87b8af508d..77012f0a0e 100644 --- a/pkg/deploy/dashboard/deployment_dashboard.go +++ b/pkg/deploy/dashboard/deployment_dashboard.go @@ -56,6 +56,12 @@ func (d *DashboardReconciler) getDashboardDeploymentSpec(ctx *deploy.DeployConte corev1.EnvVar{ Name: "CHE_URL", Value: util.GetCheURL(ctx.CheCluster)}, + corev1.EnvVar{ + Name: "CHECLUSTER_CR_NAMESPACE", + Value: ctx.CheCluster.Namespace}, + corev1.EnvVar{ + Name: "CHECLUSTER_CR_NAME", + Value: ctx.CheCluster.Name}, ) if ctx.CheCluster.IsInternalClusterSVCNamesEnabled() { From 051d7bd9d30d1b48a9752b095426c39f2b19aee1 Mon Sep 17 00:00:00 2001 From: David Kwon Date: Mon, 13 Dec 2021 13:28:17 -0500 Subject: [PATCH 2/2] feat: add server.workspaceDefaultPlugins field to CheCluster schema Signed-off-by: David Kwon --- api/v1/checluster_types.go | 10 +++++++ api/v1/zz_generated.deepcopy.go | 27 +++++++++++++++++++ .../che-operator.clusterserviceversion.yaml | 4 +-- .../manifests/org_v1_che_crd.yaml | 16 +++++++++++ .../che-operator.clusterserviceversion.yaml | 4 +-- .../manifests/org_v1_che_crd.yaml | 16 +++++++++++ config/crd/bases/org_v1_che_crd-v1beta1.yaml | 15 +++++++++++ config/crd/bases/org_v1_che_crd.yaml | 16 +++++++++++ helmcharts/next/crds/org_v1_che_crd.yaml | 16 +++++++++++ 9 files changed, 120 insertions(+), 4 deletions(-) diff --git a/api/v1/checluster_types.go b/api/v1/checluster_types.go index 6fc693683b..fe3f4d0651 100644 --- a/api/v1/checluster_types.go +++ b/api/v1/checluster_types.go @@ -341,6 +341,9 @@ type CheClusterSpecServer struct { // The Che server route custom settings. // +optional CheServerRoute RouteCustomSettings `json:"cheServerRoute,omitempty"` + // Default plug-ins applied to Devworkspaces. + // +optional + WorkspacesDefaultPlugins []WorkspacesDefaultPlugins `json:"workspacesDefaultPlugins,omitempty"` } // +k8s:openapi-gen=true @@ -546,6 +549,13 @@ type ResourcesCustomSettings struct { Limits Resources `json:"limits,omitempty"` } +type WorkspacesDefaultPlugins struct { + // The editor id to specify default plug-ins for. + Editor string `json:"editor,omitempty"` + // Default plug-in ids and uris for the specified editor. + Plugins []string `json:"plugins,omitempty"` +} + // List of resources type Resources struct { // Memory, in bytes. (500Gi = 500GiB = 500 * 1024 * 1024 * 1024) diff --git a/api/v1/zz_generated.deepcopy.go b/api/v1/zz_generated.deepcopy.go index aaa962bb6b..53ca7c6e2e 100644 --- a/api/v1/zz_generated.deepcopy.go +++ b/api/v1/zz_generated.deepcopy.go @@ -545,6 +545,13 @@ func (in *CheClusterSpecServer) DeepCopyInto(out *CheClusterSpecServer) { } in.CheServerIngress.DeepCopyInto(&out.CheServerIngress) in.CheServerRoute.DeepCopyInto(&out.CheServerRoute) + if in.WorkspacesDefaultPlugins != nil { + in, out := &in.WorkspacesDefaultPlugins, &out.WorkspacesDefaultPlugins + *out = make([]WorkspacesDefaultPlugins, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheClusterSpecServer. @@ -708,3 +715,23 @@ func (in *SftpServerConfing) DeepCopy() *SftpServerConfing { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkspacesDefaultPlugins) DeepCopyInto(out *WorkspacesDefaultPlugins) { + *out = *in + if in.Plugins != nil { + in, out := &in.Plugins, &out.Plugins + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspacesDefaultPlugins. +func (in *WorkspacesDefaultPlugins) DeepCopy() *WorkspacesDefaultPlugins { + if in == nil { + return nil + } + out := new(WorkspacesDefaultPlugins) + in.DeepCopyInto(out) + return out +} diff --git a/bundle/next-all-namespaces/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml b/bundle/next-all-namespaces/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml index 1698b73f01..d04ec9e10a 100644 --- a/bundle/next-all-namespaces/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml +++ b/bundle/next-all-namespaces/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml @@ -126,7 +126,7 @@ metadata: operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 repository: https://github.com/eclipse-che/che-operator support: Eclipse Foundation - name: eclipse-che-preview-openshift.v7.41.0-386.next-all-namespaces + name: eclipse-che-preview-openshift.v7.41.0-387.next-all-namespaces namespace: placeholder spec: apiservicedefinitions: {} @@ -1466,4 +1466,4 @@ spec: maturity: stable provider: name: Eclipse Foundation - version: 7.41.0-386.next-all-namespaces + version: 7.41.0-387.next-all-namespaces diff --git a/bundle/next-all-namespaces/eclipse-che-preview-openshift/manifests/org_v1_che_crd.yaml b/bundle/next-all-namespaces/eclipse-che-preview-openshift/manifests/org_v1_che_crd.yaml index aa6d3512e2..e32356794e 100644 --- a/bundle/next-all-namespaces/eclipse-che-preview-openshift/manifests/org_v1_che_crd.yaml +++ b/bundle/next-all-namespaces/eclipse-che-preview-openshift/manifests/org_v1_che_crd.yaml @@ -993,6 +993,22 @@ spec: placeholders, such as che-workspace-. In that case, a new namespace will be created for each user or workspace. type: string + workspacesDefaultPlugins: + description: Default plug-ins applied to Devworkspaces. + items: + properties: + editor: + description: The editor id to specify default plug-ins + for. + type: string + plugins: + description: Default plug-in ids and uris for the specified + editor. + items: + type: string + type: array + type: object + type: array type: object storage: description: Configuration settings related to the persistent storage diff --git a/bundle/next/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml b/bundle/next/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml index ad6b7a5bb8..aa54b72df8 100644 --- a/bundle/next/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml +++ b/bundle/next/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml @@ -126,7 +126,7 @@ metadata: operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 repository: https://github.com/eclipse-che/che-operator support: Eclipse Foundation - name: eclipse-che-preview-openshift.v7.41.0-386.next + name: eclipse-che-preview-openshift.v7.41.0-387.next namespace: placeholder spec: apiservicedefinitions: {} @@ -1466,4 +1466,4 @@ spec: maturity: stable provider: name: Eclipse Foundation - version: 7.41.0-386.next + version: 7.41.0-387.next diff --git a/bundle/next/eclipse-che-preview-openshift/manifests/org_v1_che_crd.yaml b/bundle/next/eclipse-che-preview-openshift/manifests/org_v1_che_crd.yaml index aa6d3512e2..e32356794e 100644 --- a/bundle/next/eclipse-che-preview-openshift/manifests/org_v1_che_crd.yaml +++ b/bundle/next/eclipse-che-preview-openshift/manifests/org_v1_che_crd.yaml @@ -993,6 +993,22 @@ spec: placeholders, such as che-workspace-. In that case, a new namespace will be created for each user or workspace. type: string + workspacesDefaultPlugins: + description: Default plug-ins applied to Devworkspaces. + items: + properties: + editor: + description: The editor id to specify default plug-ins + for. + type: string + plugins: + description: Default plug-in ids and uris for the specified + editor. + items: + type: string + type: array + type: object + type: array type: object storage: description: Configuration settings related to the persistent storage diff --git a/config/crd/bases/org_v1_che_crd-v1beta1.yaml b/config/crd/bases/org_v1_che_crd-v1beta1.yaml index 39e884e436..73fa9453b3 100644 --- a/config/crd/bases/org_v1_che_crd-v1beta1.yaml +++ b/config/crd/bases/org_v1_che_crd-v1beta1.yaml @@ -956,6 +956,21 @@ spec: placeholders, such as che-workspace-. In that case, a new namespace will be created for each user or workspace. type: string + workspacesDefaultPlugins: + description: Default plug-ins applied to Devworkspaces. + items: + properties: + editor: + description: The editor id to specify default plug-ins for. + type: string + plugins: + description: Default plug-in ids and uris for the specified + editor. + items: + type: string + type: array + type: object + type: array type: object storage: description: Configuration settings related to the persistent storage diff --git a/config/crd/bases/org_v1_che_crd.yaml b/config/crd/bases/org_v1_che_crd.yaml index 8626bf93e7..56dcde4d6e 100644 --- a/config/crd/bases/org_v1_che_crd.yaml +++ b/config/crd/bases/org_v1_che_crd.yaml @@ -989,6 +989,22 @@ spec: placeholders, such as che-workspace-. In that case, a new namespace will be created for each user or workspace. type: string + workspacesDefaultPlugins: + description: Default plug-ins applied to Devworkspaces. + items: + properties: + editor: + description: The editor id to specify default plug-ins + for. + type: string + plugins: + description: Default plug-in ids and uris for the specified + editor. + items: + type: string + type: array + type: object + type: array type: object storage: description: Configuration settings related to the persistent storage diff --git a/helmcharts/next/crds/org_v1_che_crd.yaml b/helmcharts/next/crds/org_v1_che_crd.yaml index 8626bf93e7..56dcde4d6e 100644 --- a/helmcharts/next/crds/org_v1_che_crd.yaml +++ b/helmcharts/next/crds/org_v1_che_crd.yaml @@ -989,6 +989,22 @@ spec: placeholders, such as che-workspace-. In that case, a new namespace will be created for each user or workspace. type: string + workspacesDefaultPlugins: + description: Default plug-ins applied to Devworkspaces. + items: + properties: + editor: + description: The editor id to specify default plug-ins + for. + type: string + plugins: + description: Default plug-in ids and uris for the specified + editor. + items: + type: string + type: array + type: object + type: array type: object storage: description: Configuration settings related to the persistent storage