Skip to content

Commit 304f9de

Browse files
authored
Merge branch 'main' into dev/pprof
2 parents 585814e + 6997039 commit 304f9de

30 files changed

+2454
-33
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.6.0"
2+
".": "0.7.0"
33
}

.wordlist.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ DigitalOcean
1313
Docusaurus
1414
EDB
1515
EKS
16+
Enum
1617
EnvVar
1718
GCP
1819
GKE

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
# Changelog
22

3+
## [0.7.0](https://github.com/cloudnative-pg/plugin-barman-cloud/compare/v0.6.0...v0.7.0) (2025-09-25)
4+
5+
6+
### Features
7+
8+
* Introduce `logLevel` setting to control verbosity ([#536](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/536)) ([0501e18](https://github.com/cloudnative-pg/plugin-barman-cloud/commit/0501e185bab4969064c5b92977747be30bd38e95))
9+
* Return proper gRPC error codes for expected conditions ([#549](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/549)) ([08c3f1c](https://github.com/cloudnative-pg/plugin-barman-cloud/commit/08c3f1c2324d79d6080fbf73f11b4fa715bec4cb))
10+
* **spec:** Add support for additional sidecar container arguments ([#520](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/520)) ([ec352ac](https://github.com/cloudnative-pg/plugin-barman-cloud/commit/ec352ac0fdd31656321e564bcf6a026481ec06e4))
11+
12+
13+
### Bug Fixes
14+
15+
* Avoid panicking if serverRecoveryWindow has still not been set ([#525](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/525)) ([dfd9861](https://github.com/cloudnative-pg/plugin-barman-cloud/commit/dfd9861a3f9296bffe084a81faa8755ddca95149)), closes [#523](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/523)
16+
* **deps:** Lock file maintenance documentation dependencies ([#534](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/534)) ([0ad066d](https://github.com/cloudnative-pg/plugin-barman-cloud/commit/0ad066d195b8556d9cf13ac0b585bfa6ffe01b75))
17+
* **deps:** Update all non-major go dependencies ([#521](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/521)) ([df92fa6](https://github.com/cloudnative-pg/plugin-barman-cloud/commit/df92fa6f3e9bfd934da4be2aba4983570f751fad))
18+
* **deps:** Update kubernetes packages to v0.34.1 ([#530](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/530)) ([eced5ea](https://github.com/cloudnative-pg/plugin-barman-cloud/commit/eced5ea2c6d44ec3fc09b632b42c204a5d469297))
19+
* **deps:** Update module github.com/cloudnative-pg/cnpg-i-machinery to v0.4.1 ([#551](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/551)) ([65a0d11](https://github.com/cloudnative-pg/plugin-barman-cloud/commit/65a0d11ec8cf1fc6e3478d49ad88d9ba9c40adf6))
20+
* **deps:** Update module github.com/onsi/ginkgo/v2 to v2.25.1 ([#495](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/495)) ([2dc29a5](https://github.com/cloudnative-pg/plugin-barman-cloud/commit/2dc29a5dbcc4e4a5b79cc2c796d2a451ffcd654a))
21+
* **deps:** Update module sigs.k8s.io/controller-runtime to v0.22.1 ([#531](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/531)) ([82449d9](https://github.com/cloudnative-pg/plugin-barman-cloud/commit/82449d9351555e3b8ee128f040bffd9799279e72))
22+
* **logs:** Log the correct name when on ObjectStore not found error ([#540](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/540)) ([a29aa1c](https://github.com/cloudnative-pg/plugin-barman-cloud/commit/a29aa1c91af0bc7cb4a7511c49dcc461900e9a13)), closes [#539](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/539)
23+
* **object-cache:** Improve reliability of object cache management ([#508](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/508)) ([8c3db95](https://github.com/cloudnative-pg/plugin-barman-cloud/commit/8c3db955efc2d23593faa0c6e410e7aa0e427ebf)), closes [#502](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/502)
24+
* Typo in variable name ([#515](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/515)) ([3c0d8c3](https://github.com/cloudnative-pg/plugin-barman-cloud/commit/3c0d8c3a3394d5b628d03c849be86999b2e7887f))
25+
326
## [0.6.0](https://github.com/cloudnative-pg/plugin-barman-cloud/compare/v0.5.0...v0.6.0) (2025-08-21)
427

528

api/v1/objectstore_types.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,15 @@ type InstanceSidecarConfiguration struct {
4141
// AdditionalContainerArgs is an optional list of command-line arguments
4242
// to be passed to the sidecar container when it starts.
4343
// The provided arguments are appended to the container’s default arguments.
44+
// +kubebuilder:validation:XValidation:rule="!self.exists(a, a.startsWith('--log-level'))",reason="FieldValueForbidden",message="do not set --log-level in additionalContainerArgs; use spec.instanceSidecarConfiguration.logLevel"
4445
// +optional
4546
AdditionalContainerArgs []string `json:"additionalContainerArgs,omitempty"`
47+
48+
// The log level for PostgreSQL instances. Valid values are: `error`, `warning`, `info` (default), `debug`, `trace`
49+
// +kubebuilder:default:=info
50+
// +kubebuilder:validation:Enum:=error;warning;info;debug;trace
51+
// +optional
52+
LogLevel string `json:"logLevel,omitempty"`
4653
}
4754

4855
// ObjectStoreSpec defines the desired state of ObjectStore.

config/crd/bases/barmancloud.cnpg.io_objectstores.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,11 @@ spec:
399399
items:
400400
type: string
401401
type: array
402+
x-kubernetes-validations:
403+
- message: do not set --log-level in additionalContainerArgs;
404+
use spec.instanceSidecarConfiguration.logLevel
405+
reason: FieldValueForbidden
406+
rule: '!self.exists(a, a.startsWith(''--log-level''))'
402407
env:
403408
description: The environment to be explicitly passed to the sidecar
404409
items:
@@ -557,6 +562,17 @@ spec:
557562
- name
558563
type: object
559564
type: array
565+
logLevel:
566+
default: info
567+
description: 'The log level for PostgreSQL instances. Valid values
568+
are: `error`, `warning`, `info` (default), `debug`, `trace`'
569+
enum:
570+
- error
571+
- warning
572+
- info
573+
- debug
574+
- trace
575+
type: string
560576
resources:
561577
description: Resources define cpu/memory requests and limits for
562578
the sidecar that runs in the instance pods.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/cloudnative-pg/barman-cloud v0.3.3
99
github.com/cloudnative-pg/cloudnative-pg v1.27.0
1010
github.com/cloudnative-pg/cnpg-i v0.3.0
11-
github.com/cloudnative-pg/cnpg-i-machinery v0.4.0
11+
github.com/cloudnative-pg/cnpg-i-machinery v0.4.1
1212
github.com/cloudnative-pg/machinery v0.3.1
1313
github.com/onsi/ginkgo/v2 v2.25.3
1414
github.com/onsi/gomega v1.38.2

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ github.com/cloudnative-pg/cloudnative-pg v1.27.0 h1:mp0zlYO4vKAJmQdArWORWKr1lmB4
2424
github.com/cloudnative-pg/cloudnative-pg v1.27.0/go.mod h1:aIVMy0BrfXg+eJuA/ZyRGyOQtPtshw/sCzQnQn3KFUo=
2525
github.com/cloudnative-pg/cnpg-i v0.3.0 h1:5ayNOG5x68lU70IVbHDZQrv5p+bErCJ0mqRmOpW2jjE=
2626
github.com/cloudnative-pg/cnpg-i v0.3.0/go.mod h1:VOIWWXcJ1RyioK+elR2DGOa4cBA6K+6UQgx05aZmH+g=
27-
github.com/cloudnative-pg/cnpg-i-machinery v0.4.0 h1:16wQt9qFFqvyxeg+9dPt8ic8dh3PRPq0jCGXVuZyjO4=
28-
github.com/cloudnative-pg/cnpg-i-machinery v0.4.0/go.mod h1:4MCJzbCOsB7ianxlm8rqD+gDpkgVTHoTuglle/i72WA=
27+
github.com/cloudnative-pg/cnpg-i-machinery v0.4.1 h1:M4ELhZO0e7UjiV3PZ3uGJOz3SgG/3ThWiqkbrFCcXNE=
28+
github.com/cloudnative-pg/cnpg-i-machinery v0.4.1/go.mod h1:TxwoMgQINOJkS1kepudqCBTYd8QYev6JoT8R52pYD4E=
2929
github.com/cloudnative-pg/machinery v0.3.1 h1:KtPA6EwELTUNisCMLiFYkK83GU9606rkGQhDJGPB8Yw=
3030
github.com/cloudnative-pg/machinery v0.3.1/go.mod h1:jebuqKxZAbrRKDEEpVCIDMKW+FbWtB9Kf/hb2kMUu9o=
3131
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=

hack/examples/minio-store.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ metadata:
55
spec:
66
retentionPolicy: "1m"
77
instanceSidecarConfiguration:
8+
logLevel: "debug"
89
retentionPolicyIntervalSeconds: 1800
910
resources:
1011
requests:
@@ -13,8 +14,6 @@ spec:
1314
limits:
1415
memory: "512Mi"
1516
cpu: "500m"
16-
additionalContainerArgs:
17-
- --log-level=debug
1817
configuration:
1918
endpointCA:
2019
name: minio-server-tls

internal/cnpgi/common/errors.go

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
11
package common
22

3-
// walNotFoundError is raised when a WAL file has not been found in the object store
4-
type walNotFoundError struct{}
3+
import (
4+
"google.golang.org/grpc/codes"
5+
"google.golang.org/grpc/status"
6+
)
57

6-
func newWALNotFoundError() *walNotFoundError { return &walNotFoundError{} }
8+
// ErrEndOfWALStreamReached is returned when end of WAL is detected in the cloud archive.
9+
var ErrEndOfWALStreamReached = status.Errorf(codes.OutOfRange, "end of WAL reached")
710

8-
// ShouldPrintStackTrace tells whether the sidecar log stream should contain the stack trace
9-
func (e walNotFoundError) ShouldPrintStackTrace() bool {
10-
return false
11-
}
11+
// ErrMissingPermissions is raised when the sidecar has no
12+
// permission to download the credentials needed to reach
13+
// the object storage.
14+
// This will be fixed by the reconciliation loop in the
15+
// operator plugin.
16+
var ErrMissingPermissions = status.Errorf(codes.FailedPrecondition,
17+
"no permission to download the backup credentials, retrying")
1218

13-
// Error implements the error interface
14-
func (e walNotFoundError) Error() string {
15-
return "WAL file not found"
19+
// newWALNotFoundError returns a error that states that a
20+
// certain WAL file has not been found. This error is
21+
// compatible with GRPC status codes, resulting in a 404
22+
// being used as a response code.
23+
func newWALNotFoundError(walName string) error {
24+
return status.Errorf(codes.NotFound, "wal %q not found", walName)
1625
}

internal/cnpgi/common/wal.go

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@ import (
2727
"github.com/cloudnative-pg/plugin-barman-cloud/internal/cnpgi/operator/config"
2828
)
2929

30-
// ErrMissingPermissions is raised when the sidecar has no
31-
// permission to download the credentials needed to reach
32-
// the object storage.
33-
// This will be fixed by the reconciliation loop in the
34-
// operator plugin.
35-
var ErrMissingPermissions = fmt.Errorf("no permission to download the backup credentials, retrying")
36-
3730
// SpoolManagementError is raised when a spool management
3831
// error has been detected
3932
type SpoolManagementError struct {
@@ -95,11 +88,14 @@ func (w WALServiceImplementation) Archive(
9588
ctx context.Context,
9689
request *wal.WALArchiveRequest,
9790
) (*wal.WALArchiveResult, error) {
98-
contextLogger := log.FromContext(ctx)
99-
contextLogger.Debug("starting wal archive")
100-
10191
baseWalName := path.Base(request.GetSourceFileName())
10292

93+
contextLogger := log.FromContext(ctx)
94+
contextLogger.Debug("wal archive start", "walName", baseWalName)
95+
defer func() {
96+
contextLogger.Debug("wal archive end", "walName", baseWalName)
97+
}()
98+
10399
// Step 1: parse the configuration and get the environment variables needed
104100
// for barman-cloud-wal-archive
105101
configuration, err := config.NewFromClusterJSON(request.ClusterDefinition)
@@ -122,6 +118,7 @@ func (w WALServiceImplementation) Archive(
122118
)
123119
if err != nil {
124120
if apierrors.IsForbidden(err) {
121+
contextLogger.Info(ErrMissingPermissions.Error())
125122
return nil, ErrMissingPermissions
126123
}
127124
return nil, err
@@ -350,7 +347,7 @@ func (w WALServiceImplementation) restoreFromBarmanObjectStore(
350347
// The failure has already been logged in walRestorer.RestoreList method
351348
if walStatus[0].Err != nil {
352349
if errors.Is(walStatus[0].Err, barmanRestorer.ErrWALNotFound) {
353-
return newWALNotFoundError()
350+
return newWALNotFoundError(walStatus[0].WalName)
354351
}
355352

356353
return walStatus[0].Err
@@ -457,9 +454,6 @@ func gatherWALFilesToRestore(walName string, parallel int) (walList []string, er
457454
return walList, err
458455
}
459456

460-
// ErrEndOfWALStreamReached is returned when end of WAL is detected in the cloud archive.
461-
var ErrEndOfWALStreamReached = errors.New("end of WAL reached")
462-
463457
// checkEndOfWALStreamFlag returns ErrEndOfWALStreamReached if the flag is set in the restorer.
464458
func checkEndOfWALStreamFlag(walRestorer *barmanRestorer.WALRestorer) error {
465459
contain, err := walRestorer.IsEndOfWALStream()

0 commit comments

Comments
 (0)