Compare commits

..

8 Commits

Author SHA1 Message Date
Armando Ruocco
cece4181b3
Merge 2518deff63 into b0e4538147 2026-07-09 11:00:34 +02:00
Marco Nenciarini
2518deff63 test: tighten WAL restore assertions and fix a misleading comment
Assert the actual exit code on the end-of-wal-stream fast-fail path
instead of just HaveOccurred(), which would pass for any error. Also
correct a comment claiming ExecuteInContainer folds command output
into the returned error; it only carries the exit code, so forging a
WAL segment fails with no indication of the underlying aws CLI error.
Drop an unnecessary var declaration and note the real bound on the
forged segment numbering.

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
2026-07-09 11:00:33 +02:00
Marco Nenciarini
9b2097f2b6 test: pin aws-cli image by digest
Every other e2e fixture pins its image by digest with a companion
Version comment; the s3-client image was the only one still pinned by
a mutable tag.

Note this doesn't yet restore renovate parity with those fixtures:
renovate.json5's ignorePaths still excludes anything under
test/e2e/internal/tests/**, which is where every Ginkgo test package in
this suite (including this one) lives, so the digest won't be bumped
automatically until that gap is closed separately. The digest pin is
still worth having on its own for reproducibility.

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
2026-07-09 11:00:33 +02:00
Niccolò Fei
d2a87965cf test: remove redundant primary/standby picking logic
If pod-1 is not the primary we'd fail anyway because a timeline
bump would make all assertions about the walLogDir fail.
Also there's no reason why there should have been a switchover,
so we should not hide a failure if that happens.

Signed-off-by: Niccolò Fei <niccolo.fei@enterprisedb.com>
2026-07-09 11:00:33 +02:00
Niccolò Fei
aeb0aa169c chore: bump aws-cli to 2.35.11
Signed-off-by: Niccolò Fei <niccolo.fei@enterprisedb.com>
2026-07-09 11:00:33 +02:00
Armando Ruocco
41238d7df5 test(e2e): cover parallel WAL restore via the plugin
Recreate the parallel WAL-restore coverage in the plugin repo: a 2-instance
cluster archiving to minio with wal.maxParallel=3, forged WAL segments on the
object store, and assertions on the plugin's prefetch/spool/end-of-wal-stream
state machine driven through `/controller/manager wal-restore` on the standby.

Part of cloudnative-pg/cloudnative-pg#10954.

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
2026-07-09 11:00:33 +02:00
Marco Nenciarini
b0e4538147
chore(renovate): stop ignoring test/e2e/internal/tests/** (#996)
ignorePaths still had '**/tests/**' left over from the recommended
preset, even though a comment right above documents removing
'**/test/**' specifically to let renovate scan test/e2e for emulator
image dependencies. Every e2e Ginkgo package lives under
test/e2e/internal/tests/**, so the plural pattern was silently excluding
all of them; any image pinned by digest in those packages (e.g. minio,
aws-cli) was never going to get a bump PR.

No other tracked path in the repo matches '**/tests/**' once
node_modules is excluded by its own rule, so this narrows nothing else.

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
2026-07-09 11:00:04 +02:00
Niccolò Fei
bf955430cb
fix: reduce startupProbe periodSeconds without losing failure tolerance (#992)
The startup probe for the injected plugin-barman-cloud sidecar
previously left `periodSeconds` unset, so the API server defaulted it to
10s. Because the sidecar is a native init container that gates the main
postgres container on reaching `Started`, this added roughly one full
period to every pod's startup, even though the probe itself (a local
unix-socket health check) normally succeeds in milliseconds.

`periodSeconds` is now 1s, so the probe reports success almost
immediately in the common case. To avoid trading away failure tolerance
for that faster common case, `failureThreshold` is raised to 30 and
`timeoutSeconds` is lowered to 5s: a unix-socket call essentially never
times out under mere load, so hitting the timeout means the sidecar is
genuinely unresponsive rather than just slow, and it's fine to give that
rare case more attempts before restarting the container.

Closes #991

Signed-off-by: Niccolò Fei <niccolo.fei@enterprisedb.com>
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Co-authored-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
2026-07-09 10:36:09 +02:00
4 changed files with 19 additions and 13 deletions

View File

@ -403,8 +403,9 @@ func reconcilePodSpec(
envs = append(envs, config.env...) envs = append(envs, config.env...)
baseProbe := &corev1.Probe{ baseProbe := &corev1.Probe{
FailureThreshold: 10, PeriodSeconds: 1,
TimeoutSeconds: 10, FailureThreshold: 30,
TimeoutSeconds: 5,
ProbeHandler: corev1.ProbeHandler{ ProbeHandler: corev1.ProbeHandler{
Exec: &corev1.ExecAction{ Exec: &corev1.ExecAction{
Command: []string{"/manager", "healthcheck", "unix"}, Command: []string{"/manager", "healthcheck", "unix"},

View File

@ -12,14 +12,14 @@
rebaseWhen: 'never', rebaseWhen: 'never',
prConcurrentLimit: 5, prConcurrentLimit: 5,
// Override default ignorePaths to scan test/e2e for emulator image dependencies // Override default ignorePaths to scan test/e2e for emulator image dependencies
// Removed: '**/test/**' // Removed: '**/test/**', '**/tests/**' (this repo's e2e Ginkgo packages live
// under test/e2e/internal/tests/**, which the plural pattern was excluding)
ignorePaths: [ ignorePaths: [
'**/node_modules/**', '**/node_modules/**',
'**/bower_components/**', '**/bower_components/**',
'**/vendor/**', '**/vendor/**',
'**/examples/**', '**/examples/**',
'**/__tests__/**', '**/__tests__/**',
'**/tests/**',
'**/__fixtures__/**', '**/__fixtures__/**',
], ],
lockFileMaintenance: { lockFileMaintenance: {

View File

@ -121,7 +121,8 @@ func newS3ClientDeployment(namespace string) *appsv1.Deployment {
{ {
Name: s3ClientName, Name: s3ClientName,
// renovate: datasource=docker depName=amazon/aws-cli versioning=docker // renovate: datasource=docker depName=amazon/aws-cli versioning=docker
Image: "docker.io/amazon/aws-cli:2.35.11", // Version: 2.35.11
Image: "docker.io/amazon/aws-cli@sha256:749bfaf91d690b9a1768083822d620f96c19defdf9ca2dc227eb3695281fda5b",
Command: []string{"sleep", "infinity"}, Command: []string{"sleep", "infinity"},
Env: []corev1.EnvVar{ Env: []corev1.EnvVar{
{ {

View File

@ -21,6 +21,7 @@ package walrestore
import ( import (
"context" "context"
"errors"
"fmt" "fmt"
"strconv" "strconv"
"strings" "strings"
@ -30,6 +31,7 @@ import (
apitypes "k8s.io/apimachinery/pkg/types" apitypes "k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest" "k8s.io/client-go/rest"
executil "k8s.io/client-go/util/exec"
"sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client"
internalClient "github.com/cloudnative-pg/plugin-barman-cloud/test/e2e/internal/client" internalClient "github.com/cloudnative-pg/plugin-barman-cloud/test/e2e/internal/client"
@ -67,9 +69,8 @@ const (
) )
// walFile returns the name of the n-th forged WAL segment (segment 0xF0+n on // walFile returns the name of the n-th forged WAL segment (segment 0xF0+n on
// timeline 1, log 0). The high segment number keeps it out of the range an idle // timeline 1, log 0, for n <= 15). The high segment number keeps it out of the
// PostgreSQL would archive on its own. Hex formatting keeps the name a valid // range an idle PostgreSQL would archive on its own.
// 24-character segment for any small n.
func walFile(n int) string { func walFile(n int) string {
return fmt.Sprintf("0000000100000000%08X", 0xF0+n) return fmt.Sprintf("0000000100000000%08X", 0xF0+n)
} }
@ -199,8 +200,8 @@ var _ = Describe("Parallel WAL restore", func() {
"sh", "-c", "rm -f "+spoolDirectory+"/* 2>/dev/null; true") "sh", "-c", "rm -f "+spoolDirectory+"/* 2>/dev/null; true")
} }
forge := func(src, dst string) { forge := func(src, dst string) {
// ExecuteInContainer folds a non-zero exit (and its output) into the // ExecuteInContainer drops stdout/stderr on a non-zero exit, so on
// returned error, so we surface that rather than the empty stderr. // failure this only reports the exit code, not the aws CLI's error text.
_, _, err := execInPod(ctx, clientSet, cfg, ns, s3Client, s3ClientName, _, _, err := execInPod(ctx, clientSet, cfg, ns, s3Client, s3ClientName,
"aws", "s3", "cp", walObjectURI(src), walObjectURI(dst)) "aws", "s3", "cp", walObjectURI(src), walObjectURI(dst))
Expect(err).NotTo(HaveOccurred(), "forging %s -> %s", src, dst) Expect(err).NotTo(HaveOccurred(), "forging %s -> %s", src, dst)
@ -211,7 +212,6 @@ var _ = Describe("Parallel WAL restore", func() {
return err == nil && strings.TrimSpace(out) != "" return err == nil && strings.TrimSpace(out) != ""
} }
var latestWAL string
By("archiving a real WAL on the primary and learning its name") By("archiving a real WAL on the primary and learning its name")
_, _, err := execInPod(ctx, clientSet, cfg, ns, primary, postgresContainer, _, _, err := execInPod(ctx, clientSet, cfg, ns, primary, postgresContainer,
"psql", "-tAc", "CHECKPOINT") "psql", "-tAc", "CHECKPOINT")
@ -219,7 +219,7 @@ var _ = Describe("Parallel WAL restore", func() {
out, _, err := execInPod(ctx, clientSet, cfg, ns, primary, postgresContainer, out, _, err := execInPod(ctx, clientSet, cfg, ns, primary, postgresContainer,
"psql", "-tAc", "SELECT pg_walfile_name(pg_switch_wal())") "psql", "-tAc", "SELECT pg_walfile_name(pg_switch_wal())")
Expect(err).NotTo(HaveOccurred(), "switching WAL on the primary failed") Expect(err).NotTo(HaveOccurred(), "switching WAL on the primary failed")
latestWAL = strings.TrimSpace(out) latestWAL := strings.TrimSpace(out)
Expect(latestWAL).To(HavePrefix(walLogDir), Expect(latestWAL).To(HavePrefix(walLogDir),
"the freshly bootstrapped cluster should still be on the first WAL log") "the freshly bootstrapped cluster should still be on the first WAL log")
@ -288,7 +288,11 @@ var _ = Describe("Parallel WAL restore", func() {
// #6 (first): flag is set, so the request fails fast (exit 1) and the // #6 (first): flag is set, so the request fails fast (exit 1) and the
// flag is consumed, leaving an empty spool. // flag is consumed, leaving an empty spool.
By("requesting WAL #6: fails fast on the end-of-wal-stream flag, spool cleared") By("requesting WAL #6: fails fast on the end-of-wal-stream flag, spool cleared")
Expect(restore(walFile(6))).To(HaveOccurred(), "exit code should be 1") restoreErr := restore(walFile(6))
var exitErr executil.CodeExitError
Expect(errors.As(restoreErr, &exitErr)).To(BeTrue(),
"expected a CodeExitError, got %T: %v", restoreErr, restoreErr)
Expect(exitErr.ExitStatus()).To(Equal(1), "exit code should be 1")
Eventually(func(g Gomega) { Eventually(func(g Gomega) {
g.Expect(existsIn(pgWalPath, walFile(6))).To(BeFalse(), "#6 not restored") g.Expect(existsIn(pgWalPath, walFile(6))).To(BeFalse(), "#6 not restored")
g.Expect(spoolSegments()).To(Equal(0), "no WAL segments in spool") g.Expect(spoolSegments()).To(Equal(0), "no WAL segments in spool")