mirror of
https://github.com/cloudnative-pg/plugin-barman-cloud.git
synced 2026-09-06 15:02:21 +02:00
Merge 19a4121869 into b0f4feb04a
This commit is contained in:
commit
802fc2580c
2
go.mod
2
go.mod
@ -7,7 +7,7 @@ require (
|
||||
github.com/cloudnative-pg/api v1.30.0
|
||||
github.com/cloudnative-pg/barman-cloud v0.5.2-0.20260709152604-43158c204df1
|
||||
github.com/cloudnative-pg/cloudnative-pg v1.30.0
|
||||
github.com/cloudnative-pg/cnpg-i v0.5.0
|
||||
github.com/cloudnative-pg/cnpg-i v0.5.1-0.20260716144117-db806aee0db1
|
||||
github.com/cloudnative-pg/cnpg-i-machinery v0.4.2
|
||||
github.com/cloudnative-pg/machinery v0.5.0
|
||||
github.com/onsi/ginkgo/v2 v2.32.0
|
||||
|
||||
2
go.sum
2
go.sum
@ -26,6 +26,8 @@ github.com/cloudnative-pg/cloudnative-pg v1.30.0 h1:fnhVq44xXx97MNiuvJsPrX1vSjYb
|
||||
github.com/cloudnative-pg/cloudnative-pg v1.30.0/go.mod h1:QkolwBOWZ+GvAiJt6KpDSymwkpf0K19/p4Q6MQlTM8U=
|
||||
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.1-0.20260716144117-db806aee0db1 h1:HO7S6jJ21DhSS6oQg7Ok1+uT23hF6I58im1IIRMPufk=
|
||||
github.com/cloudnative-pg/cnpg-i v0.5.1-0.20260716144117-db806aee0db1/go.mod h1:4kcpLAj+feMTnh0TVadXRASdVnEhBytNSm/BvktLgmI=
|
||||
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/machinery v0.5.0 h1:hhTnkzn+AiN3NmbjCQ6RXj5rfqV3K6arzq6kdXAzcnQ=
|
||||
|
||||
@ -155,13 +155,23 @@ func (w WALServiceImplementation) Archive(
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Step 2: Check if the archive location is safe to perform archiving
|
||||
// Step 2: Check if the archive location is safe to perform archiving.
|
||||
// The operator owns the marker file's lifecycle, so a non-nil decision
|
||||
// already accounts for it and is obeyed as-is. A nil value means an
|
||||
// operator that predates this field; fall back to checking the marker
|
||||
// file and Cluster annotation directly.
|
||||
var checkEmptyWalArchive bool
|
||||
if request.CheckEmptyWalArchive != nil {
|
||||
checkEmptyWalArchive = *request.CheckEmptyWalArchive
|
||||
} else {
|
||||
checkFileExisting, err := fileutils.FileExists(emptyWalArchiveFile)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("while checking for empty wal archive check file %q: %w", emptyWalArchiveFile, err)
|
||||
}
|
||||
checkEmptyWalArchive = utils.IsEmptyWalArchiveCheckEnabled(&configuration.Cluster.ObjectMeta) && checkFileExisting
|
||||
}
|
||||
|
||||
if utils.IsEmptyWalArchiveCheckEnabled(&configuration.Cluster.ObjectMeta) && checkFileExisting {
|
||||
if checkEmptyWalArchive {
|
||||
if err := CheckBackupDestination(
|
||||
ctx,
|
||||
&objectStore.Spec.Configuration,
|
||||
|
||||
@ -113,6 +113,7 @@ func (impl JobHookImpl) Restore(
|
||||
configuration.Cluster,
|
||||
&targetObjectStore.Spec.Configuration,
|
||||
targetObjectStore.Name,
|
||||
req.CheckEmptyWalArchive,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -250,6 +251,7 @@ func (impl *JobHookImpl) checkBackupDestination(
|
||||
cluster *cnpgv1.Cluster,
|
||||
barmanConfiguration *cnpgv1.BarmanObjectStoreConfiguration,
|
||||
objectStoreName string,
|
||||
operatorCheckEmptyWalArchive *bool,
|
||||
) error {
|
||||
// Get environment from cache
|
||||
env, err := barmanCredentials.EnvSetCloudCredentialsAndCertificates(ctx,
|
||||
@ -288,8 +290,18 @@ func (impl *JobHookImpl) checkBackupDestination(
|
||||
}
|
||||
}
|
||||
|
||||
// Check if we're ok to archive in the desired destination
|
||||
if utils.IsEmptyWalArchiveCheckEnabled(&cluster.ObjectMeta) {
|
||||
// Check if we're ok to restore from the desired destination. Unlike
|
||||
// archiving, restore is a one-shot operation that has never been gated
|
||||
// on the first-archive marker file, so the only fallback needed here
|
||||
// (for an operator that predates this field) is the Cluster annotation.
|
||||
var checkEmptyWalArchive bool
|
||||
if operatorCheckEmptyWalArchive != nil {
|
||||
checkEmptyWalArchive = *operatorCheckEmptyWalArchive
|
||||
} else {
|
||||
checkEmptyWalArchive = utils.IsEmptyWalArchiveCheckEnabled(&cluster.ObjectMeta)
|
||||
}
|
||||
|
||||
if checkEmptyWalArchive {
|
||||
return common.CheckBackupDestination(ctx, barmanConfiguration, walArchiver, serverName)
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user