mirror of
https://github.com/cloudnative-pg/plugin-barman-cloud.git
synced 2026-03-10 20:52:22 +01:00
Compare commits
8 Commits
9aa1b5da3a
...
4f2e4fac48
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f2e4fac48 | ||
|
|
e5eb03e181 | ||
|
|
e943923f8f | ||
|
|
4a637d7c58 | ||
|
|
24fbc01a33 | ||
|
|
97675a7685 | ||
|
|
1eeed9f783 | ||
|
|
6ec77fb159 |
2
Makefile
2
Makefile
@ -159,7 +159,7 @@ GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
|
|||||||
|
|
||||||
## Tool Versions
|
## Tool Versions
|
||||||
KUSTOMIZE_VERSION ?= v5.4.3
|
KUSTOMIZE_VERSION ?= v5.4.3
|
||||||
CONTROLLER_TOOLS_VERSION ?= v0.16.1
|
CONTROLLER_TOOLS_VERSION ?= v0.19.0
|
||||||
ENVTEST_VERSION ?= release-0.19
|
ENVTEST_VERSION ?= release-0.19
|
||||||
GOLANGCI_LINT_VERSION ?= v1.64.8
|
GOLANGCI_LINT_VERSION ?= v1.64.8
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@ tasks:
|
|||||||
desc: Run golangci-lint
|
desc: Run golangci-lint
|
||||||
env:
|
env:
|
||||||
# renovate: datasource=git-refs depName=golangci-lint lookupName=https://github.com/sagikazarmark/daggerverse currentValue=main
|
# renovate: datasource=git-refs depName=golangci-lint lookupName=https://github.com/sagikazarmark/daggerverse currentValue=main
|
||||||
DAGGER_GOLANGCI_LINT_SHA: 6133ad18e131b891d4723b8e25d69f5de077b472
|
DAGGER_GOLANGCI_LINT_SHA: 5dcc7e4c4cd5ed230046955f42e27f2166545155
|
||||||
# renovate: datasource=docker depName=golangci/golangci-lint versioning=semver
|
# renovate: datasource=docker depName=golangci/golangci-lint versioning=semver
|
||||||
GOLANGCI_LINT_VERSION: v2.7.2
|
GOLANGCI_LINT_VERSION: v2.7.2
|
||||||
cmds:
|
cmds:
|
||||||
@ -486,7 +486,7 @@ tasks:
|
|||||||
IMAGE_VERSION: '{{regexReplaceAll "(\\d+)/merge" .GITHUB_REF_NAME "pr-${1}"}}'
|
IMAGE_VERSION: '{{regexReplaceAll "(\\d+)/merge" .GITHUB_REF_NAME "pr-${1}"}}'
|
||||||
env:
|
env:
|
||||||
# renovate: datasource=git-refs depName=kustomize lookupName=https://github.com/sagikazarmark/daggerverse currentValue=main
|
# renovate: datasource=git-refs depName=kustomize lookupName=https://github.com/sagikazarmark/daggerverse currentValue=main
|
||||||
DAGGER_KUSTOMIZE_SHA: 6133ad18e131b891d4723b8e25d69f5de077b472
|
DAGGER_KUSTOMIZE_SHA: 5dcc7e4c4cd5ed230046955f42e27f2166545155
|
||||||
cmds:
|
cmds:
|
||||||
- >
|
- >
|
||||||
dagger -s call -m https://github.com/sagikazarmark/daggerverse/kustomize@${DAGGER_KUSTOMIZE_SHA}
|
dagger -s call -m https://github.com/sagikazarmark/daggerverse/kustomize@${DAGGER_KUSTOMIZE_SHA}
|
||||||
@ -516,7 +516,7 @@ tasks:
|
|||||||
- GITHUB_TOKEN
|
- GITHUB_TOKEN
|
||||||
env:
|
env:
|
||||||
# renovate: datasource=git-refs depName=gh lookupName=https://github.com/sagikazarmark/daggerverse
|
# renovate: datasource=git-refs depName=gh lookupName=https://github.com/sagikazarmark/daggerverse
|
||||||
DAGGER_GH_SHA: 6133ad18e131b891d4723b8e25d69f5de077b472
|
DAGGER_GH_SHA: 5dcc7e4c4cd5ed230046955f42e27f2166545155
|
||||||
preconditions:
|
preconditions:
|
||||||
- sh: "[[ {{.GITHUB_REF}} =~ 'refs/tags/v.*' ]]"
|
- sh: "[[ {{.GITHUB_REF}} =~ 'refs/tags/v.*' ]]"
|
||||||
msg: not a tag, failing
|
msg: not a tag, failing
|
||||||
|
|||||||
@ -94,6 +94,9 @@ type RecoveryWindow struct {
|
|||||||
|
|
||||||
// The last failed backup time
|
// The last failed backup time
|
||||||
LastFailedBackupTime *metav1.Time `json:"lastFailedBackupTime,omitempty"`
|
LastFailedBackupTime *metav1.Time `json:"lastFailedBackupTime,omitempty"`
|
||||||
|
|
||||||
|
// The last time a WAL file was successfully archived by this plugin
|
||||||
|
LastArchivedWALTime *metav1.Time `json:"lastArchivedWALTime,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// +kubebuilder:object:root=true
|
// +kubebuilder:object:root=true
|
||||||
|
|||||||
@ -169,6 +169,10 @@ func (in *RecoveryWindow) DeepCopyInto(out *RecoveryWindow) {
|
|||||||
in, out := &in.LastFailedBackupTime, &out.LastFailedBackupTime
|
in, out := &in.LastFailedBackupTime, &out.LastFailedBackupTime
|
||||||
*out = (*in).DeepCopy()
|
*out = (*in).DeepCopy()
|
||||||
}
|
}
|
||||||
|
if in.LastArchivedWALTime != nil {
|
||||||
|
in, out := &in.LastArchivedWALTime, &out.LastArchivedWALTime
|
||||||
|
*out = (*in).DeepCopy()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RecoveryWindow.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RecoveryWindow.
|
||||||
|
|||||||
@ -676,6 +676,11 @@ spec:
|
|||||||
restored.
|
restored.
|
||||||
format: date-time
|
format: date-time
|
||||||
type: string
|
type: string
|
||||||
|
lastArchivedWALTime:
|
||||||
|
description: The last time a WAL file was successfully archived
|
||||||
|
by this plugin
|
||||||
|
format: date-time
|
||||||
|
type: string
|
||||||
lastFailedBackupTime:
|
lastFailedBackupTime:
|
||||||
description: The last failed backup time
|
description: The last failed backup time
|
||||||
format: date-time
|
format: date-time
|
||||||
|
|||||||
@ -4,9 +4,9 @@
|
|||||||
#
|
#
|
||||||
# pip-compile --allow-unsafe --generate-hashes --output-file=sidecar-requirements.txt --strip-extras sidecar-requirements.in
|
# pip-compile --allow-unsafe --generate-hashes --output-file=sidecar-requirements.txt --strip-extras sidecar-requirements.in
|
||||||
#
|
#
|
||||||
azure-core==1.37.0 \
|
azure-core==1.38.0 \
|
||||||
--hash=sha256:7064f2c11e4b97f340e8e8c6d923b822978be3016e46b7bc4aa4b337cfb48aee \
|
--hash=sha256:8194d2682245a3e4e3151a667c686464c3786fed7918b394d035bdcd61bb5993 \
|
||||||
--hash=sha256:b3abe2c59e7d6bb18b38c275a5029ff80f98990e7c90a5e646249a56630fcc19
|
--hash=sha256:ab0c9b2cd71fecb1842d52c965c95285d3cfb38902f6766e4a471f1cd8905335
|
||||||
# via
|
# via
|
||||||
# azure-identity
|
# azure-identity
|
||||||
# azure-storage-blob
|
# azure-storage-blob
|
||||||
@ -14,31 +14,27 @@ azure-identity==1.25.1 \
|
|||||||
--hash=sha256:87ca8328883de6036443e1c37b40e8dc8fb74898240f61071e09d2e369361456 \
|
--hash=sha256:87ca8328883de6036443e1c37b40e8dc8fb74898240f61071e09d2e369361456 \
|
||||||
--hash=sha256:e9edd720af03dff020223cd269fa3a61e8f345ea75443858273bcb44844ab651
|
--hash=sha256:e9edd720af03dff020223cd269fa3a61e8f345ea75443858273bcb44844ab651
|
||||||
# via barman
|
# via barman
|
||||||
azure-storage-blob==12.27.1 \
|
azure-storage-blob==12.28.0 \
|
||||||
--hash=sha256:65d1e25a4628b7b6acd20ff7902d8da5b4fde8e46e19c8f6d213a3abc3ece272 \
|
--hash=sha256:00fb1db28bf6a7b7ecaa48e3b1d5c83bfadacc5a678b77826081304bd87d6461 \
|
||||||
--hash=sha256:a1596cc4daf5dac9be115fcb5db67245eae894cf40e4248243754261f7b674a6
|
--hash=sha256:e7d98ea108258d29aa0efbfd591b2e2075fa1722a2fae8699f0b3c9de11eff41
|
||||||
# via barman
|
# via barman
|
||||||
barman==3.17.0 \
|
barman==3.17.0 \
|
||||||
--hash=sha256:07b033da14e72f103de44261c31bd0c3169bbb2e4de3481c6bb3510e9870d38e \
|
--hash=sha256:07b033da14e72f103de44261c31bd0c3169bbb2e4de3481c6bb3510e9870d38e \
|
||||||
--hash=sha256:d6618990a6dbb31af3286d746a278a038534b7e3cc617c2b379ef7ebdeb7ed5a
|
--hash=sha256:d6618990a6dbb31af3286d746a278a038534b7e3cc617c2b379ef7ebdeb7ed5a
|
||||||
# via -r sidecar-requirements.in
|
# via -r sidecar-requirements.in
|
||||||
boto3==1.42.14 \
|
boto3==1.42.26 \
|
||||||
--hash=sha256:a5d005667b480c844ed3f814a59f199ce249d0f5669532a17d06200c0a93119c \
|
--hash=sha256:0fbcf1922e62d180f3644bc1139425821b38d93c1e6ec27409325d2ae86131aa \
|
||||||
--hash=sha256:bfcc665227bb4432a235cb4adb47719438d6472e5ccbf7f09512046c3f749670
|
--hash=sha256:f116cfbe7408e0a9153da363f134d2f1b5008f17ee86af104f0ce59a62be1833
|
||||||
# via barman
|
# via barman
|
||||||
botocore==1.42.14 \
|
botocore==1.42.26 \
|
||||||
--hash=sha256:cf5bebb580803c6cfd9886902ca24834b42ecaa808da14fb8cd35ad523c9f621 \
|
--hash=sha256:1c8855e3e811f015d930ccfe8751d4be295aae0562133d14b6f0b247cd6fd8d3 \
|
||||||
--hash=sha256:efe89adfafa00101390ec2c371d453b3359d5f9690261bc3bd70131e0d453e8e
|
--hash=sha256:71171c2d09ac07739f4efce398b15a4a8bc8769c17fb3bc99625e43ed11ad8b7
|
||||||
# via
|
# via
|
||||||
# boto3
|
# boto3
|
||||||
# s3transfer
|
# s3transfer
|
||||||
cachetools==6.2.4 \
|
certifi==2026.1.4 \
|
||||||
--hash=sha256:69a7a52634fed8b8bf6e24a050fb60bff1c9bd8f6d24572b99c32d4e71e62a51 \
|
--hash=sha256:9943707519e4add1115f44c2bc244f782c0249876bf51b6599fee1ffbedd685c \
|
||||||
--hash=sha256:82c5c05585e70b6ba2d3ae09ea60b79548872185d2f24ae1f2709d37299fd607
|
--hash=sha256:ac726dd470482006e014ad384921ed6438c457018f4b3d204aea4281258b2120
|
||||||
# via google-auth
|
|
||||||
certifi==2025.11.12 \
|
|
||||||
--hash=sha256:97de8790030bbd5c2d96b7ec782fc2f7820ef8dba6db909ccf95449f2d062d4b \
|
|
||||||
--hash=sha256:d8ab5478f2ecd78af242878415affce761ca6bc54a22a27e026d7c25357c3316
|
|
||||||
# via requests
|
# via requests
|
||||||
cffi==2.0.0 \
|
cffi==2.0.0 \
|
||||||
--hash=sha256:00bdf7acc5f795150faa6957054fbbca2439db2f775ce831222b66f192f03beb \
|
--hash=sha256:00bdf7acc5f795150faa6957054fbbca2439db2f775ce831222b66f192f03beb \
|
||||||
@ -438,15 +434,15 @@ cryptography==46.0.3 \
|
|||||||
# azure-storage-blob
|
# azure-storage-blob
|
||||||
# msal
|
# msal
|
||||||
# pyjwt
|
# pyjwt
|
||||||
google-api-core==2.28.1 \
|
google-api-core==2.29.0 \
|
||||||
--hash=sha256:2b405df02d68e68ce0fbc138559e6036559e685159d148ae5861013dc201baf8 \
|
--hash=sha256:84181be0f8e6b04006df75ddfe728f24489f0af57c96a529ff7cf45bc28797f7 \
|
||||||
--hash=sha256:4021b0f8ceb77a6fb4de6fde4502cecab45062e66ff4f2895169e0b35bc9466c
|
--hash=sha256:d30bc60980daa36e314b5d5a3e5958b0200cb44ca8fa1be2b614e932b75a3ea9
|
||||||
# via
|
# via
|
||||||
# google-cloud-core
|
# google-cloud-core
|
||||||
# google-cloud-storage
|
# google-cloud-storage
|
||||||
google-auth==2.45.0 \
|
google-auth==2.47.0 \
|
||||||
--hash=sha256:82344e86dc00410ef5382d99be677c6043d72e502b625aa4f4afa0bdacca0f36 \
|
--hash=sha256:833229070a9dfee1a353ae9877dcd2dec069a8281a4e72e72f77d4a70ff945da \
|
||||||
--hash=sha256:90d3f41b6b72ea72dd9811e765699ee491ab24139f34ebf1ca2b9cc0c38708f3
|
--hash=sha256:c516d68336bfde7cf0da26aab674a36fedcf04b37ac4edd59c597178760c3498
|
||||||
# via
|
# via
|
||||||
# google-api-core
|
# google-api-core
|
||||||
# google-cloud-core
|
# google-cloud-core
|
||||||
@ -591,17 +587,17 @@ proto-plus==1.27.0 \
|
|||||||
--hash=sha256:1baa7f81cf0f8acb8bc1f6d085008ba4171eaf669629d1b6d1673b21ed1c0a82 \
|
--hash=sha256:1baa7f81cf0f8acb8bc1f6d085008ba4171eaf669629d1b6d1673b21ed1c0a82 \
|
||||||
--hash=sha256:873af56dd0d7e91836aee871e5799e1c6f1bda86ac9a983e0bb9f0c266a568c4
|
--hash=sha256:873af56dd0d7e91836aee871e5799e1c6f1bda86ac9a983e0bb9f0c266a568c4
|
||||||
# via google-api-core
|
# via google-api-core
|
||||||
protobuf==6.33.2 \
|
protobuf==6.33.4 \
|
||||||
--hash=sha256:1f8017c48c07ec5859106533b682260ba3d7c5567b1ca1f24297ce03384d1b4f \
|
--hash=sha256:0f12ddbf96912690c3582f9dffb55530ef32015ad8e678cd494312bd78314c4f \
|
||||||
--hash=sha256:2981c58f582f44b6b13173e12bb8656711189c2a70250845f264b877f00b1913 \
|
--hash=sha256:1fe3730068fcf2e595816a6c34fe66eeedd37d51d0400b72fabc848811fdc1bc \
|
||||||
--hash=sha256:56dc370c91fbb8ac85bc13582c9e373569668a290aa2e66a590c2a0d35ddb9e4 \
|
--hash=sha256:2fe67f6c014c84f655ee06f6f66213f9254b3a8b6bda6cda0ccd4232c73c06f0 \
|
||||||
--hash=sha256:7109dcc38a680d033ffb8bf896727423528db9163be1b6a02d6a49606dcadbfe \
|
--hash=sha256:3df850c2f8db9934de4cf8f9152f8dc2558f49f298f37f90c517e8e5c84c30e9 \
|
||||||
--hash=sha256:7636aad9bb01768870266de5dc009de2d1b936771b38a793f73cbbf279c91c5c \
|
--hash=sha256:757c978f82e74d75cba88eddec479df9b99a42b31193313b75e492c06a51764e \
|
||||||
--hash=sha256:87eb388bd2d0f78febd8f4c8779c79247b26a5befad525008e49a6955787ff3d \
|
--hash=sha256:8f11ffae31ec67fc2554c2ef891dcb561dae9a2a3ed941f9e134c2db06657dbc \
|
||||||
--hash=sha256:8cd7640aee0b7828b6d03ae518b5b4806fdfc1afe8de82f79c3454f8aef29872 \
|
--hash=sha256:918966612c8232fc6c24c78e1cd89784307f5814ad7506c308ee3cf86662850d \
|
||||||
--hash=sha256:b5d3b5625192214066d99b2b605f5783483575656784de223f00a8d00754fc0e \
|
--hash=sha256:955478a89559fa4568f5a81dce77260eabc5c686f9e8366219ebd30debf06aa6 \
|
||||||
--hash=sha256:d9b19771ca75935b3a4422957bc518b0cecb978b31d1dd12037b088f6bcc0e43 \
|
--hash=sha256:c7c64f259c618f0bef7bee042075e390debbf9682334be2b67408ec7c1c09ee6 \
|
||||||
--hash=sha256:fc2a0e8b05b180e5fc0dd1559fe8ebdae21a27e81ac77728fb6c42b12c7419b4
|
--hash=sha256:dc2e61bca3b10470c1912d166fe0af67bfc20eb55971dcef8dfa48ce14f0ed91
|
||||||
# via
|
# via
|
||||||
# google-api-core
|
# google-api-core
|
||||||
# googleapis-common-protos
|
# googleapis-common-protos
|
||||||
@ -672,9 +668,9 @@ typing-extensions==4.15.0 \
|
|||||||
# azure-core
|
# azure-core
|
||||||
# azure-identity
|
# azure-identity
|
||||||
# azure-storage-blob
|
# azure-storage-blob
|
||||||
urllib3==2.6.2 \
|
urllib3==2.6.3 \
|
||||||
--hash=sha256:016f9c98bb7e98085cb2b4b17b87d2c702975664e4f060c6532e64d1c1a5e797 \
|
--hash=sha256:1b62b6884944a57dbe321509ab94fd4d3b307075e0c2eae991ac71ee15ad38ed \
|
||||||
--hash=sha256:ec21cddfe7724fc7cb4ba4bea7aa8e2ef36f607a4bab81aa6ce42a13dc3f03dd
|
--hash=sha256:bf272323e553dfb2e87d9bfd225ca7b0f467b919d7bbd355436d3fd37cb0acd4
|
||||||
# via
|
# via
|
||||||
# botocore
|
# botocore
|
||||||
# requests
|
# requests
|
||||||
|
|||||||
4
go.mod
4
go.mod
@ -12,8 +12,8 @@ require (
|
|||||||
github.com/cloudnative-pg/cnpg-i v0.3.1
|
github.com/cloudnative-pg/cnpg-i v0.3.1
|
||||||
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.3.3
|
github.com/cloudnative-pg/machinery v0.3.3
|
||||||
github.com/onsi/ginkgo/v2 v2.27.3
|
github.com/onsi/ginkgo/v2 v2.27.5
|
||||||
github.com/onsi/gomega v1.38.3
|
github.com/onsi/gomega v1.39.0
|
||||||
github.com/spf13/cobra v1.10.2
|
github.com/spf13/cobra v1.10.2
|
||||||
github.com/spf13/viper v1.21.0
|
github.com/spf13/viper v1.21.0
|
||||||
google.golang.org/grpc v1.78.0
|
google.golang.org/grpc v1.78.0
|
||||||
|
|||||||
8
go.sum
8
go.sum
@ -163,10 +163,10 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq
|
|||||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
|
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
|
||||||
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus=
|
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus=
|
||||||
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
|
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
|
||||||
github.com/onsi/ginkgo/v2 v2.27.3 h1:ICsZJ8JoYafeXFFlFAG75a7CxMsJHwgKwtO+82SE9L8=
|
github.com/onsi/ginkgo/v2 v2.27.5 h1:ZeVgZMx2PDMdJm/+w5fE/OyG6ILo1Y3e+QX4zSR0zTE=
|
||||||
github.com/onsi/ginkgo/v2 v2.27.3/go.mod h1:ArE1D/XhNXBXCBkKOLkbsb2c81dQHCRcF5zwn/ykDRo=
|
github.com/onsi/ginkgo/v2 v2.27.5/go.mod h1:ArE1D/XhNXBXCBkKOLkbsb2c81dQHCRcF5zwn/ykDRo=
|
||||||
github.com/onsi/gomega v1.38.3 h1:eTX+W6dobAYfFeGC2PV6RwXRu/MyT+cQguijutvkpSM=
|
github.com/onsi/gomega v1.39.0 h1:y2ROC3hKFmQZJNFeGAMeHZKkjBL65mIZcvrLQBF9k6Q=
|
||||||
github.com/onsi/gomega v1.38.3/go.mod h1:ZCU1pkQcXDO5Sl9/VVEGlDyp+zm0m1cmeG5TOzLgdh4=
|
github.com/onsi/gomega v1.39.0/go.mod h1:ZCU1pkQcXDO5Sl9/VVEGlDyp+zm0m1cmeG5TOzLgdh4=
|
||||||
github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4=
|
github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4=
|
||||||
github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
|
github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
|
||||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/cloudnative-pg/barman-cloud/pkg/archiver"
|
"github.com/cloudnative-pg/barman-cloud/pkg/archiver"
|
||||||
@ -38,7 +39,10 @@ import (
|
|||||||
walUtils "github.com/cloudnative-pg/machinery/pkg/fileutils/wals"
|
walUtils "github.com/cloudnative-pg/machinery/pkg/fileutils/wals"
|
||||||
"github.com/cloudnative-pg/machinery/pkg/log"
|
"github.com/cloudnative-pg/machinery/pkg/log"
|
||||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
|
"k8s.io/client-go/util/retry"
|
||||||
|
"k8s.io/utils/ptr"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||||
|
|
||||||
barmancloudv1 "github.com/cloudnative-pg/plugin-barman-cloud/api/v1"
|
barmancloudv1 "github.com/cloudnative-pg/plugin-barman-cloud/api/v1"
|
||||||
@ -67,6 +71,11 @@ func (e *SpoolManagementError) Unwrap() error {
|
|||||||
return e.err
|
return e.err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
// walStatusUpdateThrottle is the minimum time between status updates for WAL archiving
|
||||||
|
walStatusUpdateThrottle = 5 * time.Minute
|
||||||
|
)
|
||||||
|
|
||||||
// WALServiceImplementation is the implementation of the WAL Service
|
// WALServiceImplementation is the implementation of the WAL Service
|
||||||
type WALServiceImplementation struct {
|
type WALServiceImplementation struct {
|
||||||
wal.UnimplementedWALServer
|
wal.UnimplementedWALServer
|
||||||
@ -75,6 +84,9 @@ type WALServiceImplementation struct {
|
|||||||
SpoolDirectory string
|
SpoolDirectory string
|
||||||
PGDataPath string
|
PGDataPath string
|
||||||
PGWALPath string
|
PGWALPath string
|
||||||
|
// LastStatusUpdate tracks the last time we updated the status for each ObjectStore+ServerName
|
||||||
|
// Key format: "namespace/objectStoreName/serverName"
|
||||||
|
LastStatusUpdate *sync.Map
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetCapabilities implements the WALService interface
|
// GetCapabilities implements the WALService interface
|
||||||
@ -102,6 +114,37 @@ func (w WALServiceImplementation) GetCapabilities(
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// shouldUpdateStatus checks if we should update the status based on the throttle.
|
||||||
|
// It returns true if walStatusUpdateThrottle minutes have passed since the last update, or if this is the first update.
|
||||||
|
func (w WALServiceImplementation) shouldUpdateStatus(objectStoreKey client.ObjectKey, serverName string) bool {
|
||||||
|
if w.LastStatusUpdate == nil {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
key := fmt.Sprintf("%s/%s", objectStoreKey.String(), serverName)
|
||||||
|
lastUpdate, ok := w.LastStatusUpdate.Load(key)
|
||||||
|
if !ok {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
lastUpdateTime, ok := lastUpdate.(time.Time)
|
||||||
|
if !ok {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return time.Since(lastUpdateTime) >= walStatusUpdateThrottle
|
||||||
|
}
|
||||||
|
|
||||||
|
// recordStatusUpdate records that we just updated the status for a given ObjectStore and server.
|
||||||
|
func (w WALServiceImplementation) recordStatusUpdate(objectStoreKey client.ObjectKey, serverName string) {
|
||||||
|
if w.LastStatusUpdate == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
key := fmt.Sprintf("%s/%s", objectStoreKey.String(), serverName)
|
||||||
|
w.LastStatusUpdate.Store(key, time.Now())
|
||||||
|
}
|
||||||
|
|
||||||
// Archive implements the WALService interface
|
// Archive implements the WALService interface
|
||||||
func (w WALServiceImplementation) Archive(
|
func (w WALServiceImplementation) Archive(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
@ -220,6 +263,28 @@ func (w WALServiceImplementation) Archive(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update the last archived WAL time in the ObjectStore status
|
||||||
|
// Only update if walStatusUpdateThrottle minutes have passed since the last update to avoid hitting the API server too often
|
||||||
|
objectStoreKey := configuration.GetBarmanObjectKey()
|
||||||
|
if w.shouldUpdateStatus(objectStoreKey, configuration.ServerName) {
|
||||||
|
contextLogger.Debug("Updating last archived WAL time", "serverName", configuration.ServerName)
|
||||||
|
if err := setLastArchivedWALTime(
|
||||||
|
ctx,
|
||||||
|
w.Client,
|
||||||
|
objectStoreKey,
|
||||||
|
configuration.ServerName,
|
||||||
|
time.Now(),
|
||||||
|
); err != nil {
|
||||||
|
// Log the error but don't fail the archive operation
|
||||||
|
contextLogger.Error(err, "Error updating last archived WAL time in ObjectStore status")
|
||||||
|
} else {
|
||||||
|
contextLogger.Debug("Successfully updated last archived WAL time")
|
||||||
|
w.recordStatusUpdate(objectStoreKey, configuration.ServerName)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
contextLogger.Debug("Skipping status update due to throttle", "serverName", configuration.ServerName)
|
||||||
|
}
|
||||||
|
|
||||||
return &wal.WALArchiveResult{}, nil
|
return &wal.WALArchiveResult{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -509,3 +574,30 @@ func isEndOfWALStream(results []barmanRestorer.Result) bool {
|
|||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetLastArchivedWALTime sets the last archived WAL time in the
|
||||||
|
// passed object store, for the passed server name.
|
||||||
|
func setLastArchivedWALTime(
|
||||||
|
ctx context.Context,
|
||||||
|
c client.Client,
|
||||||
|
objectStoreKey client.ObjectKey,
|
||||||
|
serverName string,
|
||||||
|
lastArchivedWALTime time.Time,
|
||||||
|
) error {
|
||||||
|
return retry.RetryOnConflict(retry.DefaultBackoff, func() error {
|
||||||
|
var objectStore barmancloudv1.ObjectStore
|
||||||
|
|
||||||
|
if err := c.Get(ctx, objectStoreKey, &objectStore); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
recoveryWindow := objectStore.Status.ServerRecoveryWindow[serverName]
|
||||||
|
recoveryWindow.LastArchivedWALTime = ptr.To(metav1.NewTime(lastArchivedWALTime))
|
||||||
|
|
||||||
|
if objectStore.Status.ServerRecoveryWindow == nil {
|
||||||
|
objectStore.Status.ServerRecoveryWindow = make(map[string]barmancloudv1.RecoveryWindow)
|
||||||
|
}
|
||||||
|
objectStore.Status.ServerRecoveryWindow[serverName] = recoveryWindow
|
||||||
|
|
||||||
|
return c.Status().Update(ctx, &objectStore)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@ -51,6 +51,7 @@ var (
|
|||||||
firstRecoverabilityPointMetricName = buildFqName("first_recoverability_point")
|
firstRecoverabilityPointMetricName = buildFqName("first_recoverability_point")
|
||||||
lastAvailableBackupTimestampMetricName = buildFqName("last_available_backup_timestamp")
|
lastAvailableBackupTimestampMetricName = buildFqName("last_available_backup_timestamp")
|
||||||
lastFailedBackupTimestampMetricName = buildFqName("last_failed_backup_timestamp")
|
lastFailedBackupTimestampMetricName = buildFqName("last_failed_backup_timestamp")
|
||||||
|
lastArchivedWALTimestampMetricName = buildFqName("last_archived_wal_timestamp")
|
||||||
)
|
)
|
||||||
|
|
||||||
func (m metricsImpl) GetCapabilities(
|
func (m metricsImpl) GetCapabilities(
|
||||||
@ -97,6 +98,11 @@ func (m metricsImpl) Define(
|
|||||||
Help: "The last failed backup as a unix timestamp",
|
Help: "The last failed backup as a unix timestamp",
|
||||||
ValueType: &metrics.MetricType{Type: metrics.MetricType_TYPE_GAUGE},
|
ValueType: &metrics.MetricType{Type: metrics.MetricType_TYPE_GAUGE},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
FqName: lastArchivedWALTimestampMetricName,
|
||||||
|
Help: "The last archived WAL timestamp as a unix timestamp",
|
||||||
|
ValueType: &metrics.MetricType{Type: metrics.MetricType_TYPE_GAUGE},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
@ -136,6 +142,10 @@ func (m metricsImpl) Collect(
|
|||||||
FqName: lastFailedBackupTimestampMetricName,
|
FqName: lastFailedBackupTimestampMetricName,
|
||||||
Value: 0,
|
Value: 0,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
FqName: lastArchivedWALTimestampMetricName,
|
||||||
|
Value: 0,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
@ -143,6 +153,7 @@ func (m metricsImpl) Collect(
|
|||||||
var firstRecoverabilityPoint float64
|
var firstRecoverabilityPoint float64
|
||||||
var lastAvailableBackup float64
|
var lastAvailableBackup float64
|
||||||
var lastFailedBackup float64
|
var lastFailedBackup float64
|
||||||
|
var lastArchivedWAL float64
|
||||||
if x.FirstRecoverabilityPoint != nil {
|
if x.FirstRecoverabilityPoint != nil {
|
||||||
firstRecoverabilityPoint = float64(x.FirstRecoverabilityPoint.Unix())
|
firstRecoverabilityPoint = float64(x.FirstRecoverabilityPoint.Unix())
|
||||||
}
|
}
|
||||||
@ -152,6 +163,9 @@ func (m metricsImpl) Collect(
|
|||||||
if x.LastFailedBackupTime != nil {
|
if x.LastFailedBackupTime != nil {
|
||||||
lastFailedBackup = float64(x.LastFailedBackupTime.Unix())
|
lastFailedBackup = float64(x.LastFailedBackupTime.Unix())
|
||||||
}
|
}
|
||||||
|
if x.LastArchivedWALTime != nil {
|
||||||
|
lastArchivedWAL = float64(x.LastArchivedWALTime.Unix())
|
||||||
|
}
|
||||||
|
|
||||||
return &metrics.CollectMetricsResult{
|
return &metrics.CollectMetricsResult{
|
||||||
Metrics: []*metrics.CollectMetric{
|
Metrics: []*metrics.CollectMetric{
|
||||||
@ -167,6 +181,10 @@ func (m metricsImpl) Collect(
|
|||||||
FqName: lastFailedBackupTimestampMetricName,
|
FqName: lastFailedBackupTimestampMetricName,
|
||||||
Value: lastFailedBackup,
|
Value: lastFailedBackup,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
FqName: lastArchivedWALTimestampMetricName,
|
||||||
|
Value: lastArchivedWAL,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,10 +22,11 @@ package instance
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"time"
|
||||||
|
|
||||||
cnpgv1 "github.com/cloudnative-pg/cloudnative-pg/api/v1"
|
cnpgv1 "github.com/cloudnative-pg/cloudnative-pg/api/v1"
|
||||||
"github.com/cloudnative-pg/plugin-barman-cloud/internal/cnpgi/metadata"
|
"github.com/cloudnative-pg/plugin-barman-cloud/internal/cnpgi/metadata"
|
||||||
"k8s.io/utils/ptr"
|
"k8s.io/utils/ptr"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/cloudnative-pg/cnpg-i/pkg/metrics"
|
"github.com/cloudnative-pg/cnpg-i/pkg/metrics"
|
||||||
barmancloudv1 "github.com/cloudnative-pg/plugin-barman-cloud/api/v1"
|
barmancloudv1 "github.com/cloudnative-pg/plugin-barman-cloud/api/v1"
|
||||||
@ -117,7 +118,7 @@ var _ = Describe("Metrics Collect method", func() {
|
|||||||
res, err := m.Collect(ctx, req)
|
res, err := m.Collect(ctx, req)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(res).ToNot(BeNil())
|
Expect(res).ToNot(BeNil())
|
||||||
Expect(res.Metrics).To(HaveLen(3))
|
Expect(res.Metrics).To(HaveLen(4))
|
||||||
|
|
||||||
// Verify the metrics
|
// Verify the metrics
|
||||||
metricsMap := make(map[string]float64)
|
metricsMap := make(map[string]float64)
|
||||||
@ -131,6 +132,13 @@ var _ = Describe("Metrics Collect method", func() {
|
|||||||
|
|
||||||
expectedLastBackup, _ := metricsMap[lastAvailableBackupTimestampMetricName]
|
expectedLastBackup, _ := metricsMap[lastAvailableBackupTimestampMetricName]
|
||||||
Expect(expectedLastBackup).To(BeNumerically("~", float64(objectStore.Status.ServerRecoveryWindow[clusterName].LastSuccessfulBackupTime.Unix()), 1))
|
Expect(expectedLastBackup).To(BeNumerically("~", float64(objectStore.Status.ServerRecoveryWindow[clusterName].LastSuccessfulBackupTime.Unix()), 1))
|
||||||
|
|
||||||
|
// Check that unset timestamps are 0
|
||||||
|
expectedLastFailedBackup, _ := metricsMap[lastFailedBackupTimestampMetricName]
|
||||||
|
Expect(expectedLastFailedBackup).To(BeZero())
|
||||||
|
|
||||||
|
expectedLastArchivedWAL, _ := metricsMap[lastArchivedWALTimestampMetricName]
|
||||||
|
Expect(expectedLastArchivedWAL).To(BeZero())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should return an error if the object store is not found", func() {
|
It("should return an error if the object store is not found", func() {
|
||||||
|
|||||||
@ -21,6 +21,7 @@ package instance
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"sync"
|
||||||
|
|
||||||
"github.com/cloudnative-pg/cnpg-i-machinery/pkg/pluginhelper/http"
|
"github.com/cloudnative-pg/cnpg-i-machinery/pkg/pluginhelper/http"
|
||||||
"github.com/cloudnative-pg/cnpg-i/pkg/backup"
|
"github.com/cloudnative-pg/cnpg-i/pkg/backup"
|
||||||
@ -47,11 +48,12 @@ type CNPGI struct {
|
|||||||
func (c *CNPGI) Start(ctx context.Context) error {
|
func (c *CNPGI) Start(ctx context.Context) error {
|
||||||
enrich := func(server *grpc.Server) error {
|
enrich := func(server *grpc.Server) error {
|
||||||
wal.RegisterWALServer(server, common.WALServiceImplementation{
|
wal.RegisterWALServer(server, common.WALServiceImplementation{
|
||||||
InstanceName: c.InstanceName,
|
InstanceName: c.InstanceName,
|
||||||
Client: c.Client,
|
Client: c.Client,
|
||||||
SpoolDirectory: c.SpoolDirectory,
|
SpoolDirectory: c.SpoolDirectory,
|
||||||
PGDataPath: c.PGDataPath,
|
PGDataPath: c.PGDataPath,
|
||||||
PGWALPath: c.PGWALPath,
|
PGWALPath: c.PGWALPath,
|
||||||
|
LastStatusUpdate: &sync.Map{},
|
||||||
})
|
})
|
||||||
backup.RegisterBackupServer(server, BackupServiceImplementation{
|
backup.RegisterBackupServer(server, BackupServiceImplementation{
|
||||||
Client: c.Client,
|
Client: c.Client,
|
||||||
|
|||||||
@ -22,6 +22,7 @@ package restore
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"path"
|
"path"
|
||||||
|
"sync"
|
||||||
|
|
||||||
"github.com/cloudnative-pg/cnpg-i-machinery/pkg/pluginhelper/http"
|
"github.com/cloudnative-pg/cnpg-i-machinery/pkg/pluginhelper/http"
|
||||||
restore "github.com/cloudnative-pg/cnpg-i/pkg/restore/job"
|
restore "github.com/cloudnative-pg/cnpg-i/pkg/restore/job"
|
||||||
@ -49,11 +50,12 @@ func (c *CNPGI) Start(ctx context.Context) error {
|
|||||||
|
|
||||||
enrich := func(server *grpc.Server) error {
|
enrich := func(server *grpc.Server) error {
|
||||||
wal.RegisterWALServer(server, common.WALServiceImplementation{
|
wal.RegisterWALServer(server, common.WALServiceImplementation{
|
||||||
InstanceName: c.InstanceName,
|
InstanceName: c.InstanceName,
|
||||||
Client: c.Client,
|
Client: c.Client,
|
||||||
SpoolDirectory: c.SpoolDirectory,
|
SpoolDirectory: c.SpoolDirectory,
|
||||||
PGDataPath: c.PGDataPath,
|
PGDataPath: c.PGDataPath,
|
||||||
PGWALPath: path.Join(c.PGDataPath, "pg_wal"),
|
PGWALPath: path.Join(c.PGDataPath, "pg_wal"),
|
||||||
|
LastStatusUpdate: &sync.Map{},
|
||||||
})
|
})
|
||||||
|
|
||||||
restore.RegisterRestoreJobHooksServer(server, &JobHookImpl{
|
restore.RegisterRestoreJobHooksServer(server, &JobHookImpl{
|
||||||
|
|||||||
1073
web/yarn.lock
1073
web/yarn.lock
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user