Skip to content

Commit 2aff9f0

Browse files
Andrey Kolkovclaude
andcommitted
fix(backups): request S3 checksum only when required for barman-cloud
The barman-cloud plugin's sidecar uploads via boto3. Since botocore ~1.36 (early 2025) the default RequestChecksumCalculation is when_supported, which attaches a flexible checksum to every PutObject. Non-AWS S3-compatible backends (Ceph RADOS Gateway, some MinIO / Cloudflare R2 builds) reject the accompanying header with "InvalidArgument: x-amz-content-sha256 must be UNSIGNED-PAYLOAD, STREAMING-AWS4-HMAC-SHA256-PAYLOAD or a valid sha256 value", so every backup/WAL-archive upload fails against them. Pin the sidecar to when_required via the ObjectStore's spec.instanceSidecarConfiguration.env (botocore honors the AWS_REQUEST_CHECKSUM_CALCULATION env var) on both the keycloak system DB and the postgres app (backup + recovery ObjectStores). when_required is also accepted by AWS S3 on a plain PutObject, so it is a safe default everywhere. This mirrors the etcd-operator fix (cozystack/etcd-operator#342, released in v0.5.3), which applied the same WhenRequired policy to its aws-sdk-go-v2 S3 client for the same Ceph RGW backend. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Andrey Kolkov <[email protected]>
1 parent aef9e20 commit 2aff9f0

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

  • packages

‎packages/apps/postgres/templates/db.yaml‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,15 @@ spec:
262262
{{- if .Values.backup.retentionPolicy }}
263263
retentionPolicy: {{ .Values.backup.retentionPolicy | quote }}
264264
{{- end }}
265+
# Ceph RGW and other non-AWS S3-compatible backends reject botocore's default
266+
# flexible request checksum (the x-amz-content-sha256 that barman-cloud's
267+
# boto3 sends on every upload) with "InvalidArgument: x-amz-content-sha256
268+
# must be UNSIGNED-PAYLOAD, ...". Compute a checksum only when the operation
269+
# requires one; AWS S3 accepts this too, so it is a safe default everywhere.
270+
instanceSidecarConfiguration:
271+
env:
272+
- name: AWS_REQUEST_CHECKSUM_CALCULATION
273+
value: when_required
265274
configuration:
266275
destinationPath: {{ $destinationPath }}
267276
endpointURL: {{ $endpointURL }}
@@ -288,6 +297,11 @@ kind: ObjectStore
288297
metadata:
289298
name: {{ .Release.Name }}-recovery
290299
spec:
300+
# Same non-AWS S3 request-checksum workaround as the backup ObjectStore above.
301+
instanceSidecarConfiguration:
302+
env:
303+
- name: AWS_REQUEST_CHECKSUM_CALCULATION
304+
value: when_required
291305
configuration:
292306
destinationPath: {{ $destinationPath }}
293307
endpointURL: {{ $endpointURL }}

‎packages/system/keycloak/templates/db.yaml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@ spec:
5151
{{- if .Values.backup.retentionPolicy }}
5252
retentionPolicy: {{ .Values.backup.retentionPolicy | quote }}
5353
{{- end }}
54+
# Ceph RGW and other non-AWS S3-compatible backends reject botocore's default
55+
# flexible request checksum (the x-amz-content-sha256 that barman-cloud's
56+
# boto3 sends on every upload) with "InvalidArgument: x-amz-content-sha256
57+
# must be UNSIGNED-PAYLOAD, ...". Compute a checksum only when the operation
58+
# requires one; AWS S3 accepts this too, so it is a safe default everywhere.
59+
instanceSidecarConfiguration:
60+
env:
61+
- name: AWS_REQUEST_CHECKSUM_CALCULATION
62+
value: when_required
5463
configuration:
5564
destinationPath: {{ .Values.backup.destinationPath | quote }}
5665
{{- with .Values.backup.endpointURL }}

0 commit comments

Comments
 (0)