Skip to content

Make preservation annotations node-owned - #1188

Open
gagan16k wants to merge 16 commits into
gardener:masterfrom
gagan16k:simplify-annotations
Open

gagan16k wants to merge 16 commits into
gardener:masterfrom
gagan16k:simplify-annotations

Conversation

@gagan16k

@gagan16k gagan16k commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Change node.machine.sapcloud.io/preserve annotation behaviour

Following design changes in following the design in #1171, the node is now the single source of truth for the preserve annotation.

  • When a machine has a backing node, is annotated and the node has no annotation:
    • the machine's preserve value is copied onto the node
    • the annotation is then removed from the machine.
  • When no node exists, the annotation on the machine drives preservation.
  • When both exist and have different annotations, the node's annotation is considered.

Removal of the preserve annotation is now a no-op: to stop preservation a user must set preserve=false explicitly.
Other changes as part of this:

  • As part of this, the node.machine.sapcloud.io/last-applied-node-preserve-value annotation is also dropped entirely, as it is no longer needed.
  • Integration test for the previous annotation removal path also not necessary.

PreservationAction enum + determinePreservationAction

This PR extracts preservation decision logic into a pure function determinePreservationAction() returning one of four values: None, Preserve, StopKeepAnnotation, StopRemoveAnnotation. manageMachinePreservation() now dispatches on these set of states.
Based on comment by @elankath.


MachineSet controller solely responsible for PreserveExpiryTime-expiry deletions

With the PR, the machine controller returns PreservationActionNone for Failed+expired machines, leaving the machineSet controller as the sole actor responsible for their deletion.
This also prevents the re-preservation loop: previously, the MachineController removed the annotation and PET, but the machineSet wouldn't delete the machine yet, it would see a Failed machine with no annotation+no PET and potentially re-preserve it.


stopAutoPreservationForMachines deletes via terminateMachines

Now stopAutoPreservationForMachines calls terminateMachines() after removing the annotation, so unpreserved machines are immediately queued for deletion.
This is so that when the autoPreserveFailedMachineMax is reduced and excess auto-preserved machines need to be unpreserved, they do not stay preserved until their PET expires.


Some other smaller changes:

  • DeferCleanup() removed from IT, as it races with AfterAll() MCD deletion - run
  • Error aggregation in manageAutoPreservationOfFailedMachines() and stopAutoPreservationForMachines()
  • Extracted setFailedState() helper
  • Documentation changes

Which issue(s) this PR fixes:
Fixes #1171

Release note:

The `node.machine.sapcloud.io/preserve` annotation is now owned by the node once a backing node exists. Removing the annotation no longer stops preservation; set `node.machine.sapcloud.io/preserve=false` to stop it explicitly.

…erveValue annotation

Signed-off-by: Gagan163264 <gagan.surathkal@gmail.com>
Signed-off-by: Gagan163264 <gagan.surathkal@gmail.com>
@gagan16k
gagan16k requested a review from a team as a code owner November 12, 2026 08:37
@gardener-prow

gardener-prow Bot commented Nov 12, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign r4mek for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@gardener-prow gardener-prow Bot added do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 12, 2026
Signed-off-by: Gagan163264 <gagan.surathkal@gmail.com>
@gagan16k
gagan16k marked this pull request as draft November 12, 2026 10:11
@gardener-prow gardener-prow Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 12, 2026
Signed-off-by: Gagan163264 <gagan.surathkal@gmail.com>
…nnotations

Signed-off-by: Gagan163264 <gagan.surathkal@gmail.com>
Signed-off-by: Gagan163264 <gagan.surathkal@gmail.com>
Signed-off-by: Gagan163264 <gagan.surathkal@gmail.com>
@gardener-prow gardener-prow Bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 13, 2026
Signed-off-by: Gagan163264 <gagan.surathkal@gmail.com>
Signed-off-by: Gagan163264 <gagan.surathkal@gmail.com>
…eservation

Signed-off-by: Gagan163264 <gagan.surathkal@gmail.com>
Signed-off-by: Gagan163264 <gagan.surathkal@gmail.com>
Signed-off-by: Gagan163264 <gagan.surathkal@gmail.com>
Signed-off-by: Gagan163264 <gagan.surathkal@gmail.com>
Signed-off-by: Gagan163264 <gagan.surathkal@gmail.com>
Signed-off-by: Gagan163264 <gagan.surathkal@gmail.com>
Signed-off-by: Gagan163264 <gagan.surathkal@gmail.com>
@gagan16k
gagan16k marked this pull request as ready for review November 14, 2026 05:55
@gardener-prow gardener-prow Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 14, 2026
@gagan16k

Copy link
Copy Markdown
Member Author

/kind bug

@gardener-prow gardener-prow Bot added kind/bug Bug and removed do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Bug size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto-preservation to not preserve a Machine for which PreserveExpiryTime is breached

1 participant