feat: configure pvcClaimSize for PostgreSQL (#1205)

* feat: configure pvcClaimSize for PostgreSQL

Signed-off-by: Anatolii Bazko <abazko@redhat.com>
pull/1209/head
Anatolii Bazko 2021-12-01 17:46:38 +02:00 committed by GitHub
parent e3d3156be7
commit 8a0221bf3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 41 additions and 7 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 " +

View File

@ -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)