Conversation
A cluster bootstrapping from a Klio backup received a dedicated `klio-restore` sidecar that only advertised the restore and WAL capabilities, later swapped for `klio-plugin` by a rollout once the primary was elected. CloudNativePG dispatches a backup as soon as the instance is ready, which lands in that window: the plugin client rejects it with "plugin does not support Backup service". A replica cluster created together with an immediate ScheduledBackup hit this every time. Inject the same `klio-plugin` sidecar in every phase and give the `cnpgi instance` server the restore capability too. The restore hook and the WAL service already pick their repository per request from the cluster definition, so nothing needs swapping once recovery completes, and the pod spec no longer changes after bootstrap. The `cnpgi restore` command goes away; a `klio-restore` entry in `PluginConfiguration.spec.containers` is still accepted but ignored. The replica-cluster e2e now requests the backup right after creating the cluster, before its bootstrap completes. Closes #268 Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
The config watcher only hashed the file behind --config, which is the archive configuration once a cluster has one. The restore and WAL services read the recovery source and replica source configurations from sibling files in the same projected Secret mount, so a rotation of one of those Secrets went unnoticed until the next unrelated restart. Watch the whole mount directory instead. Every regular file is hashed together with its name, symlinks are followed so the kubelet layout of a projected volume is handled, and its internal directories are skipped. Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Nothing injects a `klio-restore` container any more: the `klio-plugin` sidecar serves the restore hooks as well. Keeping the name in the CRD only let a `PluginConfiguration` carry an entry the operator silently ignored. Accept `klio-plugin` alone in `spec.containers`, and document in the upgrade notes that a leftover `klio-restore` entry must be removed before upgrading. Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a cluster bootstraps from a Klio backup, the operator injected a
dedicated restore sidecar (
klio cnpgi restore) whose CNPG-I identity onlyadvertised the restore and WAL services. Once recovery completed, the
lifecycle hook swapped it for
klio-plugin, which also advertises backup.A backup requested in between, which is what happens with a replica cluster
and an immediate backup, was rejected by CNPG with
plugin does not support Backup service.Fix
One sidecar,
klio-plugin, serves every phase. It advertises restore,backup and WAL from the start, and each service already picks its
repository configuration per request from the cluster definition. The
operator now selects which configuration the sidecar is started with
(archive, recovery source, or replica source) instead of choosing a
different container. The bootstrap pod spec equals the steady-state spec,
so recovery no longer causes a rollout, and a backup arriving during
bootstrap is served.
Consequences:
klio cnpgi restoreis removed; nothing injects it any more.klio-restoreentry inPluginConfiguration.spec.containersis stillaccepted but ignored, and documented as deprecated.
klio-pluginis theonly container to customise.
A second commit makes the sidecar config watcher hash the whole config
mount rather than the file behind
--config, so a rotated recovery orreplica source Secret also restarts the sidecar.
Testing
watcher; the selection tests fail on
main.BackupFromReplicaClustere2e now requests the backup immediately aftercreating the replica cluster and asserts the bootstrapping pod is never
recreated. It fails deterministically on
mainand passes with thischange.
Closes #268