mirror of
https://github.com/cloudnative-pg/plugin-barman-cloud.git
synced 2026-09-06 15:02:21 +02:00
Compare commits
3 Commits
bb475ffedf
...
8d0fa8a94f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d0fa8a94f | ||
|
|
9967e2caab | ||
|
|
eefb45ca5a |
12
CODEOWNERS
12
CODEOWNERS
@ -1,5 +1,9 @@
|
||||
# The CODEOWNERS file is used to define individuals or teams that are
|
||||
# responsible for code in a repository. For details, please refer to
|
||||
# https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/about-code-owners
|
||||
# This file is generated from componentowners-policy.yaml in
|
||||
# cloudnative-pg/cnpg-infra — do not hand-edit, propose changes there instead.
|
||||
#
|
||||
# Path-scoped rules below always include the repo's own general owners
|
||||
# (the "*" line) in addition to their own specific teams/users, since
|
||||
# CODEOWNERS only honors the LAST matching pattern for a given path —
|
||||
# it does not merge an earlier, less-specific rule into a later one.
|
||||
|
||||
* @leonardoce @mnencia @gbartolini @fcanovai @armru @NiccoloFei
|
||||
* @cloudnative-pg/plugin-barman-cloud-owners
|
||||
|
||||
@ -33,7 +33,8 @@ import (
|
||||
)
|
||||
|
||||
// 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(
|
||||
ctx context.Context,
|
||||
c client.Client,
|
||||
@ -41,6 +42,14 @@ func updateRecoveryWindow(
|
||||
objectStore *barmancloudv1.ObjectStore,
|
||||
serverName string,
|
||||
) error {
|
||||
objectStoreKey := client.ObjectKeyFromObject(objectStore)
|
||||
|
||||
return retry.RetryOnConflict(retry.DefaultBackoff, func() error {
|
||||
var freshObjectStore barmancloudv1.ObjectStore
|
||||
if err := c.Get(ctx, objectStoreKey, &freshObjectStore); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Set the recovery window inside the barman object store object
|
||||
convertTime := func(t *time.Time) *metav1.Time {
|
||||
if t == nil {
|
||||
@ -49,16 +58,17 @@ func updateRecoveryWindow(
|
||||
return ptr.To(metav1.NewTime(*t))
|
||||
}
|
||||
|
||||
recoveryWindow := objectStore.Status.ServerRecoveryWindow[serverName]
|
||||
recoveryWindow := freshObjectStore.Status.ServerRecoveryWindow[serverName]
|
||||
recoveryWindow.FirstRecoverabilityPoint = convertTime(backupList.GetFirstRecoverabilityPoint())
|
||||
recoveryWindow.LastSuccessfulBackupTime = convertTime(backupList.GetLastSuccessfulBackupTime())
|
||||
|
||||
if objectStore.Status.ServerRecoveryWindow == nil {
|
||||
objectStore.Status.ServerRecoveryWindow = make(map[string]barmancloudv1.RecoveryWindow)
|
||||
if freshObjectStore.Status.ServerRecoveryWindow == nil {
|
||||
freshObjectStore.Status.ServerRecoveryWindow = make(map[string]barmancloudv1.RecoveryWindow)
|
||||
}
|
||||
objectStore.Status.ServerRecoveryWindow[serverName] = recoveryWindow
|
||||
freshObjectStore.Status.ServerRecoveryWindow[serverName] = recoveryWindow
|
||||
|
||||
return c.Status().Update(ctx, objectStore)
|
||||
return c.Status().Update(ctx, &freshObjectStore)
|
||||
})
|
||||
}
|
||||
|
||||
// setLastFailedBackupTime sets the last failed backup time in the
|
||||
|
||||
Loading…
Reference in New Issue
Block a user