From 12f6c8d5574670ab3df622ae135c25ef7dbf28f4 Mon Sep 17 00:00:00 2001 From: Lukas Krejci Date: Fri, 11 Oct 2019 11:49:54 +0200 Subject: [PATCH] Support for the new way of specifying the workspace namespace in Che. The default is still the current namespace if there is no oauth in the infra With Openshift OAuth, the namespace is now "-che" or "-codeready" depending on the che flavor. --- pkg/deploy/che_configmap.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pkg/deploy/che_configmap.go b/pkg/deploy/che_configmap.go index 93948ccee9..ebc16af948 100644 --- a/pkg/deploy/che_configmap.go +++ b/pkg/deploy/che_configmap.go @@ -39,7 +39,7 @@ type CheConfigMap struct { CheInfrastructureActive string `json:"CHE_INFRASTRUCTURE_ACTIVE"` CheInfraKubernetesServiceAccountName string `json:"CHE_INFRA_KUBERNETES_SERVICE__ACCOUNT__NAME"` BootstrapperBinaryUrl string `json:"CHE_INFRA_KUBERNETES_BOOTSTRAPPER_BINARY__URL"` - WorkspacesNamespace string `json:"CHE_INFRA_OPENSHIFT_PROJECT"` + DefaultTargetNamespace string `json:"CHE_INFRA_KUBERNETES_NAMESPACE_DEFAULT"` PvcStrategy string `json:"CHE_INFRA_KUBERNETES_PVC_STRATEGY"` PvcClaimSize string `json:"CHE_INFRA_KUBERNETES_PVC_QUANTITY"` PvcJobsImage string `json:"CHE_INFRA_KUBERNETES_PVC_JOBS_IMAGE"` @@ -82,12 +82,12 @@ func GetConfigMapData(cr *orgv1.CheCluster) (cheEnv map[string]string) { if isOpenShift { infra = "openshift" } - workspacesNamespace := cr.Namespace + defaultTargetNamespace := cr.Namespace tls := "false" openShiftIdentityProviderId := "NULL" openshiftOAuth := cr.Spec.Auth.OpenShiftOauth if openshiftOAuth && isOpenShift { - workspacesNamespace = "" + defaultTargetNamespace = "-" + cheFlavor openShiftIdentityProviderId = "openshift-v3" if isOpenshift4 { openShiftIdentityProviderId = "openshift-v4" @@ -157,7 +157,7 @@ func GetConfigMapData(cr *orgv1.CheCluster) (cheEnv map[string]string) { CheInfrastructureActive: infra, CheInfraKubernetesServiceAccountName: "che-workspace", BootstrapperBinaryUrl: protocol + "://" + cheHost + "/agent-binaries/linux_amd64/bootstrapper/bootstrapper", - WorkspacesNamespace: workspacesNamespace, + DefaultTargetNamespace: defaultTargetNamespace, PvcStrategy: pvcStrategy, PvcClaimSize: pvcClaimSize, WorkspacePvcStorageClassName: workspacePvcStorageClassName, @@ -195,7 +195,6 @@ func GetConfigMapData(cr *orgv1.CheCluster) (cheEnv map[string]string) { k8sCheEnv := map[string]string{ "CHE_INFRA_KUBERNETES_POD_SECURITY__CONTEXT_FS__GROUP": securityContextFsGroup, "CHE_INFRA_KUBERNETES_POD_SECURITY__CONTEXT_RUN__AS__USER": securityContextRunAsUser, - "CHE_INFRA_KUBERNETES_NAMESPACE": workspacesNamespace, "CHE_INFRA_KUBERNETES_INGRESS_DOMAIN": ingressDomain, "CHE_INFRA_KUBERNETES_SERVER__STRATEGY": ingressStrategy, "CHE_INFRA_KUBERNETES_TLS__SECRET": tlsSecretName,