Skip to content

Commit

Permalink
Support for the new way of specifying the workspace namespace in Che.
Browse files Browse the repository at this point in the history
The default is still the current namespace if there is no oauth in the infra

With Openshift OAuth, the namespace is now "<username>-che" or
"<username>-codeready" depending on the che flavor.
  • Loading branch information
metlos authored and sleshchenko committed Oct 31, 2019
1 parent 64fbe80 commit b3a22a2
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions pkg/deploy/che_configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type CheConfigMap struct {
CheDebugServer string `json:"CHE_DEBUG_SERVER"`
CheInfrastructureActive string `json:"CHE_INFRASTRUCTURE_ACTIVE"`
CheInfraKubernetesServiceAccountName string `json:"CHE_INFRA_KUBERNETES_SERVICE__ACCOUNT__NAME"`
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"`
Expand Down Expand Up @@ -84,12 +84,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 = "<username>-" + cheFlavor
openShiftIdentityProviderId = "openshift-v3"
if isOpenshift4 {
openShiftIdentityProviderId = "openshift-v4"
Expand Down Expand Up @@ -158,7 +158,7 @@ func GetConfigMapData(cr *orgv1.CheCluster) (cheEnv map[string]string) {
CheDebugServer: cheDebug,
CheInfrastructureActive: infra,
CheInfraKubernetesServiceAccountName: "che-workspace",
WorkspacesNamespace: workspacesNamespace,
DefaultTargetNamespace: defaultTargetNamespace,
PvcStrategy: pvcStrategy,
PvcClaimSize: pvcClaimSize,
WorkspacePvcStorageClassName: workspacePvcStorageClassName,
Expand Down Expand Up @@ -196,7 +196,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,
Expand Down

0 comments on commit b3a22a2

Please sign in to comment.