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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- name: Install Dagger
env:
# renovate: datasource=github-tags depName=dagger/dagger versioning=semver
DAGGER_VERSION: 0.18.5
DAGGER_VERSION: 0.18.10
run: |
curl -L https://dl.dagger.io/dagger/install.sh | BIN_DIR=$HOME/.local/bin sh
- name: Run CI task
Expand Down
67 changes: 0 additions & 67 deletions .github/workflows/publish-docs.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Install Dagger
env:
# renovate: datasource=github-tags depName=dagger/dagger versioning=semver
DAGGER_VERSION: 0.18.5
DAGGER_VERSION: 0.18.10
run: |
curl -L https://dl.dagger.io/dagger/install.sh | BIN_DIR=$HOME/.local/bin sh
- name: Create image and manifest
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ on:
release:
types: [published]

permissions: read-all
permissions:
contents: read
packages: write

jobs:
release-publish-artifacts:
Expand All @@ -21,7 +23,7 @@ jobs:
- name: Install Dagger
env:
# renovate: datasource=github-tags depName=dagger/dagger versioning=semver
DAGGER_VERSION: 0.18.5
DAGGER_VERSION: 0.18.10
run: |
curl -L https://dl.dagger.io/dagger/install.sh | BIN_DIR=$HOME/.local/bin sh
- name: Create image and manifest
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ formatters:
sections:
- standard
- default
- prefix(github.com/cloudnative-pg/plugin-barman-cloud)
- prefix(github.com/edkadigital/plugin-barman-cloud)
- blank
- dot
exclusions:
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.5.0"
".": "0.6.0"
}
222 changes: 156 additions & 66 deletions CHANGELOG.md

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes

.PHONY: build
build: manifests generate fmt vet ## Build manager binary.
go build -o bin/manager cmd/main.go
go build -o bin/manager cmd/manager/main.go

.PHONY: run
run: manifests generate fmt vet ## Run a controller from your host.
go run ./cmd/main.go
go run ./cmd/manager/main.go

# If you wish to build the manager image targeting other platforms you can use the --platform flag.
# (i.e. docker build --platform linux/arm64). However, you must enable docker buildKit for it.
Expand Down Expand Up @@ -159,9 +159,9 @@ GOLANGCI_LINT = $(LOCALBIN)/golangci-lint

## Tool Versions
KUSTOMIZE_VERSION ?= v5.4.3
CONTROLLER_TOOLS_VERSION ?= v0.16.1
CONTROLLER_TOOLS_VERSION ?= v0.18.0
ENVTEST_VERSION ?= release-0.19
GOLANGCI_LINT_VERSION ?= v1.64.8
GOLANGCI_LINT_VERSION ?= v1.62.2

.PHONY: kustomize
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
Expand Down
4 changes: 2 additions & 2 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ domain: cnpg.io
layout:
- go.kubebuilder.io/v4
projectName: plugin-barman-cloud
repo: github.com/cloudnative-pg/plugin-barman-cloud
repo: github.com/edkadigital/plugin-barman-cloud
resources:
- api:
crdVersion: v1
Expand All @@ -15,6 +15,6 @@ resources:
domain: cnpg.io
group: barmancloud
kind: ObjectStore
path: github.com/cloudnative-pg/plugin-barman-cloud/api/v1
path: github.com/edkadigital/plugin-barman-cloud/api/v1
version: v1
version: "3"
4 changes: 2 additions & 2 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ tasks:
- start-build-network
vars:
# renovate: datasource=github-tags depName=dagger/dagger versioning=semver
DAGGER_VERSION: 0.18.5
DAGGER_VERSION: 0.18.10
DAGGER_ENGINE_IMAGE: registry.dagger.io/engine:v{{ .DAGGER_VERSION }}
cmds:
- >
Expand Down Expand Up @@ -402,7 +402,7 @@ tasks:
- controller-gen
desc: Generate the manifest for the main branch
vars:
GITHUB_REPOSITORY: cloudnative-pg/plugin-barman-cloud
GITHUB_REPOSITORY: edkadigital/plugin-barman-cloud
GITHUB_REF: main
GITHUB_REF_NAME: main
cmds:
Expand Down
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.

8 changes: 4 additions & 4 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
"github.com/spf13/cobra"
ctrl "sigs.k8s.io/controller-runtime"

