diff --git a/api/v1/checluster_types.go b/api/v1/checluster_types.go index 84a03c1f4..6fc693683 100644 --- a/api/v1/checluster_types.go +++ b/api/v1/checluster_types.go @@ -391,6 +391,10 @@ type CheClusterSpecDB struct { // PostgreSQL container custom settings // +optional ChePostgresContainerResources ResourcesCustomSettings `json:"chePostgresContainerResources,omitempty"` + // Size of the persistent volume claim for database. Defaults to `1Gi`. + // To update pvc storageclass that provisions it must support resize when Eclipse Che has been already deployed. + // +optional + PvcClaimSize string `json:"pvcClaimSize,omitempty"` } // +k8s:openapi-gen=true diff --git a/bundle/next-all-namespaces/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml b/bundle/next-all-namespaces/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml index 441413c76..061119ea6 100644 --- a/bundle/next-all-namespaces/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml +++ b/bundle/next-all-namespaces/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml @@ -126,7 +126,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-preview-openshift.v7.40.0-379.next-all-namespaces + name: eclipse-che-preview-openshift.v7.40.0-380.next-all-namespaces namespace: placeholder spec: apiservicedefinitions: {} @@ -1439,4 +1439,4 @@ spec: maturity: stable provider: name: Eclipse Foundation - version: 7.40.0-379.next-all-namespaces + version: 7.40.0-380.next-all-namespaces diff --git a/bundle/next-all-namespaces/eclipse-che-preview-openshift/manifests/org_v1_che_crd.yaml b/bundle/next-all-namespaces/eclipse-che-preview-openshift/manifests/org_v1_che_crd.yaml index 48f9f8485..11bb781e0 100644 --- a/bundle/next-all-namespaces/eclipse-che-preview-openshift/manifests/org_v1_che_crd.yaml +++ b/bundle/next-all-namespaces/eclipse-che-preview-openshift/manifests/org_v1_che_crd.yaml @@ -363,6 +363,11 @@ spec: values are: `9.6` and `13.3`. Migrate your PostgreSQL database to switch from one version to another.' type: string + pvcClaimSize: + description: Size of the persistent volume claim for database. + Defaults to `1Gi`. To update pvc storageclass that provisions + it must support resize when Eclipse Che has been already deployed. + type: string type: object devWorkspace: description: DevWorkspace operator configuration diff --git a/bundle/next/eclipse-che-preview-kubernetes/manifests/che-operator.clusterserviceversion.yaml b/bundle/next/eclipse-che-preview-kubernetes/manifests/che-operator.clusterserviceversion.yaml index 86c39cc4a..a0032ae5c 100644 --- a/bundle/next/eclipse-che-preview-kubernetes/manifests/che-operator.clusterserviceversion.yaml +++ b/bundle/next/eclipse-che-preview-kubernetes/manifests/che-operator.clusterserviceversion.yaml @@ -133,7 +133,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-preview-kubernetes.v7.40.0-379.next + name: eclipse-che-preview-kubernetes.v7.40.0-380.next namespace: placeholder spec: apiservicedefinitions: {} @@ -1406,4 +1406,4 @@ spec: maturity: stable provider: name: Eclipse Foundation - version: 7.40.0-379.next + version: 7.40.0-380.next diff --git a/bundle/next/eclipse-che-preview-kubernetes/manifests/org_v1_che_crd.yaml b/bundle/next/eclipse-che-preview-kubernetes/manifests/org_v1_che_crd.yaml index 8bedb5c44..70d5f5202 100644 --- a/bundle/next/eclipse-che-preview-kubernetes/manifests/org_v1_che_crd.yaml +++ b/bundle/next/eclipse-che-preview-kubernetes/manifests/org_v1_che_crd.yaml @@ -217,6 +217,9 @@ spec: postgresVersion: description: 'Indicates a PostgreSQL version image to use. Allowed values are: `9.6` and `13.3`. Migrate your PostgreSQL database to switch from one version to another.' type: string + pvcClaimSize: + description: Size of the persistent volume claim for database. Defaults to `1Gi`. To update pvc storageclass that provisions it must support resize when Eclipse Che has been already deployed. + type: string type: object devWorkspace: description: DevWorkspace operator configuration diff --git a/bundle/next/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml b/bundle/next/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml index 36290c3c2..178a7d2f8 100644 --- a/bundle/next/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml +++ b/bundle/next/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml @@ -126,7 +126,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-preview-openshift.v7.40.0-379.next + name: eclipse-che-preview-openshift.v7.40.0-380.next namespace: placeholder spec: apiservicedefinitions: {} @@ -1439,4 +1439,4 @@ spec: maturity: stable provider: name: Eclipse Foundation - version: 7.40.0-379.next + version: 7.40.0-380.next diff --git a/bundle/next/eclipse-che-preview-openshift/manifests/org_v1_che_crd.yaml b/bundle/next/eclipse-che-preview-openshift/manifests/org_v1_che_crd.yaml index 48f9f8485..11bb781e0 100644 --- a/bundle/next/eclipse-che-preview-openshift/manifests/org_v1_che_crd.yaml +++ b/bundle/next/eclipse-che-preview-openshift/manifests/org_v1_che_crd.yaml @@ -363,6 +363,11 @@ spec: values are: `9.6` and `13.3`. Migrate your PostgreSQL database to switch from one version to another.' type: string + pvcClaimSize: + description: Size of the persistent volume claim for database. + Defaults to `1Gi`. To update pvc storageclass that provisions + it must support resize when Eclipse Che has been already deployed. + type: string type: object devWorkspace: description: DevWorkspace operator configuration diff --git a/config/crd/bases/org_v1_che_crd-v1beta1.yaml b/config/crd/bases/org_v1_che_crd-v1beta1.yaml index cf9cac94d..39e884e43 100644 --- a/config/crd/bases/org_v1_che_crd-v1beta1.yaml +++ b/config/crd/bases/org_v1_che_crd-v1beta1.yaml @@ -353,6 +353,11 @@ spec: values are: `9.6` and `13.3`. Migrate your PostgreSQL database to switch from one version to another.' type: string + pvcClaimSize: + description: Size of the persistent volume claim for database. Defaults + to `1Gi`. To update pvc storageclass that provisions it must support + resize when Eclipse Che has been already deployed. + type: string type: object devWorkspace: description: DevWorkspace operator configuration diff --git a/config/crd/bases/org_v1_che_crd.yaml b/config/crd/bases/org_v1_che_crd.yaml index 4342ce58e..8626bf93e 100644 --- a/config/crd/bases/org_v1_che_crd.yaml +++ b/config/crd/bases/org_v1_che_crd.yaml @@ -363,6 +363,11 @@ spec: values are: `9.6` and `13.3`. Migrate your PostgreSQL database to switch from one version to another.' type: string + pvcClaimSize: + description: Size of the persistent volume claim for database. + Defaults to `1Gi`. To update pvc storageclass that provisions + it must support resize when Eclipse Che has been already deployed. + type: string type: object devWorkspace: description: DevWorkspace operator configuration diff --git a/helmcharts/next/crds/org_v1_che_crd.yaml b/helmcharts/next/crds/org_v1_che_crd.yaml index 4342ce58e..8626bf93e 100644 --- a/helmcharts/next/crds/org_v1_che_crd.yaml +++ b/helmcharts/next/crds/org_v1_che_crd.yaml @@ -363,6 +363,11 @@ spec: values are: `9.6` and `13.3`. Migrate your PostgreSQL database to switch from one version to another.' type: string + pvcClaimSize: + description: Size of the persistent volume claim for database. + Defaults to `1Gi`. To update pvc storageclass that provisions + it must support resize when Eclipse Che has been already deployed. + type: string type: object devWorkspace: description: DevWorkspace operator configuration diff --git a/pkg/deploy/defaults.go b/pkg/deploy/defaults.go index 4378157e5..a6c2116d8 100644 --- a/pkg/deploy/defaults.go +++ b/pkg/deploy/defaults.go @@ -69,6 +69,7 @@ const ( DefaultCheMetricsPort = int32(8087) DefaultCheDebugPort = int32(8000) DefaultPostgresVolumeClaimName = "postgres-data" + DefaultPostgresPvcClaimSize = "1Gi" DefaultJavaOpts = "-XX:MaxRAMPercentage=85.0" DefaultWorkspaceJavaOpts = "-XX:MaxRAM=150m -XX:MaxRAMFraction=2 -XX:+UseParallelGC " + diff --git a/pkg/deploy/postgres/postgres.go b/pkg/deploy/postgres/postgres.go index bbad13f6e..64c419479 100644 --- a/pkg/deploy/postgres/postgres.go +++ b/pkg/deploy/postgres/postgres.go @@ -75,7 +75,8 @@ func (p *Postgres) SyncService() (bool, error) { } func (p *Postgres) SyncPVC() (bool, error) { - done, err := deploy.SyncPVCToCluster(p.deployContext, deploy.DefaultPostgresVolumeClaimName, "1Gi", deploy.PostgresName) + pvcClaimSize := util.GetValue(p.deployContext.CheCluster.Spec.Database.PvcClaimSize, deploy.DefaultPostgresPvcClaimSize) + done, err := deploy.SyncPVCToCluster(p.deployContext, deploy.DefaultPostgresVolumeClaimName, pvcClaimSize, deploy.PostgresName) if !done { if err == nil { logrus.Infof("Waiting on pvc '%s' to be bound. Sometimes PVC can be bound only when the first consumer is created.", deploy.DefaultPostgresVolumeClaimName)