mirror of
https://github.com/cloudnative-pg/plugin-barman-cloud.git
synced 2026-07-08 18:52:20 +02:00
Compare commits
7 Commits
40f7ce24ab
...
5560083160
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5560083160 | ||
|
|
7c63be1d24 | ||
|
|
273bbb474c | ||
|
|
263ebe2bc1 | ||
|
|
0bb78879ce | ||
|
|
ef4b711137 | ||
|
|
baf7985d66 |
10
Taskfile.yml
10
Taskfile.yml
@ -46,7 +46,7 @@ tasks:
|
|||||||
- wordlist-ordered
|
- wordlist-ordered
|
||||||
env:
|
env:
|
||||||
# renovate: datasource=git-refs depName=spellcheck lookupName=https://github.com/cloudnative-pg/daggerverse currentValue=main
|
# renovate: datasource=git-refs depName=spellcheck lookupName=https://github.com/cloudnative-pg/daggerverse currentValue=main
|
||||||
DAGGER_SPELLCHECK_SHA: 537e0ddae55ad0344af8f4454de7f27baeee48fa
|
DAGGER_SPELLCHECK_SHA: 21755df1a27febff19b28dbe6ae57116f6088bb0
|
||||||
cmds:
|
cmds:
|
||||||
- >
|
- >
|
||||||
GITHUB_REF= dagger -s call -m github.com/cloudnative-pg/daggerverse/spellcheck@${DAGGER_SPELLCHECK_SHA}
|
GITHUB_REF= dagger -s call -m github.com/cloudnative-pg/daggerverse/spellcheck@${DAGGER_SPELLCHECK_SHA}
|
||||||
@ -60,7 +60,7 @@ tasks:
|
|||||||
desc: Check for conventional commits
|
desc: Check for conventional commits
|
||||||
env:
|
env:
|
||||||
# renovate: datasource=git-refs depName=commitlint lookupName=https://github.com/cloudnative-pg/daggerverse currentValue=main
|
# renovate: datasource=git-refs depName=commitlint lookupName=https://github.com/cloudnative-pg/daggerverse currentValue=main
|
||||||
DAGGER_COMMITLINT_SHA: 537e0ddae55ad0344af8f4454de7f27baeee48fa
|
DAGGER_COMMITLINT_SHA: 21755df1a27febff19b28dbe6ae57116f6088bb0
|
||||||
cmds:
|
cmds:
|
||||||
- >
|
- >
|
||||||
GITHUB_REF= dagger -s call -m github.com/cloudnative-pg/daggerverse/commitlint@${DAGGER_COMMITLINT_SHA}
|
GITHUB_REF= dagger -s call -m github.com/cloudnative-pg/daggerverse/commitlint@${DAGGER_COMMITLINT_SHA}
|
||||||
@ -74,7 +74,7 @@ tasks:
|
|||||||
- wordlist-ordered
|
- wordlist-ordered
|
||||||
env:
|
env:
|
||||||
# renovate: datasource=git-refs depName=uncommitted lookupName=https://github.com/cloudnative-pg/daggerverse currentValue=main
|
# renovate: datasource=git-refs depName=uncommitted lookupName=https://github.com/cloudnative-pg/daggerverse currentValue=main
|
||||||
DAGGER_UNCOMMITTED_SHA: 537e0ddae55ad0344af8f4454de7f27baeee48fa
|
DAGGER_UNCOMMITTED_SHA: 21755df1a27febff19b28dbe6ae57116f6088bb0
|
||||||
cmds:
|
cmds:
|
||||||
- GITHUB_REF= dagger -s call -m github.com/cloudnative-pg/daggerverse/uncommitted@${DAGGER_UNCOMMITTED_SHA} check-uncommitted --source . stdout
|
- GITHUB_REF= dagger -s call -m github.com/cloudnative-pg/daggerverse/uncommitted@${DAGGER_UNCOMMITTED_SHA} check-uncommitted --source . stdout
|
||||||
sources:
|
sources:
|
||||||
@ -86,7 +86,7 @@ tasks:
|
|||||||
- controller-gen
|
- controller-gen
|
||||||
env:
|
env:
|
||||||
# renovate: datasource=git-refs depName=crd-gen-refs lookupName=https://github.com/cloudnative-pg/daggerverse currentValue=main
|
# renovate: datasource=git-refs depName=crd-gen-refs lookupName=https://github.com/cloudnative-pg/daggerverse currentValue=main
|
||||||
DAGGER_CRDGENREF_SHA: 537e0ddae55ad0344af8f4454de7f27baeee48fa
|
DAGGER_CRDGENREF_SHA: 21755df1a27febff19b28dbe6ae57116f6088bb0
|
||||||
# renovate: datasource=go depName=github.com/elastic/crd-ref-docs
|
# renovate: datasource=go depName=github.com/elastic/crd-ref-docs
|
||||||
CRDREFDOCS_VERSION: v0.3.0
|
CRDREFDOCS_VERSION: v0.3.0
|
||||||
cmds:
|
cmds:
|
||||||
@ -381,7 +381,7 @@ tasks:
|
|||||||
run: once
|
run: once
|
||||||
env:
|
env:
|
||||||
# renovate: datasource=git-refs depName=controller-gen lookupName=https://github.com/cloudnative-pg/daggerverse currentValue=main
|
# renovate: datasource=git-refs depName=controller-gen lookupName=https://github.com/cloudnative-pg/daggerverse currentValue=main
|
||||||
DAGGER_CONTROLLER_GEN_SHA: 537e0ddae55ad0344af8f4454de7f27baeee48fa
|
DAGGER_CONTROLLER_GEN_SHA: 21755df1a27febff19b28dbe6ae57116f6088bb0
|
||||||
cmds:
|
cmds:
|
||||||
- >
|
- >
|
||||||
GITHUB_REF= dagger -s call -m github.com/cloudnative-pg/daggerverse/controller-gen@${DAGGER_CONTROLLER_GEN_SHA}
|
GITHUB_REF= dagger -s call -m github.com/cloudnative-pg/daggerverse/controller-gen@${DAGGER_CONTROLLER_GEN_SHA}
|
||||||
|
|||||||
@ -176,6 +176,25 @@ spec:
|
|||||||
format: int32
|
format: int32
|
||||||
minimum: 1
|
minimum: 1
|
||||||
type: integer
|
type: integer
|
||||||
|
restoreAdditionalCommandArgs:
|
||||||
|
description: |-
|
||||||
|
Additional arguments that can be appended to the 'barman-cloud-restore'
|
||||||
|
command-line invocation. These arguments provide flexibility to customize
|
||||||
|
the data restore process further, according to specific requirements or
|
||||||
|
configurations.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
In a scenario where specialized restore options are required, such as setting
|
||||||
|
a specific read timeout or defining custom behavior, users can use this field
|
||||||
|
to specify additional command arguments.
|
||||||
|
|
||||||
|
Note:
|
||||||
|
It's essential to ensure that the provided arguments are valid and supported
|
||||||
|
by the 'barman-cloud-restore' command, to avoid potential errors or unintended
|
||||||
|
behavior during execution.
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
type: array
|
||||||
type: object
|
type: object
|
||||||
destinationPath:
|
destinationPath:
|
||||||
description: |-
|
description: |-
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
barman[azure,cloud,google,snappy,zstandard,lz4]==3.18.0
|
barman[azure,cloud,google,snappy,zstandard,lz4]==3.19.1
|
||||||
setuptools==82.0.1
|
setuptools==82.0.1
|
||||||
zipp>=3.19.1 # not directly required, pinned by Snyk to avoid a vulnerability
|
zipp>=3.19.1 # not directly required, pinned by Snyk to avoid a vulnerability
|
||||||
|
|||||||
@ -18,9 +18,9 @@ azure-storage-blob==12.29.0 \
|
|||||||
--hash=sha256:2824ddd7ebc9056034ebc76b17971a38e9aa5835abb0d565b9700493f2a6c657 \
|
--hash=sha256:2824ddd7ebc9056034ebc76b17971a38e9aa5835abb0d565b9700493f2a6c657 \
|
||||||
--hash=sha256:ccf8a1bcd5e49df83ab85aab793b579e5ba2eeea2ad8900b2f62ca3a37dc391f
|
--hash=sha256:ccf8a1bcd5e49df83ab85aab793b579e5ba2eeea2ad8900b2f62ca3a37dc391f
|
||||||
# via barman
|
# via barman
|
||||||
barman==3.18.0 \
|
barman==3.19.1 \
|
||||||
--hash=sha256:8e752ac93d2f3a61e86b8374185209cae477a638ece7e6f540070f36d28d6997 \
|
--hash=sha256:0a6a9e1babf97687732d8b2a3eb79ea95d55246a5257b9433865cb6e755221c0 \
|
||||||
--hash=sha256:ff90c44dafa4107b7574142771cdc2611c4cf1af818d93d3e67440a0c81164b9
|
--hash=sha256:2f71c4a1f1ba53f694cbdf838bb9906d8ba02b97d1fd3041196e8999bec7a1ee
|
||||||
# via -r sidecar-requirements.in
|
# via -r sidecar-requirements.in
|
||||||
boto3==1.43.14 \
|
boto3==1.43.14 \
|
||||||
--hash=sha256:574335744656cfed0b362a0a0467aaf2eb2bf15526edcd02d31d3c661f4b09e4 \
|
--hash=sha256:574335744656cfed0b362a0a0467aaf2eb2bf15526edcd02d31d3c661f4b09e4 \
|
||||||
@ -788,6 +788,4 @@ zstandard==0.25.0 \
|
|||||||
setuptools==82.0.1 \
|
setuptools==82.0.1 \
|
||||||
--hash=sha256:7d872682c5d01cfde07da7bccc7b65469d3dca203318515ada1de5eda35efbf9 \
|
--hash=sha256:7d872682c5d01cfde07da7bccc7b65469d3dca203318515ada1de5eda35efbf9 \
|
||||||
--hash=sha256:a59e362652f08dcd477c78bb6e7bd9d80a7995bc73ce773050228a348ce2e5bb
|
--hash=sha256:a59e362652f08dcd477c78bb6e7bd9d80a7995bc73ce773050228a348ce2e5bb
|
||||||
# via
|
# via -r sidecar-requirements.in
|
||||||
# -r sidecar-requirements.in
|
|
||||||
# barman
|
|
||||||
|
|||||||
6
go.mod
6
go.mod
@ -9,7 +9,7 @@ require (
|
|||||||
github.com/cloudnative-pg/cloudnative-pg v1.29.1
|
github.com/cloudnative-pg/cloudnative-pg v1.29.1
|
||||||
github.com/cloudnative-pg/cnpg-i v0.5.0
|
github.com/cloudnative-pg/cnpg-i v0.5.0
|
||||||
github.com/cloudnative-pg/cnpg-i-machinery v0.4.2
|
github.com/cloudnative-pg/cnpg-i-machinery v0.4.2
|
||||||
github.com/cloudnative-pg/machinery v0.4.0
|
github.com/cloudnative-pg/machinery v0.5.0
|
||||||
github.com/onsi/ginkgo/v2 v2.29.0
|
github.com/onsi/ginkgo/v2 v2.29.0
|
||||||
github.com/onsi/gomega v1.41.0
|
github.com/onsi/gomega v1.41.0
|
||||||
github.com/spf13/cobra v1.10.2
|
github.com/spf13/cobra v1.10.2
|
||||||
@ -114,7 +114,7 @@ require (
|
|||||||
golang.org/x/net v0.53.0 // indirect
|
golang.org/x/net v0.53.0 // indirect
|
||||||
golang.org/x/oauth2 v0.36.0 // indirect
|
golang.org/x/oauth2 v0.36.0 // indirect
|
||||||
golang.org/x/sync v0.20.0 // indirect
|
golang.org/x/sync v0.20.0 // indirect
|
||||||
golang.org/x/sys v0.43.0 // indirect
|
golang.org/x/sys v0.45.0 // indirect
|
||||||
golang.org/x/term v0.42.0 // indirect
|
golang.org/x/term v0.42.0 // indirect
|
||||||
golang.org/x/text v0.36.0 // indirect
|
golang.org/x/text v0.36.0 // indirect
|
||||||
golang.org/x/time v0.15.0 // indirect
|
golang.org/x/time v0.15.0 // indirect
|
||||||
@ -137,3 +137,5 @@ require (
|
|||||||
sigs.k8s.io/structured-merge-diff/v6 v6.4.0 // indirect
|
sigs.k8s.io/structured-merge-diff/v6 v6.4.0 // indirect
|
||||||
sigs.k8s.io/yaml v1.6.0 // indirect
|
sigs.k8s.io/yaml v1.6.0 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
|
replace github.com/cloudnative-pg/barman-cloud => github.com/leonardoce/barman-cloud v0.0.0-20260527084420-d2ef1c114ae8
|
||||||
|
|||||||
12
go.sum
12
go.sum
@ -20,16 +20,14 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF
|
|||||||
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
github.com/cloudnative-pg/api v1.29.1 h1:FWr8S7EQeOfdhYXyr2cof8wUXLARZiiQt5Qa6ltED7w=
|
github.com/cloudnative-pg/api v1.29.1 h1:FWr8S7EQeOfdhYXyr2cof8wUXLARZiiQt5Qa6ltED7w=
|
||||||
github.com/cloudnative-pg/api v1.29.1/go.mod h1:QtWF3yzSvIfORMHaSkPAk/o3bhCJwEHJgN3riyRiz3o=
|
github.com/cloudnative-pg/api v1.29.1/go.mod h1:QtWF3yzSvIfORMHaSkPAk/o3bhCJwEHJgN3riyRiz3o=
|
||||||
github.com/cloudnative-pg/barman-cloud v0.5.1 h1:vjkXrrxo2DQXHT9u9usqhtaHiPZ/lTfDVs/pIWYTepQ=
|
|
||||||
github.com/cloudnative-pg/barman-cloud v0.5.1/go.mod h1:XPc5IUFP1y4cZX1sg+Pd8j9V4tmUEVnv3BGCpfQOOg8=
|
|
||||||
github.com/cloudnative-pg/cloudnative-pg v1.29.1 h1:ZNEt1TMlnQKXI1kho2UqQuqdfvIvjGln4kN7C1lsmGA=
|
github.com/cloudnative-pg/cloudnative-pg v1.29.1 h1:ZNEt1TMlnQKXI1kho2UqQuqdfvIvjGln4kN7C1lsmGA=
|
||||||
github.com/cloudnative-pg/cloudnative-pg v1.29.1/go.mod h1:Sbgx9jVmkle4/gR2U5JHrzDd74sRPOBHDtPkvncg5v8=
|
github.com/cloudnative-pg/cloudnative-pg v1.29.1/go.mod h1:Sbgx9jVmkle4/gR2U5JHrzDd74sRPOBHDtPkvncg5v8=
|
||||||
github.com/cloudnative-pg/cnpg-i v0.5.0 h1:/TOzpNT6cwNgrpftTtrnLKdoHgMwd+88vZgXjlVgXeE=
|
github.com/cloudnative-pg/cnpg-i v0.5.0 h1:/TOzpNT6cwNgrpftTtrnLKdoHgMwd+88vZgXjlVgXeE=
|
||||||
github.com/cloudnative-pg/cnpg-i v0.5.0/go.mod h1:7Gh4+UzhBpGhr4DreB1GN9wGYfvxwXCXZUyVt3zE/3I=
|
github.com/cloudnative-pg/cnpg-i v0.5.0/go.mod h1:7Gh4+UzhBpGhr4DreB1GN9wGYfvxwXCXZUyVt3zE/3I=
|
||||||
github.com/cloudnative-pg/cnpg-i-machinery v0.4.2 h1:0reS9MtyLYINHXQ/MfxJ9jp39hhBf8e3Qdj+T5Nsq6I=
|
github.com/cloudnative-pg/cnpg-i-machinery v0.4.2 h1:0reS9MtyLYINHXQ/MfxJ9jp39hhBf8e3Qdj+T5Nsq6I=
|
||||||
github.com/cloudnative-pg/cnpg-i-machinery v0.4.2/go.mod h1:gvrKabgxXq0zGthXGucemDdsxakLEQDMxn43M4HLW30=
|
github.com/cloudnative-pg/cnpg-i-machinery v0.4.2/go.mod h1:gvrKabgxXq0zGthXGucemDdsxakLEQDMxn43M4HLW30=
|
||||||
github.com/cloudnative-pg/machinery v0.4.0 h1:3sfqrBptH4QQSVB4g10Z+7aiQRnh4g+6AsqsK0ibKaQ=
|
github.com/cloudnative-pg/machinery v0.5.0 h1:hhTnkzn+AiN3NmbjCQ6RXj5rfqV3K6arzq6kdXAzcnQ=
|
||||||
github.com/cloudnative-pg/machinery v0.4.0/go.mod h1:OIwaTYAnLv8PmBmBvEf0BvMK2JBX6J+naTMg9UgV1FQ=
|
github.com/cloudnative-pg/machinery v0.5.0/go.mod h1:uuFjqBUjWn0a9uvAk1ixTSzPM0PrjaS+QiKLOIBqLm4=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
|
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
@ -143,6 +141,8 @@ github.com/kubernetes-csi/external-snapshotter/client/v8 v8.4.0 h1:bMqrb3UHgHbP+
|
|||||||
github.com/kubernetes-csi/external-snapshotter/client/v8 v8.4.0/go.mod h1:E3vdYxHj2C2q6qo8/Da4g7P+IcwqRZyy3gJBzYybV9Y=
|
github.com/kubernetes-csi/external-snapshotter/client/v8 v8.4.0/go.mod h1:E3vdYxHj2C2q6qo8/Da4g7P+IcwqRZyy3gJBzYybV9Y=
|
||||||
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
|
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
|
||||||
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
|
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
|
||||||
|
github.com/leonardoce/barman-cloud v0.0.0-20260527084420-d2ef1c114ae8 h1:svNVHqtp2a7FfxuLPTm7bs9esj/tAp4arYY/8hvK3no=
|
||||||
|
github.com/leonardoce/barman-cloud v0.0.0-20260527084420-d2ef1c114ae8/go.mod h1:DACs5rdlMIQ7mUOpJVBRTrbf+d7OGyMOLsFUEMJ2JV8=
|
||||||
github.com/lib/pq v1.12.3 h1:tTWxr2YLKwIvK90ZXEw8GP7UFHtcbTtty8zsI+YjrfQ=
|
github.com/lib/pq v1.12.3 h1:tTWxr2YLKwIvK90ZXEw8GP7UFHtcbTtty8zsI+YjrfQ=
|
||||||
github.com/lib/pq v1.12.3/go.mod h1:/p+8NSbOcwzAEI7wiMXFlgydTwcgTr3OSKMsD2BitpA=
|
github.com/lib/pq v1.12.3/go.mod h1:/p+8NSbOcwzAEI7wiMXFlgydTwcgTr3OSKMsD2BitpA=
|
||||||
github.com/maruel/natural v1.1.1 h1:Hja7XhhmvEFhcByqDoHz9QZbkWey+COd9xWfCfn1ioo=
|
github.com/maruel/natural v1.1.1 h1:Hja7XhhmvEFhcByqDoHz9QZbkWey+COd9xWfCfn1ioo=
|
||||||
@ -275,8 +275,8 @@ golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs=
|
|||||||
golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q=
|
golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q=
|
||||||
golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=
|
golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=
|
||||||
golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
|
golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
|
||||||
golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI=
|
golang.org/x/sys v0.45.0 h1:dO4czNzziLiiXplLQgBCEpCvXQ3dnkn0SdaZSYdQ+FY=
|
||||||
golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
golang.org/x/sys v0.45.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
||||||
golang.org/x/term v0.42.0 h1:UiKe+zDFmJobeJ5ggPwOshJIVt6/Ft0rcfrXZDLWAWY=
|
golang.org/x/term v0.42.0 h1:UiKe+zDFmJobeJ5ggPwOshJIVt6/Ft0rcfrXZDLWAWY=
|
||||||
golang.org/x/term v0.42.0/go.mod h1:Dq/D+snpsbazcBG5+F9Q1n2rXV8Ma+71xEjTRufARgY=
|
golang.org/x/term v0.42.0/go.mod h1:Dq/D+snpsbazcBG5+F9Q1n2rXV8Ma+71xEjTRufARgY=
|
||||||
golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg=
|
golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg=
|
||||||
|
|||||||
@ -20,10 +20,38 @@ SPDX-License-Identifier: Apache-2.0
|
|||||||
package common
|
package common
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
|
|
||||||
|
barmanRestorer "github.com/cloudnative-pg/barman-cloud/pkg/restorer"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// classifyWALRestoreError maps an error returned by the WAL
|
||||||
|
// restorer to a gRPC-coded error so the caller can tell terminal
|
||||||
|
// failures apart from transient ones via the status code.
|
||||||
|
func classifyWALRestoreError(walName string, walErr error) error {
|
||||||
|
switch {
|
||||||
|
case errors.Is(walErr, barmanRestorer.ErrWALNotFound):
|
||||||
|
return newWALNotFoundError(walName)
|
||||||
|
case errors.Is(walErr, barmanRestorer.ErrInvalidWalName):
|
||||||
|
// A malformed WAL name will never become valid on retry.
|
||||||
|
return newInvalidWALNameError(walName, walErr)
|
||||||
|
case errors.Is(walErr, barmanRestorer.ErrConnectivity),
|
||||||
|
errors.Is(walErr, barmanRestorer.ErrGeneric):
|
||||||
|
// barman-cloud exit codes 2 (connectivity) and 4
|
||||||
|
// (generic) both surface conditions that are retryable
|
||||||
|
// in practice — barman uses the "generic" bucket for
|
||||||
|
// some connection-class failures too, not just exit 2.
|
||||||
|
return newUnavailableError(walName, walErr)
|
||||||
|
default:
|
||||||
|
// Unrecognized exit codes and unexpected failures (e.g.
|
||||||
|
// the barman-cloud command could not be executed). No
|
||||||
|
// positive signal that retry would help.
|
||||||
|
return newInternalWALRestoreError(walName, walErr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ErrEndOfWALStreamReached is returned when end of WAL is detected in the cloud archive.
|
// ErrEndOfWALStreamReached is returned when end of WAL is detected in the cloud archive.
|
||||||
var ErrEndOfWALStreamReached = status.Errorf(codes.OutOfRange, "end of WAL reached")
|
var ErrEndOfWALStreamReached = status.Errorf(codes.OutOfRange, "end of WAL reached")
|
||||||
|
|
||||||
@ -35,10 +63,48 @@ var ErrEndOfWALStreamReached = status.Errorf(codes.OutOfRange, "end of WAL reach
|
|||||||
var ErrMissingPermissions = status.Errorf(codes.FailedPrecondition,
|
var ErrMissingPermissions = status.Errorf(codes.FailedPrecondition,
|
||||||
"no permission to download the backup credentials, retrying")
|
"no permission to download the backup credentials, retrying")
|
||||||
|
|
||||||
// newWALNotFoundError returns a error that states that a
|
// newWALNotFoundError reports that the requested WAL file is not
|
||||||
// certain WAL file has not been found. This error is
|
// present in the object store. Emits codes.NotFound: this is a
|
||||||
// compatible with GRPC status codes, resulting in a 404
|
// terminal condition (the file won't appear on retry).
|
||||||
// being used as a response code.
|
|
||||||
func newWALNotFoundError(walName string) error {
|
func newWALNotFoundError(walName string) error {
|
||||||
return status.Errorf(codes.NotFound, "wal %q not found", walName)
|
return status.Errorf(codes.NotFound, "wal %q not found", walName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// newUnavailableError reports that downloading the WAL file failed
|
||||||
|
// for a reason expected to be transient (a barman-cloud connectivity
|
||||||
|
// blip, or a generic exit code that in practice covers retryable
|
||||||
|
// conditions too). Emits codes.Unavailable: per gRPC conventions,
|
||||||
|
// the canonical signal for "retry may succeed".
|
||||||
|
func newUnavailableError(walName string, err error) error {
|
||||||
|
return status.Errorf(
|
||||||
|
codes.Unavailable,
|
||||||
|
"transient error while downloading %q: %s",
|
||||||
|
walName,
|
||||||
|
err.Error(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// newInvalidWALNameError reports that the requested WAL name is
|
||||||
|
// not a valid name. Emits codes.InvalidArgument: this is a
|
||||||
|
// terminal condition (the same name won't become valid on retry).
|
||||||
|
func newInvalidWALNameError(walName string, err error) error {
|
||||||
|
return status.Errorf(
|
||||||
|
codes.InvalidArgument,
|
||||||
|
"invalid WAL name %q: %s",
|
||||||
|
walName,
|
||||||
|
err.Error(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// newInternalWALRestoreError reports that downloading the WAL
|
||||||
|
// file failed for an unclassified reason. Emits codes.Internal:
|
||||||
|
// we have no positive signal that retry would help, so by gRPC
|
||||||
|
// convention this is treated as terminal.
|
||||||
|
func newInternalWALRestoreError(walName string, err error) error {
|
||||||
|
return status.Errorf(
|
||||||
|
codes.Internal,
|
||||||
|
"internal error while downloading %q: %s",
|
||||||
|
walName,
|
||||||
|
err.Error(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|||||||
86
internal/cnpgi/common/errors_test.go
Normal file
86
internal/cnpgi/common/errors_test.go
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
/*
|
||||||
|
Copyright © contributors to CloudNativePG, established as
|
||||||
|
CloudNativePG a Series of LF Projects, LLC.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
package common
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
barmanRestorer "github.com/cloudnative-pg/barman-cloud/pkg/restorer"
|
||||||
|
. "github.com/onsi/ginkgo/v2"
|
||||||
|
. "github.com/onsi/gomega"
|
||||||
|
"google.golang.org/grpc/codes"
|
||||||
|
"google.golang.org/grpc/status"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ = Describe("classifyWALRestoreError", func() {
|
||||||
|
const walName = "000000010000000000000001"
|
||||||
|
|
||||||
|
DescribeTable(
|
||||||
|
"maps barman restorer sentinels to gRPC status codes",
|
||||||
|
func(walErr error, expectedCode codes.Code) {
|
||||||
|
got := classifyWALRestoreError(walName, walErr)
|
||||||
|
Expect(got).To(HaveOccurred())
|
||||||
|
|
||||||
|
st, ok := status.FromError(got)
|
||||||
|
Expect(ok).To(BeTrue(), "returned error must carry a gRPC status")
|
||||||
|
Expect(st.Code()).To(Equal(expectedCode))
|
||||||
|
Expect(st.Message()).To(ContainSubstring(walName))
|
||||||
|
},
|
||||||
|
Entry("ErrWALNotFound -> NotFound",
|
||||||
|
fmt.Errorf("object storage or file not found: %w", barmanRestorer.ErrWALNotFound),
|
||||||
|
codes.NotFound),
|
||||||
|
Entry("ErrInvalidWalName -> InvalidArgument",
|
||||||
|
fmt.Errorf("invalid name for a WAL file: %w", barmanRestorer.ErrInvalidWalName),
|
||||||
|
codes.InvalidArgument),
|
||||||
|
Entry("ErrConnectivity -> Unavailable",
|
||||||
|
fmt.Errorf("connectivity failure, retrying: %w", barmanRestorer.ErrConnectivity),
|
||||||
|
codes.Unavailable),
|
||||||
|
Entry("ErrGeneric -> Unavailable (barman uses exit 4 for some retryable cases too)",
|
||||||
|
fmt.Errorf("generic error: %w", barmanRestorer.ErrGeneric),
|
||||||
|
codes.Unavailable),
|
||||||
|
Entry("unknown error -> Internal",
|
||||||
|
errors.New("something we did not classify"),
|
||||||
|
codes.Internal),
|
||||||
|
)
|
||||||
|
|
||||||
|
It("matches the sentinel even through several wrapping layers", func() {
|
||||||
|
// The plugin wraps barman errors via fmt.Errorf("...: %w", ...);
|
||||||
|
// classification must keep working if more wraps appear above.
|
||||||
|
inner := fmt.Errorf("connectivity failure, retrying: %w", barmanRestorer.ErrConnectivity)
|
||||||
|
wrapped := fmt.Errorf("while restoring WAL %s: %w", walName, inner)
|
||||||
|
|
||||||
|
got := classifyWALRestoreError(walName, wrapped)
|
||||||
|
st, ok := status.FromError(got)
|
||||||
|
Expect(ok).To(BeTrue())
|
||||||
|
Expect(st.Code()).To(Equal(codes.Unavailable))
|
||||||
|
})
|
||||||
|
|
||||||
|
It("treats ErrWALNotFound as terminal even when the error chain mentions other sentinels in its message", func() {
|
||||||
|
// Defensive: if the underlying error stringifies to something
|
||||||
|
// resembling another sentinel's message, the switch must still
|
||||||
|
// match by identity (errors.Is), not by substring.
|
||||||
|
walErr := fmt.Errorf("not found, looks like a connectivity failure: %w", barmanRestorer.ErrWALNotFound)
|
||||||
|
|
||||||
|
got := classifyWALRestoreError(walName, walErr)
|
||||||
|
st, _ := status.FromError(got)
|
||||||
|
Expect(st.Code()).To(Equal(codes.NotFound))
|
||||||
|
})
|
||||||
|
})
|
||||||
32
internal/cnpgi/common/suite_test.go
Normal file
32
internal/cnpgi/common/suite_test.go
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
Copyright © contributors to CloudNativePG, established as
|
||||||
|
CloudNativePG a Series of LF Projects, LLC.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
package common
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
. "github.com/onsi/ginkgo/v2"
|
||||||
|
. "github.com/onsi/gomega"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestCommon(t *testing.T) {
|
||||||
|
RegisterFailHandler(Fail)
|
||||||
|
RunSpecs(t, "Common Suite")
|
||||||
|
}
|
||||||
@ -365,11 +365,7 @@ func (w WALServiceImplementation) restoreFromBarmanObjectStore(
|
|||||||
// is the one that PostgreSQL has requested to restore.
|
// is the one that PostgreSQL has requested to restore.
|
||||||
// The failure has already been logged in walRestorer.RestoreList method
|
// The failure has already been logged in walRestorer.RestoreList method
|
||||||
if walStatus[0].Err != nil {
|
if walStatus[0].Err != nil {
|
||||||
if errors.Is(walStatus[0].Err, barmanRestorer.ErrWALNotFound) {
|
return classifyWALRestoreError(walStatus[0].WalName, walStatus[0].Err)
|
||||||
return newWALNotFoundError(walStatus[0].WalName)
|
|
||||||
}
|
|
||||||
|
|
||||||
return walStatus[0].Err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We skip this step if streaming connection is not available
|
// We skip this step if streaming connection is not available
|
||||||
|
|||||||
@ -175,6 +175,25 @@ spec:
|
|||||||
format: int32
|
format: int32
|
||||||
minimum: 1
|
minimum: 1
|
||||||
type: integer
|
type: integer
|
||||||
|
restoreAdditionalCommandArgs:
|
||||||
|
description: |-
|
||||||
|
Additional arguments that can be appended to the 'barman-cloud-restore'
|
||||||
|
command-line invocation. These arguments provide flexibility to customize
|
||||||
|
the data restore process further, according to specific requirements or
|
||||||
|
configurations.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
In a scenario where specialized restore options are required, such as setting
|
||||||
|
a specific read timeout or defining custom behavior, users can use this field
|
||||||
|
to specify additional command arguments.
|
||||||
|
|
||||||
|
Note:
|
||||||
|
It's essential to ensure that the provided arguments are valid and supported
|
||||||
|
by the 'barman-cloud-restore' command, to avoid potential errors or unintended
|
||||||
|
behavior during execution.
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
type: array
|
||||||
type: object
|
type: object
|
||||||
destinationPath:
|
destinationPath:
|
||||||
description: |-
|
description: |-
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user