Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 0 additions & 67 deletions .github/workflows/publish-docs.yml

This file was deleted.

6 changes: 6 additions & 0 deletions api/v1/objectstore_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ type RecoveryWindow struct {

// The last successful backup time
LastSuccessfulBackupTime *metav1.Time `json:"lastSuccussfulBackupTime,omitempty"`

// The timestamp of the first WAL file successfully submitted to the object store
FirstWALSubmissionTime *metav1.Time `json:"firstWALSubmissionTime,omitempty"`

// The timestamp of the last WAL file successfully submitted to the object store
LastWALSubmissionTime *metav1.Time `json:"lastWALSubmissionTime,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
8 changes: 8 additions & 0 deletions api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions config/crd/bases/barmancloud.cnpg.io_objectstores.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -609,10 +609,20 @@ spec:
restored.
format: date-time
type: string
firstWALSubmissionTime:
description: The timestamp of the first WAL file successfully
submitted to the object store
format: date-time
type: string
lastSuccussfulBackupTime:
description: The last successful backup time
format: date-time
type: string
lastWALSubmissionTime:
description: The timestamp of the last WAL file successfully
submitted to the object store
format: date-time
type: string
type: object
description: ServerRecoveryWindow maps each server to its recovery
window
Expand Down
6 changes: 3 additions & 3 deletions containers/sidecar-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -545,9 +545,9 @@ python-snappy==0.7.3 \
--hash=sha256:074c0636cfcd97e7251330f428064050ac81a52c62ed884fc2ddebbb60ed7f50 \
--hash=sha256:40216c1badfb2d38ac781ecb162a1d0ec40f8ee9747e610bcfefdfa79486cee3
# via barman
requests==2.32.3 \
--hash=sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760 \
--hash=sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6
requests==2.32.4 \
--hash=sha256:27babd3cda2a6d50b30443204ee89830707d396671944c998b5975b031ac2b2c \
--hash=sha256:27d0316682c8a29834d3264820024b62a36942083d52caf2f14c0591336d3422
# via
# azure-core
# google-api-core
Expand Down
34 changes: 34 additions & 0 deletions internal/cnpgi/common/wal.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
walUtils "github.com/cloudnative-pg/machinery/pkg/fileutils/wals"
"github.com/cloudnative-pg/machinery/pkg/log"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/client"

Expand Down Expand Up @@ -184,6 +185,12 @@ func (w WALServiceImplementation) Archive(
}
}

// Update WAL submission timing in ObjectStore status after successful archiving
if err := w.updateWALSubmissionTime(ctx, &objectStore, configuration.ServerName); err != nil {
contextLogger.Error(err, "failed to update WAL submission time in ObjectStore status")
// Don't fail the archiving operation for status update errors
}

return &wal.WALArchiveResult{}, nil
}

Expand Down Expand Up @@ -469,3 +476,30 @@ func isEndOfWALStream(results []barmanRestorer.Result) bool {

return false
}

// updateWALSubmissionTime updates the WAL submission timing in the ObjectStore status
func (w WALServiceImplementation) updateWALSubmissionTime(
ctx context.Context,
objectStore *barmancloudv1.ObjectStore,
serverName string,
) error {
now := metav1.NewTime(time.Now())

if objectStore.Status.ServerRecoveryWindow == nil {
objectStore.Status.ServerRecoveryWindow = make(map[string]barmancloudv1.RecoveryWindow)
}

recoveryWindow := objectStore.Status.ServerRecoveryWindow[serverName]

// Set first WAL submission time if not already set
if recoveryWindow.FirstWALSubmissionTime == nil {
recoveryWindow.FirstWALSubmissionTime = &now
}

// Always update last WAL submission time
recoveryWindow.LastWALSubmissionTime = &now

objectStore.Status.ServerRecoveryWindow[serverName] = recoveryWindow

return w.Client.Status().Update(ctx, objectStore)
}
13 changes: 10 additions & 3 deletions internal/cnpgi/instance/retention.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,21 @@ func (c *CatalogMaintenanceRunnable) updateRecoveryWindow(
return ptr.To(metav1.NewTime(*t))
}

if objectStore.Status.ServerRecoveryWindow == nil {
objectStore.Status.ServerRecoveryWindow = make(map[string]barmancloudv1.RecoveryWindow)
}

// get existing recovery window to preserve WAL submission timing
existingWindow := objectStore.Status.ServerRecoveryWindow[serverName]

recoveryWindow := barmancloudv1.RecoveryWindow{
FirstRecoverabilityPoint: convertTime(backupList.GetFirstRecoverabilityPoint()),
LastSuccessfulBackupTime: convertTime(backupList.GetLastSuccessfulBackupTime()),
// preserve existing WAL submission timing
FirstWALSubmissionTime: existingWindow.FirstWALSubmissionTime,
LastWALSubmissionTime: existingWindow.LastWALSubmissionTime,
}

if objectStore.Status.ServerRecoveryWindow == nil {
objectStore.Status.ServerRecoveryWindow = make(map[string]barmancloudv1.RecoveryWindow)
}
objectStore.Status.ServerRecoveryWindow[serverName] = recoveryWindow

return c.Client.Status().Update(ctx, objectStore)
Expand Down
4 changes: 2 additions & 2 deletions kubernetes/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ resources:
- ../config/rbac
images:
- name: plugin-barman-cloud
newName: ghcr.io/cloudnative-pg/plugin-barman-cloud-testing
newName: ghcr.io/edkadigital/plugin-barman-cloud-testing
newTag: main
secretGenerator:
- literals:
- SIDECAR_IMAGE=ghcr.io/cloudnative-pg/plugin-barman-cloud-sidecar-testing:main
- SIDECAR_IMAGE=ghcr.io/edkadigital/plugin-barman-cloud-sidecar-testing:main
name: plugin-barman-cloud
12 changes: 11 additions & 1 deletion manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -608,10 +608,20 @@ spec:
restored.
format: date-time
type: string
firstWALSubmissionTime:
description: The timestamp of the first WAL file successfully
submitted to the object store
format: date-time
type: string
lastSuccussfulBackupTime:
description: The last successful backup time
format: date-time
type: string
lastWALSubmissionTime:
description: The timestamp of the last WAL file successfully
submitted to the object store
format: date-time
type: string
type: object
description: ServerRecoveryWindow maps each server to its recovery
window
Expand Down Expand Up @@ -927,7 +937,7 @@ spec:
secretKeyRef:
key: SIDECAR_IMAGE
name: plugin-barman-cloud-8tfddg42gf
image: ghcr.io/cloudnative-pg/plugin-barman-cloud-testing:main
image: ghcr.io/edkadigital/plugin-barman-cloud-testing:main
name: barman-cloud
ports:
- containerPort: 9090
Expand Down
4 changes: 2 additions & 2 deletions web/docs/images.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The Barman Cloud Plugin is distributed using two container images:

The plugin image contains the logic required to operate the Barman Cloud Plugin
within your Kubernetes environment with CloudNativePG. It is published on the
GitHub Container Registry at `ghcr.io/cloudnative-pg/plugin-barman-cloud`.
GitHub Container Registry at `ghcr.io/edkadigital/plugin-barman-cloud`.

This image is built from the
[`Dockerfile.plugin`](https://github.com/cloudnative-pg/plugin-barman-cloud/blob/main/containers/Dockerfile.plugin)
Expand All @@ -28,7 +28,7 @@ The sidecar image is used within each PostgreSQL pod in the cluster. It
includes the latest supported version of Barman Cloud and is responsible for
performing WAL archiving and backups on behalf of CloudNativePG.

It is available at `ghcr.io/cloudnative-pg/plugin-barman-cloud-sidecar` and is
It is available at `ghcr.io/edkadigital/plugin-barman-cloud-sidecar` and is
built from the
[`Dockerfile.sidecar`](https://github.com/cloudnative-pg/plugin-barman-cloud/blob/main/containers/Dockerfile.sidecar).

Expand Down
4 changes: 2 additions & 2 deletions web/versioned_docs/version-0.4.0/images.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The Barman Cloud Plugin is distributed using two container images:

The plugin image contains the logic required to operate the Barman Cloud Plugin
within your Kubernetes environment with CloudNativePG. It is published on the
GitHub Container Registry at `ghcr.io/cloudnative-pg/plugin-barman-cloud`.
GitHub Container Registry at `ghcr.io/edkadigital/plugin-barman-cloud`.

This image is built from the
[`Dockerfile.plugin`](https://github.com/cloudnative-pg/plugin-barman-cloud/blob/main/containers/Dockerfile.plugin)
Expand All @@ -28,7 +28,7 @@ The sidecar image is used within each PostgreSQL pod in the cluster. It
includes the latest supported version of Barman Cloud and is responsible for
performing WAL archiving and backups on behalf of CloudNativePG.

It is available at `ghcr.io/cloudnative-pg/plugin-barman-cloud-sidecar` and is
It is available at `ghcr.io/edkadigital/plugin-barman-cloud-sidecar` and is
built from the
[`Dockerfile.sidecar`](https://github.com/cloudnative-pg/plugin-barman-cloud/blob/main/containers/Dockerfile.sidecar).

Expand Down
4 changes: 2 additions & 2 deletions web/versioned_docs/version-0.4.1/images.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The Barman Cloud Plugin is distributed using two container images:

The plugin image contains the logic required to operate the Barman Cloud Plugin
within your Kubernetes environment with CloudNativePG. It is published on the
GitHub Container Registry at `ghcr.io/cloudnative-pg/plugin-barman-cloud`.
GitHub Container Registry at `ghcr.io/edkadigital/plugin-barman-cloud`.

This image is built from the
[`Dockerfile.plugin`](https://github.com/cloudnative-pg/plugin-barman-cloud/blob/main/containers/Dockerfile.plugin)
Expand All @@ -28,7 +28,7 @@ The sidecar image is used within each PostgreSQL pod in the cluster. It
includes the latest supported version of Barman Cloud and is responsible for
performing WAL archiving and backups on behalf of CloudNativePG.

It is available at `ghcr.io/cloudnative-pg/plugin-barman-cloud-sidecar` and is
It is available at `ghcr.io/edkadigital/plugin-barman-cloud-sidecar` and is
built from the
[`Dockerfile.sidecar`](https://github.com/cloudnative-pg/plugin-barman-cloud/blob/main/containers/Dockerfile.sidecar).

Expand Down
4 changes: 2 additions & 2 deletions web/versioned_docs/version-0.5.0/images.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The Barman Cloud Plugin is distributed using two container images:

The plugin image contains the logic required to operate the Barman Cloud Plugin
within your Kubernetes environment with CloudNativePG. It is published on the
GitHub Container Registry at `ghcr.io/cloudnative-pg/plugin-barman-cloud`.
GitHub Container Registry at `ghcr.io/edkadigital/plugin-barman-cloud`.

This image is built from the
[`Dockerfile.plugin`](https://github.com/cloudnative-pg/plugin-barman-cloud/blob/main/containers/Dockerfile.plugin)
Expand All @@ -28,7 +28,7 @@ The sidecar image is used within each PostgreSQL pod in the cluster. It
includes the latest supported version of Barman Cloud and is responsible for
performing WAL archiving and backups on behalf of CloudNativePG.

It is available at `ghcr.io/cloudnative-pg/plugin-barman-cloud-sidecar` and is
It is available at `ghcr.io/edkadigital/plugin-barman-cloud-sidecar` and is
built from the
[`Dockerfile.sidecar`](https://github.com/cloudnative-pg/plugin-barman-cloud/blob/main/containers/Dockerfile.sidecar).

Expand Down
Loading