Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: set CHE_NAMESPACE and CHE_CRD_OBJECT_NAME env vars #1248

Merged
merged 2 commits into from
Dec 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions api/v1/checluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
27 changes: 27 additions & 0 deletions api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -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: {}
Expand Down Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,22 @@ spec:
placeholders, such as che-workspace-<username>. 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: {}
Expand Down Expand Up @@ -1466,4 +1466,4 @@ spec:
maturity: stable
provider:
name: Eclipse Foundation
version: 7.41.0-386.next
version: 7.41.0-387.next
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,22 @@ spec:
placeholders, such as che-workspace-<username>. 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
Expand Down
15 changes: 15 additions & 0 deletions config/crd/bases/org_v1_che_crd-v1beta1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,21 @@ spec:
placeholders, such as che-workspace-<username>. 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
Expand Down
16 changes: 16 additions & 0 deletions config/crd/bases/org_v1_che_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,22 @@ spec:
placeholders, such as che-workspace-<username>. 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
Expand Down
16 changes: 16 additions & 0 deletions helmcharts/next/crds/org_v1_che_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,22 @@ spec:
placeholders, such as che-workspace-<username>. 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
Expand Down
24 changes: 24 additions & 0 deletions pkg/deploy/dashboard/dashboard_deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
},
Expand Down Expand Up @@ -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",
Expand Down
6 changes: 6 additions & 0 deletions pkg/deploy/dashboard/deployment_dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
dkwon17 marked this conversation as resolved.
Show resolved Hide resolved
corev1.EnvVar{
Name: "CHECLUSTER_CR_NAME",
Value: ctx.CheCluster.Name},
)

if ctx.CheCluster.IsInternalClusterSVCNamesEnabled() {
Expand Down