Take `WorkspaceNamespaceDefault` into account ... (#217)

... even when OpenShift OAuth is enabled

This fixes issue https://github.com/eclipse/che/issues/16574

Signed-off-by: David Festal <dfestal@redhat.com>
pull/269/head
David Festal 2020-04-09 14:51:34 +02:00 committed by GitHub
parent 9c40c5264e
commit e3ca17abf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -88,18 +88,21 @@ func GetConfigMapData(cr *orgv1.CheCluster) (cheEnv map[string]string) {
if isOpenShift {
infra = "openshift"
}
defaultTargetNamespace := util.GetValue(cr.Spec.Server.WorkspaceNamespaceDefault, cr.Namespace)
namespaceAllowUserDefined := strconv.FormatBool(cr.Spec.Server.AllowUserDefinedWorkspaceNamespaces)
tls := "false"
openShiftIdentityProviderId := "NULL"
openshiftOAuth := cr.Spec.Auth.OpenShiftoAuth
defaultTargetNamespaceDefault := cr.Namespace // By default Che SA has right in the namespace where Che in installed ...
if openshiftOAuth && isOpenShift {
defaultTargetNamespace = "<username>-" + cheFlavor
// ... But if the workspace is created under the openshift identity of the end-user,
// Then we'll have rights to create any new namespace
defaultTargetNamespaceDefault = "<username>-" + cheFlavor
openShiftIdentityProviderId = "openshift-v3"
if isOpenshift4 {
openShiftIdentityProviderId = "openshift-v4"
}
}
defaultTargetNamespace := util.GetValue(cr.Spec.Server.WorkspaceNamespaceDefault, defaultTargetNamespaceDefault)
namespaceAllowUserDefined := strconv.FormatBool(cr.Spec.Server.AllowUserDefinedWorkspaceNamespaces)
tlsSupport := cr.Spec.Server.TlsSupport
protocol := "http"
wsprotocol := "ws"