From 8cf35f301d2eb7f2da68382b0b7e0b450f20f59a Mon Sep 17 00:00:00 2001 From: Andrew Farries Date: Mon, 11 Apr 2022 14:27:54 +0000 Subject: [PATCH 1/2] Allow `maximumBackupCount` to be configured Previously, this was hardcoded to 3 but needs to be configurable for Gitpod SaaS. --- install/installer/pkg/common/storage.go | 7 ++++++- install/installer/pkg/config/v1/config.go | 9 +++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/install/installer/pkg/common/storage.go b/install/installer/pkg/common/storage.go index 1cd6cd2dea1b3c..4990f03a3c5953 100644 --- a/install/installer/pkg/common/storage.go +++ b/install/installer/pkg/common/storage.go @@ -34,6 +34,11 @@ func useMinio(context *RenderContext) bool { func StorageConfig(context *RenderContext) storageconfig.StorageConfig { var res *storageconfig.StorageConfig if context.Config.ObjectStorage.CloudStorage != nil { + maximumBackupCount := 3 + if context.Config.ObjectStorage.MaximumBackupCount != nil { + maximumBackupCount = *context.Config.ObjectStorage.MaximumBackupCount + } + res = &storageconfig.StorageConfig{ Kind: storageconfig.GCloudStorage, GCloudConfig: storageconfig.GCPConfig{ @@ -41,7 +46,7 @@ func StorageConfig(context *RenderContext) storageconfig.StorageConfig { Project: context.Config.ObjectStorage.CloudStorage.Project, CredentialsFile: filepath.Join(storageMount, "service-account.json"), ParallelUpload: 6, - MaximumBackupCount: 3, + MaximumBackupCount: maximumBackupCount, }, } } diff --git a/install/installer/pkg/config/v1/config.go b/install/installer/pkg/config/v1/config.go index 5b1c1711b554f6..d637e25484c855 100644 --- a/install/installer/pkg/config/v1/config.go +++ b/install/installer/pkg/config/v1/config.go @@ -132,10 +132,11 @@ type DatabaseCloudSQL struct { } type ObjectStorage struct { - InCluster *bool `json:"inCluster,omitempty"` - S3 *ObjectStorageS3 `json:"s3,omitempty"` - CloudStorage *ObjectStorageCloudStorage `json:"cloudStorage,omitempty"` - Azure *ObjectStorageAzure `json:"azure,omitempty"` + InCluster *bool `json:"inCluster,omitempty"` + S3 *ObjectStorageS3 `json:"s3,omitempty"` + CloudStorage *ObjectStorageCloudStorage `json:"cloudStorage,omitempty"` + Azure *ObjectStorageAzure `json:"azure,omitempty"` + MaximumBackupCount *int `json:"maximumBackupCount,omitempty"` } type ObjectStorageS3 struct { From 1d78bcd1fbb87476e0231620b735506f45eb3394 Mon Sep 17 00:00:00 2001 From: Andrew Farries Date: Mon, 11 Apr 2022 14:50:27 +0000 Subject: [PATCH 2/2] Allow `blobQuota` to be configured Previously, this was hardcoded to 5GiB but needs to be configurable for Gitpod SaaS. --- install/installer/pkg/common/storage.go | 3 +++ install/installer/pkg/config/v1/config.go | 1 + 2 files changed, 4 insertions(+) diff --git a/install/installer/pkg/common/storage.go b/install/installer/pkg/common/storage.go index 4990f03a3c5953..04e8039c64421e 100644 --- a/install/installer/pkg/common/storage.go +++ b/install/installer/pkg/common/storage.go @@ -93,6 +93,9 @@ func StorageConfig(context *RenderContext) storageconfig.StorageConfig { } // 5 GiB res.BlobQuota = 5 * 1024 * 1024 * 1024 + if context.Config.ObjectStorage.BlobQuota != nil { + res.BlobQuota = *context.Config.ObjectStorage.BlobQuota + } _ = context.WithExperimental(func(ucfg *experimental.Config) error { if ucfg.Workspace != nil { diff --git a/install/installer/pkg/config/v1/config.go b/install/installer/pkg/config/v1/config.go index d637e25484c855..0cfdddbc99ea59 100644 --- a/install/installer/pkg/config/v1/config.go +++ b/install/installer/pkg/config/v1/config.go @@ -137,6 +137,7 @@ type ObjectStorage struct { CloudStorage *ObjectStorageCloudStorage `json:"cloudStorage,omitempty"` Azure *ObjectStorageAzure `json:"azure,omitempty"` MaximumBackupCount *int `json:"maximumBackupCount,omitempty"` + BlobQuota *int64 `json:"blobQuota,omitempty"` } type ObjectStorageS3 struct {