mirror of
https://github.com/cloudnative-pg/plugin-barman-cloud.git
synced 2026-09-06 15:02:21 +02:00
Compare commits
4 Commits
0644f6921b
...
03487cfd29
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03487cfd29 | ||
|
|
a95197e648 | ||
|
|
ad5311efa5 | ||
|
|
eefb45ca5a |
@ -23,7 +23,7 @@ tasks:
|
|||||||
# 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: ff27cd50f6b4eed2e3753c520632cd6099e1ce52
|
DAGGER_GOLANGCI_LINT_SHA: ff27cd50f6b4eed2e3753c520632cd6099e1ce52
|
||||||
# renovate: datasource=docker depName=golangci/golangci-lint versioning=semver
|
# renovate: datasource=docker depName=golangci/golangci-lint versioning=semver
|
||||||
GOLANGCI_LINT_VERSION: v2.13.1
|
GOLANGCI_LINT_VERSION: v2.13.2
|
||||||
cmds:
|
cmds:
|
||||||
- >
|
- >
|
||||||
GITHUB_REF= dagger -sc "github.com/sagikazarmark/daggerverse/golangci-lint@${DAGGER_GOLANGCI_LINT_SHA}
|
GITHUB_REF= dagger -sc "github.com/sagikazarmark/daggerverse/golangci-lint@${DAGGER_GOLANGCI_LINT_SHA}
|
||||||
|
|||||||
@ -33,7 +33,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// updateRecoveryWindow updates the recovery window inside the object
|
// updateRecoveryWindow updates the recovery window inside the object
|
||||||
// store status subresource
|
// store status subresource. It uses retry logic to handle concurrent
|
||||||
|
// updates from backup completion and retention policy enforcement.
|
||||||
func updateRecoveryWindow(
|
func updateRecoveryWindow(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
c client.Client,
|
c client.Client,
|
||||||
@ -41,24 +42,33 @@ func updateRecoveryWindow(
|
|||||||
objectStore *barmancloudv1.ObjectStore,
|
objectStore *barmancloudv1.ObjectStore,
|
||||||
serverName string,
|
serverName string,
|
||||||
) error {
|
) error {
|
||||||
// Set the recovery window inside the barman object store object
|
objectStoreKey := client.ObjectKeyFromObject(objectStore)
|
||||||
convertTime := func(t *time.Time) *metav1.Time {
|
|
||||||
if t == nil {
|
return retry.RetryOnConflict(retry.DefaultBackoff, func() error {
|
||||||
return nil
|
var freshObjectStore barmancloudv1.ObjectStore
|
||||||
|
if err := c.Get(ctx, objectStoreKey, &freshObjectStore); err != nil {
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
return ptr.To(metav1.NewTime(*t))
|
|
||||||
}
|
|
||||||
|
|
||||||
recoveryWindow := objectStore.Status.ServerRecoveryWindow[serverName]
|
// Set the recovery window inside the barman object store object
|
||||||
recoveryWindow.FirstRecoverabilityPoint = convertTime(backupList.GetFirstRecoverabilityPoint())
|
convertTime := func(t *time.Time) *metav1.Time {
|
||||||
recoveryWindow.LastSuccessfulBackupTime = convertTime(backupList.GetLastSuccessfulBackupTime())
|
if t == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return ptr.To(metav1.NewTime(*t))
|
||||||
|
}
|
||||||
|
|
||||||
if objectStore.Status.ServerRecoveryWindow == nil {
|
recoveryWindow := freshObjectStore.Status.ServerRecoveryWindow[serverName]
|
||||||
objectStore.Status.ServerRecoveryWindow = make(map[string]barmancloudv1.RecoveryWindow)
|
recoveryWindow.FirstRecoverabilityPoint = convertTime(backupList.GetFirstRecoverabilityPoint())
|
||||||
}
|
recoveryWindow.LastSuccessfulBackupTime = convertTime(backupList.GetLastSuccessfulBackupTime())
|
||||||
objectStore.Status.ServerRecoveryWindow[serverName] = recoveryWindow
|
|
||||||
|
|
||||||
return c.Status().Update(ctx, objectStore)
|
if freshObjectStore.Status.ServerRecoveryWindow == nil {
|
||||||
|
freshObjectStore.Status.ServerRecoveryWindow = make(map[string]barmancloudv1.RecoveryWindow)
|
||||||
|
}
|
||||||
|
freshObjectStore.Status.ServerRecoveryWindow[serverName] = recoveryWindow
|
||||||
|
|
||||||
|
return c.Status().Update(ctx, &freshObjectStore)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// setLastFailedBackupTime sets the last failed backup time in the
|
// setLastFailedBackupTime sets the last failed backup time in the
|
||||||
|
|||||||
@ -35,7 +35,7 @@ object storage system. It allows you to configure:
|
|||||||
- **Base backup options**—with similar settings for compression, concurrency,
|
- **Base backup options**—with similar settings for compression, concurrency,
|
||||||
and encryption—under `.spec.configuration.data`
|
and encryption—under `.spec.configuration.data`
|
||||||
- **Retention policies** to manage the life-cycle of archived WALs and backups
|
- **Retention policies** to manage the life-cycle of archived WALs and backups
|
||||||
via `.spec.configuration.retentionPolicy`
|
via `.spec.retentionPolicy`
|
||||||
|
|
||||||
WAL files are archived in the `wals` directory, while base backups are stored
|
WAL files are archived in the `wals` directory, while base backups are stored
|
||||||
as **tarballs** in the `base` directory, following the
|
as **tarballs** in the `base` directory, following the
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user