"github.com/cloudnative-pg/plugin-barman-cloud/internal/cmd/healthcheck"
"github.com/cloudnative-pg/plugin-barman-cloud/internal/cmd/instance"
"github.com/cloudnative-pg/plugin-barman-cloud/internal/cmd/operator"
"github.com/cloudnative-pg/plugin-barman-cloud/internal/cmd/restore"
"github.com/edkadigital/plugin-barman-cloud/internal/cmd/healthcheck"
"github.com/edkadigital/plugin-barman-cloud/internal/cmd/instance"
"github.com/edkadigital/plugin-barman-cloud/internal/cmd/operator"
"github.com/edkadigital/plugin-barman-cloud/internal/cmd/restore"
)

func main() {
Expand Down
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/cloudnative-pg/plugin-barman-cloud
module github.com/edkadigital/plugin-barman-cloud

go 1.24.1

Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/healthcheck/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/health/grpc_health_v1"

"github.com/cloudnative-pg/plugin-barman-cloud/internal/cnpgi/metadata"
"github.com/edkadigital/plugin-barman-cloud/internal/cnpgi/metadata"
)

// NewCmd returns the healthcheck command
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/instance/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/viper"

"github.com/cloudnative-pg/plugin-barman-cloud/internal/cnpgi/instance"
"github.com/edkadigital/plugin-barman-cloud/internal/cnpgi/instance"
)

// NewCmd creates a new instance command
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/viper"

"github.com/cloudnative-pg/plugin-barman-cloud/internal/cnpgi/operator"
"github.com/edkadigital/plugin-barman-cloud/internal/cnpgi/operator"
)

// NewCmd creates a new operator command
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/restore/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/viper"

"github.com/cloudnative-pg/plugin-barman-cloud/internal/cnpgi/restore"
"github.com/edkadigital/plugin-barman-cloud/internal/cnpgi/restore"
)

// NewCmd creates the "restore" subcommand
Expand Down
2 changes: 1 addition & 1 deletion internal/cnpgi/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

barmanapi "github.com/cloudnative-pg/barman-cloud/pkg/api"

"github.com/cloudnative-pg/plugin-barman-cloud/internal/cnpgi/metadata"
"github.com/edkadigital/plugin-barman-cloud/internal/cnpgi/metadata"
)

// TODO: refactor.
Expand Down
40 changes: 37 additions & 3 deletions internal/cnpgi/common/wal.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ 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"

barmancloudv1 "github.com/cloudnative-pg/plugin-barman-cloud/api/v1"
"github.com/cloudnative-pg/plugin-barman-cloud/internal/cnpgi/metadata"
"github.com/cloudnative-pg/plugin-barman-cloud/internal/cnpgi/operator/config"
barmancloudv1 "github.com/edkadigital/plugin-barman-cloud/api/v1"
"github.com/edkadigital/plugin-barman-cloud/internal/cnpgi/metadata"
"github.com/edkadigital/plugin-barman-cloud/internal/cnpgi/operator/config"
)

// ErrMissingPermissions is raised when the sidecar has no
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)
}
6 changes: 3 additions & 3 deletions internal/cnpgi/instance/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"

barmancloudv1 "github.com/cloudnative-pg/plugin-barman-cloud/api/v1"
"github.com/cloudnative-pg/plugin-barman-cloud/internal/cnpgi/common"
"github.com/cloudnative-pg/plugin-barman-cloud/internal/cnpgi/operator/config"
barmancloudv1 "github.com/edkadigital/plugin-barman-cloud/api/v1"
"github.com/edkadigital/plugin-barman-cloud/internal/cnpgi/common"
"github.com/edkadigital/plugin-barman-cloud/internal/cnpgi/operator/config"
)

// BackupServiceImplementation is the implementation
Expand Down
2 changes: 1 addition & 1 deletion internal/cnpgi/instance/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/cloudnative-pg/cnpg-i/pkg/identity"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/cloudnative-pg/plugin-barman-cloud/internal/cnpgi/metadata"
"github.com/edkadigital/plugin-barman-cloud/internal/cnpgi/metadata"
)

// IdentityImplementation implements IdentityServer
Expand Down
2 changes: 1 addition & 1 deletion internal/cnpgi/instance/internal/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/fake"

v1 "github.com/cloudnative-pg/plugin-barman-cloud/api/v1"
v1 "github.com/edkadigital/plugin-barman-cloud/api/v1"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand Down
4 changes: 2 additions & 2 deletions internal/cnpgi/instance/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/scheme"

barmancloudv1 "github.com/cloudnative-pg/plugin-barman-cloud/api/v1"
extendedclient "github.com/cloudnative-pg/plugin-barman-cloud/internal/cnpgi/instance/internal/client"
barmancloudv1 "github.com/edkadigital/plugin-barman-cloud/api/v1"
extendedclient "github.com/edkadigital/plugin-barman-cloud/internal/cnpgi/instance/internal/client"
)

// Start starts the sidecar informers and CNPG-i server
Expand Down
Loading
Loading