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 committed Oct 11, 2019
1 parent 9d63054 commit 12f6c8d
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 @@ -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"`
Expand Down Expand Up @@ -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 = "<username>-" + cheFlavor
openShiftIdentityProviderId = "openshift-v3"
if isOpenshift4 {
openShiftIdentityProviderId = "openshift-v4"
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 12f6c8d

Please sign in to comment.