Allow to add dwo custom image to cr

Signed-off-by: Flavius Lacatusu <flacatus@redhat.com>
pull/731/head
Flavius Lacatusu 2021-03-31 11:31:15 +02:00
parent 1d147cd07a
commit 687df9cd44
No known key found for this signature in database
GPG Key ID: 3C0A7685C14681A8
7 changed files with 37 additions and 7 deletions

View File

@ -308,6 +308,11 @@ spec:
devWorkspace:
description: Dev Workspace operator configuration
properties:
devWorkspaceImage:
description: Overrides the default container image used in the DevWorkspace
deployment. This includes the image tag. Omit it or leave it empty
to use the default container image provided by the Operator.
type: string
enable:
description: Deploys the DevWorkspace Operator in the cluster. Does
nothing when a matching version of the Operator is already installed.

View File

@ -76,13 +76,13 @@ metadata:
categories: Developer Tools
certified: "false"
containerImage: quay.io/eclipse/che-operator:nightly
createdAt: "2021-03-22T07:33:48Z"
createdAt: "2021-03-31T09:28:21Z"
description: A Kube-native development solution that delivers portable and collaborative
developer workspaces.
operatorframework.io/suggested-namespace: eclipse-che
repository: https://github.com/eclipse-che/che-operator
support: Eclipse Foundation
name: eclipse-che-preview-kubernetes.v7.28.0-128.nightly
name: eclipse-che-preview-kubernetes.v7.28.0-130.nightly
namespace: placeholder
spec:
apiservicedefinitions: {}
@ -789,4 +789,4 @@ spec:
maturity: stable
provider:
name: Eclipse Foundation
version: 7.28.0-128.nightly
version: 7.28.0-130.nightly

View File

@ -308,6 +308,11 @@ spec:
devWorkspace:
description: Dev Workspace operator configuration
properties:
devWorkspaceImage:
description: Overrides the default container image used in the DevWorkspace
deployment. This includes the image tag. Omit it or leave it empty
to use the default container image provided by the Operator.
type: string
enable:
description: Deploys the DevWorkspace Operator in the cluster. Does
nothing when a matching version of the Operator is already installed.

View File

@ -67,13 +67,13 @@ metadata:
categories: Developer Tools, OpenShift Optional
certified: "false"
containerImage: quay.io/eclipse/che-operator:nightly
createdAt: "2021-03-22T07:33:58Z"
createdAt: "2021-03-31T09:28:23Z"
description: A Kube-native development solution that delivers portable and collaborative
developer workspaces in OpenShift.
operatorframework.io/suggested-namespace: eclipse-che
repository: https://github.com/eclipse-che/che-operator
support: Eclipse Foundation
name: eclipse-che-preview-openshift.v7.28.0-128.nightly
name: eclipse-che-preview-openshift.v7.28.0-130.nightly
namespace: placeholder
spec:
apiservicedefinitions: {}
@ -866,4 +866,4 @@ spec:
maturity: stable
provider:
name: Eclipse Foundation
version: 7.28.0-128.nightly
version: 7.28.0-130.nightly

View File

@ -309,6 +309,11 @@ spec:
devWorkspace:
description: Dev Workspace operator configuration
properties:
devWorkspaceImage:
description: Overrides the default container image used in the DevWorkspace
deployment. This includes the image tag. Omit it or leave it empty
to use the default container image provided by the Operator.
type: string
enable:
description: Deploys the DevWorkspace Operator in the cluster. Does
nothing when a matching version of the Operator is already installed.

View File

@ -557,6 +557,10 @@ type CheClusterSpecDevWorkspace struct {
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Enable Dev Workspace operator"
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
Enable bool `json:"enable"`
// Overrides the default container image used in the DevWorkspace deployment.
// This includes the image tag. Omit it or leave it empty to use the default container image provided by the Operator.
// +optional
DevWorkspaceImage string `json:"devWorkspaceImage,omitempty"`
}
// CheClusterStatus defines the observed state of Che installation

View File

@ -243,7 +243,18 @@ func syncDwConfigMap(deployContext *deploy.DeployContext) (bool, error) {
}
func syncDwDeployment(deployContext *deploy.DeployContext) (bool, error) {
return syncObject(deployContext, DevWorkspaceDeploymentFile, &appsv1.Deployment{})
dwDeploymentObj := &appsv1.Deployment{}
if err := util.ReadObject(DevWorkspaceDeploymentFile, dwDeploymentObj); err != nil {
return false, err
}
if deployContext.CheCluster.Spec.DevWorkspace.DevWorkspaceImage != "" {
dwDeploymentObj.Spec.Template.Spec.Containers[0].Image = deployContext.CheCluster.Spec.DevWorkspace.DevWorkspaceImage
}
created, err := deploy.CreateIfNotExists(deployContext, dwDeploymentObj)
return created, err
}
func createDwCheNamespace(deployContext *deploy.DeployContext) (bool, error) {