feat: Support ephemeral pvc strategy (#1580)
* feat: Support ephemeral pvc strategy Signed-off-by: Anatolii Bazko <abazko@redhat.com>pull/1588/head
parent
9961280411
commit
bd74906edc
|
|
@ -394,12 +394,13 @@ type WorkspaceStorage struct {
|
|||
// +optional
|
||||
PerWorkspaceStrategyPvcConfig *PVC `json:"perWorkspaceStrategyPvcConfig,omitempty"`
|
||||
// Persistent volume claim strategy for the Che server.
|
||||
// The supported strategies are: `per-user` (all workspaces PVCs in one volume)
|
||||
// and 'per-workspace' (each workspace is given its own individual PVC).
|
||||
// For details, see https://github.com/eclipse/che/issues/21185.
|
||||
// The supported strategies are: `per-user` (all workspaces PVCs in one volume),
|
||||
// `per-workspace` (each workspace is given its own individual PVC)
|
||||
// and `ephemeral` (non-persistent storage where local changes will be lost when
|
||||
// the workspace is stopped.)
|
||||
// +optional
|
||||
// +kubebuilder:default:="per-user"
|
||||
// +kubebuilder:validation:Enum=common;per-user;per-workspace
|
||||
// +kubebuilder:validation:Enum=common;per-user;per-workspace;ephemeral
|
||||
PvcStrategy string `json:"pvcStrategy,omitempty"`
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ metadata:
|
|||
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
|
||||
repository: https://github.com/eclipse-che/che-operator
|
||||
support: Eclipse Foundation
|
||||
name: eclipse-che.v7.58.0-737.next
|
||||
name: eclipse-che.v7.59.0-739.next
|
||||
namespace: placeholder
|
||||
spec:
|
||||
apiservicedefinitions: {}
|
||||
|
|
@ -1233,7 +1233,7 @@ spec:
|
|||
minKubeVersion: 1.19.0
|
||||
provider:
|
||||
name: Eclipse Foundation
|
||||
version: 7.58.0-737.next
|
||||
version: 7.59.0-739.next
|
||||
webhookdefinitions:
|
||||
- admissionReviewVersions:
|
||||
- v1
|
||||
|
|
|
|||
|
|
@ -7040,13 +7040,15 @@ spec:
|
|||
default: per-user
|
||||
description: 'Persistent volume claim strategy for the Che
|
||||
server. The supported strategies are: `per-user` (all
|
||||
workspaces PVCs in one volume) and ''per-workspace'' (each
|
||||
workspace is given its own individual PVC). For details,
|
||||
see https://github.com/eclipse/che/issues/21185.'
|
||||
workspaces PVCs in one volume), `per-workspace` (each
|
||||
workspace is given its own individual PVC) and `ephemeral`
|
||||
(non-persistent storage where local changes will be lost
|
||||
when the workspace is stopped.)'
|
||||
enum:
|
||||
- common
|
||||
- per-user
|
||||
- per-workspace
|
||||
- ephemeral
|
||||
type: string
|
||||
type: object
|
||||
tolerations:
|
||||
|
|
|
|||
|
|
@ -6849,12 +6849,15 @@ spec:
|
|||
default: per-user
|
||||
description: 'Persistent volume claim strategy for the Che
|
||||
server. The supported strategies are: `per-user` (all workspaces
|
||||
PVCs in one volume) and ''per-workspace'' (each workspace
|
||||
is given its own individual PVC). For details, see https://github.com/eclipse/che/issues/21185.'
|
||||
PVCs in one volume), `per-workspace` (each workspace is
|
||||
given its own individual PVC) and `ephemeral` (non-persistent
|
||||
storage where local changes will be lost when the workspace
|
||||
is stopped.)'
|
||||
enum:
|
||||
- common
|
||||
- per-user
|
||||
- per-workspace
|
||||
- ephemeral
|
||||
type: string
|
||||
type: object
|
||||
tolerations:
|
||||
|
|
|
|||
|
|
@ -4632,11 +4632,12 @@ spec:
|
|||
type: object
|
||||
pvcStrategy:
|
||||
default: per-user
|
||||
description: 'Persistent volume claim strategy for the Che server. The supported strategies are: `per-user` (all workspaces PVCs in one volume) and ''per-workspace'' (each workspace is given its own individual PVC). For details, see https://github.com/eclipse/che/issues/21185.'
|
||||
description: 'Persistent volume claim strategy for the Che server. The supported strategies are: `per-user` (all workspaces PVCs in one volume), `per-workspace` (each workspace is given its own individual PVC) and `ephemeral` (non-persistent storage where local changes will be lost when the workspace is stopped.)'
|
||||
enum:
|
||||
- common
|
||||
- per-user
|
||||
- per-workspace
|
||||
- ephemeral
|
||||
type: string
|
||||
type: object
|
||||
tolerations:
|
||||
|
|
|
|||
|
|
@ -4627,11 +4627,12 @@ spec:
|
|||
type: object
|
||||
pvcStrategy:
|
||||
default: per-user
|
||||
description: 'Persistent volume claim strategy for the Che server. The supported strategies are: `per-user` (all workspaces PVCs in one volume) and ''per-workspace'' (each workspace is given its own individual PVC). For details, see https://github.com/eclipse/che/issues/21185.'
|
||||
description: 'Persistent volume claim strategy for the Che server. The supported strategies are: `per-user` (all workspaces PVCs in one volume), `per-workspace` (each workspace is given its own individual PVC) and `ephemeral` (non-persistent storage where local changes will be lost when the workspace is stopped.)'
|
||||
enum:
|
||||
- common
|
||||
- per-user
|
||||
- per-workspace
|
||||
- ephemeral
|
||||
type: string
|
||||
type: object
|
||||
tolerations:
|
||||
|
|
|
|||
|
|
@ -4632,11 +4632,12 @@ spec:
|
|||
type: object
|
||||
pvcStrategy:
|
||||
default: per-user
|
||||
description: 'Persistent volume claim strategy for the Che server. The supported strategies are: `per-user` (all workspaces PVCs in one volume) and ''per-workspace'' (each workspace is given its own individual PVC). For details, see https://github.com/eclipse/che/issues/21185.'
|
||||
description: 'Persistent volume claim strategy for the Che server. The supported strategies are: `per-user` (all workspaces PVCs in one volume), `per-workspace` (each workspace is given its own individual PVC) and `ephemeral` (non-persistent storage where local changes will be lost when the workspace is stopped.)'
|
||||
enum:
|
||||
- common
|
||||
- per-user
|
||||
- per-workspace
|
||||
- ephemeral
|
||||
type: string
|
||||
type: object
|
||||
tolerations:
|
||||
|
|
|
|||
|
|
@ -4627,11 +4627,12 @@ spec:
|
|||
type: object
|
||||
pvcStrategy:
|
||||
default: per-user
|
||||
description: 'Persistent volume claim strategy for the Che server. The supported strategies are: `per-user` (all workspaces PVCs in one volume) and ''per-workspace'' (each workspace is given its own individual PVC). For details, see https://github.com/eclipse/che/issues/21185.'
|
||||
description: 'Persistent volume claim strategy for the Che server. The supported strategies are: `per-user` (all workspaces PVCs in one volume), `per-workspace` (each workspace is given its own individual PVC) and `ephemeral` (non-persistent storage where local changes will be lost when the workspace is stopped.)'
|
||||
enum:
|
||||
- common
|
||||
- per-user
|
||||
- per-workspace
|
||||
- ephemeral
|
||||
type: string
|
||||
type: object
|
||||
tolerations:
|
||||
|
|
|
|||
|
|
@ -4627,11 +4627,12 @@ spec:
|
|||
type: object
|
||||
pvcStrategy:
|
||||
default: per-user
|
||||
description: 'Persistent volume claim strategy for the Che server. The supported strategies are: `per-user` (all workspaces PVCs in one volume) and ''per-workspace'' (each workspace is given its own individual PVC). For details, see https://github.com/eclipse/che/issues/21185.'
|
||||
description: 'Persistent volume claim strategy for the Che server. The supported strategies are: `per-user` (all workspaces PVCs in one volume), `per-workspace` (each workspace is given its own individual PVC) and `ephemeral` (non-persistent storage where local changes will be lost when the workspace is stopped.)'
|
||||
enum:
|
||||
- common
|
||||
- per-user
|
||||
- per-workspace
|
||||
- ephemeral
|
||||
type: string
|
||||
type: object
|
||||
tolerations:
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@ const (
|
|||
PerUserPVCStorageStrategy = "per-user"
|
||||
DefaultPvcStorageStrategy = "per-user"
|
||||
PerWorkspacePVCStorageStrategy = "per-workspace"
|
||||
EphemeralPVCStorageStrategy = "ephemeral"
|
||||
CommonPVCStorageStrategy = "common"
|
||||
DefaultAutoProvision = true
|
||||
DefaultWorkspaceJavaOpts = "-XX:MaxRAM=150m -XX:MaxRAMFraction=2 -XX:+UseParallelGC " +
|
||||
|
|
|
|||
|
|
@ -90,10 +90,11 @@ func updateWorkspaceConfig(devEnvironments *chev2.CheClusterDevEnvironments, ope
|
|||
func updateWorkspaceStorageConfig(devEnvironments *chev2.CheClusterDevEnvironments, workspaceConfig *controllerv1alpha1.WorkspaceConfig) error {
|
||||
pvcStrategy := utils.GetValue(devEnvironments.Storage.PvcStrategy, constants.DefaultPvcStorageStrategy)
|
||||
isPerWorkspacePVCStorageStrategy := pvcStrategy == constants.PerWorkspacePVCStorageStrategy
|
||||
pvc := map[bool]*chev2.PVC{
|
||||
true: devEnvironments.Storage.PerWorkspaceStrategyPvcConfig,
|
||||
false: devEnvironments.Storage.PerUserStrategyPvcConfig,
|
||||
}[isPerWorkspacePVCStorageStrategy]
|
||||
pvc := map[string]*chev2.PVC{
|
||||
constants.PerUserPVCStorageStrategy: devEnvironments.Storage.PerUserStrategyPvcConfig,
|
||||
constants.CommonPVCStorageStrategy: devEnvironments.Storage.PerUserStrategyPvcConfig,
|
||||
constants.PerWorkspacePVCStorageStrategy: devEnvironments.Storage.PerWorkspaceStrategyPvcConfig,
|
||||
}[pvcStrategy]
|
||||
|
||||
if pvc != nil {
|
||||
if pvc.StorageClass != "" {
|
||||
|
|
|
|||
|
|
@ -90,6 +90,31 @@ func TestReconcileDevWorkspaceConfigPerUserStorage(t *testing.T) {
|
|||
},
|
||||
expectedOperatorConfig: &controllerv1alpha1.OperatorConfiguration{Workspace: &controllerv1alpha1.WorkspaceConfig{}},
|
||||
},
|
||||
{
|
||||
name: "Create DevWorkspaceOperatorConfig with ephemeral strategy",
|
||||
cheCluster: &chev2.CheCluster{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Namespace: "eclipse-che",
|
||||
Name: "eclipse-che",
|
||||
},
|
||||
Spec: chev2.CheClusterSpec{
|
||||
DevEnvironments: chev2.CheClusterDevEnvironments{
|
||||
Storage: chev2.WorkspaceStorage{
|
||||
PvcStrategy: constants.EphemeralPVCStorageStrategy,
|
||||
PerUserStrategyPvcConfig: &chev2.PVC{
|
||||
StorageClass: "test-storage",
|
||||
ClaimSize: "10Gi",
|
||||
},
|
||||
PerWorkspaceStrategyPvcConfig: &chev2.PVC{
|
||||
StorageClass: "test-storage",
|
||||
ClaimSize: "10Gi",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
expectedOperatorConfig: &controllerv1alpha1.OperatorConfiguration{Workspace: &controllerv1alpha1.WorkspaceConfig{}},
|
||||
},
|
||||
{
|
||||
name: "Create DevWorkspaceOperatorConfig with StorageClassName only",
|
||||
cheCluster: &chev2.CheCluster{
|
||||
|
|
|
|||
Loading…
Reference in New Issue