@@ -30,6 +30,7 @@ import (
30
30
coreosv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
31
31
networkingv1 "k8s.io/api/networking/v1"
32
32
apierrors "k8s.io/apimachinery/pkg/api/errors"
33
+ "k8s.io/apimachinery/pkg/api/resource"
33
34
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
34
35
"k8s.io/apimachinery/pkg/labels"
35
36
"k8s.io/apimachinery/pkg/runtime"
@@ -441,6 +442,20 @@ func (r *PostgresReconciler) updatePodEnvironmentConfigMap(ctx context.Context,
441
442
// region
442
443
region := backupConfig .S3Region
443
444
445
+ // set the WALG_UPLOAD_DISK_CONCURRENCY based on the configured cpu limits
446
+ q , err := resource .ParseQuantity (p .Spec .Size .CPU )
447
+ if err != nil {
448
+ return fmt .Errorf ("error while parsing the postgres cpu size: %w" , err )
449
+ }
450
+ uploadDiskConcurrency := "1"
451
+ if q .Value () > 32 {
452
+ uploadDiskConcurrency = "32"
453
+ } else if q .Value () > 1 {
454
+ uploadDiskConcurrency = fmt .Sprint (q .Value ())
455
+ }
456
+ uploadConcurrency := "32"
457
+ downloadConcurrency := "32"
458
+
444
459
// use the rest as provided in the secret
445
460
bucketName := backupConfig .S3BucketName
446
461
backupSchedule := backupConfig .Schedule
@@ -452,19 +467,25 @@ func (r *PostgresReconciler) updatePodEnvironmentConfigMap(ctx context.Context,
452
467
453
468
// create updated content for pod environment configmap
454
469
data := map [string ]string {
455
- "USE_WALG_BACKUP" : "true" ,
456
- "USE_WALG_RESTORE" : "true" ,
457
- "WALE_S3_PREFIX" : "s3://" + bucketName + "/$(SCOPE)" ,
458
- "WALG_S3_PREFIX" : "s3://" + bucketName + "/$(SCOPE)" ,
459
- "CLONE_WALG_S3_PREFIX" : "s3://" + bucketName + "/$(CLONE_SCOPE)" ,
460
- "WALE_BACKUP_THRESHOLD_PERCENTAGE" : "100" ,
461
- "AWS_ENDPOINT" : awsEndpoint ,
462
- "WALE_S3_ENDPOINT" : walES3Endpoint , // same as above, but slightly modified
463
- "AWS_S3_FORCE_PATH_STYLE" : "true" ,
464
- "AWS_REGION" : region , // now we can use AWS S3
465
- "WALG_DISABLE_S3_SSE" : walgDisableSSE , // server side encryption
466
- "BACKUP_SCHEDULE" : backupSchedule ,
467
- "BACKUP_NUM_TO_RETAIN" : backupNumToRetain ,
470
+ "USE_WALG_BACKUP" : "true" ,
471
+ "USE_WALG_RESTORE" : "true" ,
472
+ "WALE_S3_PREFIX" : "s3://" + bucketName + "/$(SCOPE)" ,
473
+ "WALG_S3_PREFIX" : "s3://" + bucketName + "/$(SCOPE)" ,
474
+ "CLONE_WALG_S3_PREFIX" : "s3://" + bucketName + "/$(CLONE_SCOPE)" ,
475
+ "WALE_BACKUP_THRESHOLD_PERCENTAGE" : "100" ,
476
+ "AWS_ENDPOINT" : awsEndpoint ,
477
+ "WALE_S3_ENDPOINT" : walES3Endpoint , // same as above, but slightly modified
478
+ "AWS_S3_FORCE_PATH_STYLE" : "true" ,
479
+ "AWS_REGION" : region , // now we can use AWS S3
480
+ "WALG_DISABLE_S3_SSE" : walgDisableSSE , // server side encryption
481
+ "BACKUP_SCHEDULE" : backupSchedule ,
482
+ "BACKUP_NUM_TO_RETAIN" : backupNumToRetain ,
483
+ "WALG_UPLOAD_DISK_CONCURRENCY" : uploadDiskConcurrency ,
484
+ "CLONE_WALG_UPLOAD_DISK_CONCURRENCY" : uploadDiskConcurrency ,
485
+ "WALG_UPLOAD_CONCURRENCY" : uploadConcurrency ,
486
+ "CLONE_WALG_UPLOAD_CONCURRENCY" : uploadConcurrency ,
487
+ "WALG_DOWNLOAD_CONCURRENCY" : downloadConcurrency ,
488
+ "CLONE_WALG_DOWNLOAD_CONCURRENCY" : downloadConcurrency ,
468
489
}
469
490
470
491
cm := & corev1.ConfigMap {}
0 commit comments