Repository navigation
feat(bootstrap): use an init container instead of a separate Job for new instances - #11319
Merged
mnencia merged 8 commits intoAug 27, 2026
Merged
Conversation
leonardoce
marked this pull request as ready for review
August 13, 2026 08:04
leonardoce
requested review from
a team,
NiccoloFei,
jsilvela and
litaocdl
as code owners
August 13, 2026 08:04
Contributor
|
❗ By default, the pull request is configured to backport to all release branches.
|
Contributor
Author
|
/test bp=pr-1025 l=kind |
Contributor
|
@leonardoce, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/31681054762 |
armru
approved these changes
Aug 13, 2026
leonardoce
force-pushed
the
remove-jobs-initcontainer
branch
from
August 17, 2026 08:51
cb78fa2 to
4987ac8
Compare
Contributor
Author
|
/test bp=pr-1025 l=kind |
Contributor
|
@leonardoce, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/32012769354 |
NiccoloFei
force-pushed
the
remove-jobs-initcontainer
branch
from
August 21, 2026 12:47
4987ac8 to
0e06aee
Compare
mnencia
force-pushed
the
remove-jobs-initcontainer
branch
2 times, most recently
from
August 25, 2026 17:35
632e3d9 to
51541be
Compare
mnencia
force-pushed
the
remove-jobs-initcontainer
branch
from
August 27, 2026 14:12
bd21929 to
a14c547
Compare
gabriele-wolfox
added a commit
to cloudnative-pg/klio
that referenced
this pull request
Aug 31, 2026
A recent CloudNativePG change (cloudnative-pg/cloudnative-pg#11319) moved instance bootstrap, including full and snapshot recovery, from a dedicated Job into an init container inside the instance pod. The lifecycle hook only injected the restore sidecar for recovery Jobs, so after that change the recovery pod ran the instance sidecar, which does not advertise the restore job hooks capability, and every plugin-based recovery failed with "no plugin supports the restore job hooks capability". Inject the restore sidecar from the Pod lifecycle hook while the cluster is performing its initial recovery bootstrap. The Job path is kept so recovery still works on CloudNativePG releases that bootstrap through a Job. Assisted-by: Claude Signed-off-by: Gabriele Quaresima <[email protected]>
gabriele-wolfox
added a commit
to cloudnative-pg/klio
that referenced
this pull request
Aug 31, 2026
A recent CloudNativePG change (cloudnative-pg/cloudnative-pg#11319) moved instance bootstrap, including full and snapshot recovery, from a dedicated Job into an init container inside the instance pod. The lifecycle hook only injected the restore sidecar for recovery Jobs, so after that change the recovery pod ran the instance sidecar, which does not advertise the restore job hooks capability, and every plugin-based recovery failed with "no plugin supports the restore job hooks capability". Inject the restore sidecar from the Pod lifecycle hook while the cluster is performing its initial recovery bootstrap. The Job path is kept so recovery still works on CloudNativePG releases that bootstrap through a Job. Assisted-by: Claude Signed-off-by: Gabriele Quaresima <[email protected]>
gabriele-wolfox
added a commit
to cloudnative-pg/klio
that referenced
this pull request
Aug 31, 2026
A recent CloudNativePG change (cloudnative-pg/cloudnative-pg#11319) moved instance bootstrap, including full and snapshot recovery, from a dedicated Job into an init container inside the instance pod. The lifecycle hook only injected the restore sidecar for recovery Jobs, so after that change the recovery pod ran the instance sidecar, which does not advertise the restore job hooks capability, and every plugin-based recovery failed with "no plugin supports the restore job hooks capability". Inject the restore sidecar from the Pod lifecycle hook while the cluster is performing its initial recovery bootstrap. The Job path is kept so recovery still works on CloudNativePG releases that bootstrap through a Job. Assisted-by: Claude Signed-off-by: Gabriele Quaresima <[email protected]>
gabriele-wolfox
added a commit
to cloudnative-pg/klio
that referenced
this pull request
Aug 31, 2026
A recent CloudNativePG change (cloudnative-pg/cloudnative-pg#11319) moved instance bootstrap, including full and snapshot recovery, from a dedicated Job into an init container inside the instance pod. The lifecycle hook only injected the restore sidecar for recovery Jobs, so after that change the recovery pod ran the instance sidecar, which does not advertise the restore job hooks capability, and every plugin-based recovery failed with "no plugin supports the restore job hooks capability". Inject the restore sidecar from the Pod lifecycle hook while the cluster is performing its initial recovery bootstrap. The Job path is kept so recovery still works on CloudNativePG releases that bootstrap through a Job. Assisted-by: Claude Signed-off-by: Gabriele Quaresima <[email protected]>
leonardoce
pushed a commit
to cloudnative-pg/klio
that referenced
this pull request
Sep 1, 2026
A recent CloudNativePG change (cloudnative-pg/cloudnative-pg#11319) moved instance bootstrap, including recovery, from a dedicated Job into an init container inside the instance pod. Klio only injected the restore sidecar for recovery Jobs, so the recovery pod ran the instance sidecar, which does not advertise the restore job hooks capability, and plugin-based recovery failed with `no plugin supports the restore job hooks capability`. Inject the restore sidecar from the Pod lifecycle hook during the initial recovery bootstrap. The Job path is retained for CloudNativePG releases that still bootstrap recovery through a Job. Closes #192 Signed-off-by: Gabriele Quaresima <[email protected]>
fcanovai
pushed a commit
to cloudnative-pg/klio
that referenced
this pull request
Sep 2, 2026
A recent CloudNativePG change (cloudnative-pg/cloudnative-pg#11319) moved instance bootstrap, including recovery, from a dedicated Job into an init container inside the instance pod. Klio only injected the restore sidecar for recovery Jobs, so the recovery pod ran the instance sidecar, which does not advertise the restore job hooks capability, and plugin-based recovery failed with `no plugin supports the restore job hooks capability`. Inject the restore sidecar from the Pod lifecycle hook during the initial recovery bootstrap. The Job path is retained for CloudNativePG releases that still bootstrap recovery through a Job. Closes #192 Signed-off-by: Gabriele Quaresima <[email protected]>
1 task
This was referenced Sep 7, 2026
litaocdl
pushed a commit
that referenced
this pull request
Sep 9, 2026
Since #11319, bootstrap runs in an init container. It can start before the operator writes Status.Certificates. When that happens, RefreshSecrets reads an empty secret name and fails right away with "resource name may not be empty". The container crashes, and only a restart can fix it, and even that does not always help. Now join and upgrade wait for Status.Certificates first, with no time limit. This also replaces their old WaitForGetCluster call, since the new wait already retries a failed Get too. The main container's own reconcile loop already retries forever on this same error before it starts PostgreSQL, so it needs no change. Closes #11446 Signed-off-by: Marco Nenciarini <[email protected]>
litaocdl
pushed a commit
that referenced
this pull request
Sep 9, 2026
…#11450) Since #11319, bootstrap runs in an init container. It can start before the operator writes Status.Certificates. When that happens, RefreshSecrets reads an empty secret name and fails right away with "resource name may not be empty". The container crashes, and only a restart can fix it, and even that does not always help. Now join and upgrade wait for cluster with Status.Certificates set first, with no time limit. This also replaces their old WaitForGetCluster call, since the new wait already retries a failed Get too. The main container's own reconcile loop already retries forever on this same error before it starts PostgreSQL, so it needs no change. Closes #11446 Signed-off-by: Marco Nenciarini <[email protected]> Signed-off-by: Armando Ruocco <[email protected]> Co-authored-by: Armando Ruocco <[email protected]>
cnpg-bot
pushed a commit
that referenced
this pull request
Sep 9, 2026
…#11450) Since #11319, bootstrap runs in an init container. It can start before the operator writes Status.Certificates. When that happens, RefreshSecrets reads an empty secret name and fails right away with "resource name may not be empty". The container crashes, and only a restart can fix it, and even that does not always help. Now join and upgrade wait for cluster with Status.Certificates set first, with no time limit. This also replaces their old WaitForGetCluster call, since the new wait already retries a failed Get too. The main container's own reconcile loop already retries forever on this same error before it starts PostgreSQL, so it needs no change. Closes #11446 Signed-off-by: Marco Nenciarini <[email protected]> Signed-off-by: Armando Ruocco <[email protected]> Co-authored-by: Armando Ruocco <[email protected]> (cherry picked from commit 7dd2f3b)
cnpg-bot
pushed a commit
that referenced
this pull request
Sep 9, 2026
…#11450) Since #11319, bootstrap runs in an init container. It can start before the operator writes Status.Certificates. When that happens, RefreshSecrets reads an empty secret name and fails right away with "resource name may not be empty". The container crashes, and only a restart can fix it, and even that does not always help. Now join and upgrade wait for cluster with Status.Certificates set first, with no time limit. This also replaces their old WaitForGetCluster call, since the new wait already retries a failed Get too. The main container's own reconcile loop already retries forever on this same error before it starts PostgreSQL, so it needs no change. Closes #11446 Signed-off-by: Marco Nenciarini <[email protected]> Signed-off-by: Armando Ruocco <[email protected]> Co-authored-by: Armando Ruocco <[email protected]> (cherry picked from commit 7dd2f3b)
mnencia
added a commit
that referenced
this pull request
Sep 9, 2026
…#11450) Since #11319, bootstrap runs in an init container. It can start before the operator writes Status.Certificates. When that happens, RefreshSecrets reads an empty secret name and fails right away with "resource name may not be empty". The container crashes, and only a restart can fix it, and even that does not always help. Now join and upgrade wait for cluster with Status.Certificates set first, with no time limit. This also replaces their old WaitForGetCluster call, since the new wait already retries a failed Get too. The main container's own reconcile loop already retries forever on this same error before it starts PostgreSQL, so it needs no change. Closes #11446 Signed-off-by: Marco Nenciarini <[email protected]> Signed-off-by: Armando Ruocco <[email protected]> Co-authored-by: Armando Ruocco <[email protected]> (cherry picked from commit 7dd2f3b)
This was referenced Sep 25, 2026
1 task
4 tasks done
2 tasks done
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.
New primary and replica instances are now bootstrapped (initdb, recovery, pg_basebackup, join, and snapshot restore) directly on the instance Pod via an init container, instead of running a separate Kubernetes Job beforehand. This removes the extra Job resource previously created for every new instance, along with its own Pod, and the wait for that Job to complete before the actual instance Pod could start.
A stuck bootstrap surfaces as PhaseUnrecoverable on the Cluster status, and a replica resuming a stalled bootstrap reports PhaseCreatingReplica with an Event.
Closes: #11228
Original PR description
New primary and replica instances are now bootstrapped (initdb, recovery,
pg_basebackup, join, and snapshot restore) directly on the instance Pod via
an init container, instead of running a separate Kubernetes Job beforehand.
This removes the extra Job resource previously created for every new
instance, along with its own Pod, and the wait for that Job to complete
before the actual instance Pod could start.
Important
This is an alternative approach for #11231 that is less invasive on the codebase.
It requires #11315 to be merged too.