From bed4e49e4c6f6c93cf9758b99663c6c99608c796 Mon Sep 17 00:00:00 2001 From: Lukas Krejci Date: Fri, 11 Oct 2019 11:49:54 +0200 Subject: [PATCH 1/2] 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 c6032b7c1b..06ba4951a9 100644 --- a/pkg/deploy/che_configmap.go +++ b/pkg/deploy/che_configmap.go @@ -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"` @@ -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 = "-" + cheFlavor openShiftIdentityProviderId = "openshift-v3" if isOpenshift4 { openShiftIdentityProviderId = "openshift-v4" @@ -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, @@ -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, From 4d15f5df2ba2f2bbf56b56f7215ab70ec29ed07b Mon Sep 17 00:00:00 2001 From: Sergii Leshchenko Date: Fri, 8 Nov 2019 09:55:37 +0200 Subject: [PATCH 2/2] Use common PVC strategy by default --- deploy/crds/org_v1_che_cr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/crds/org_v1_che_cr.yaml b/deploy/crds/org_v1_che_cr.yaml index cbab4e5445..57a39e2b1e 100644 --- a/deploy/crds/org_v1_che_cr.yaml +++ b/deploy/crds/org_v1_che_cr.yaml @@ -69,7 +69,7 @@ spec: storage: # persistent volume claim strategy for Che server. Can be common (all workspaces PVCs in one volume), # per-workspace (one PVC per workspace for all declared volumes) and unique (one PVC per declared volume). Defaults to common - pvcStrategy: 'per-workspace' + pvcStrategy: 'common' # size of a persistent volume claim for workspaces. Defaults to 1Gi pvcClaimSize: '1Gi' # instruct Che server to launch a special pod to precreate a subpath in a PV