Skip to content

[release-1.21] fix: ServerSideApply field loss in certificate-shim and issuing controller - #9233

Closed
cert-manager-bot wants to merge 4 commits into
cert-manager:release-1.21from
cert-manager-bot:cherry-pick-8793-to-release-1.21
Closed

cert-manager-bot wants to merge 4 commits into
cert-manager:release-1.21from
cert-manager-bot:cherry-pick-8793-to-release-1.21

Conversation

@cert-manager-bot

Copy link
Copy Markdown
Contributor

This is an automated cherry-pick of #8793

/assign wallrj

Fix Server-Side Apply silently dropping Certificate spec fields (e.g. RevisionHistoryLimit) in the ingress-shim controller, and FailedIssuanceAttempts in the issuing controller.

- Send full CertificateSpec in SSA Apply() to prevent silent loss of spec fields
  not in the handpicked set (such as RevisionHistoryLimit)
- Strip ManagedFields in serializeApply (matching certificaterequests/apply.go),
  fixing API server rejection of SSA patches containing metadata.managedFields
- Replace test workaround with proper ManagedFields round-trip assertions

Signed-off-by: Yuedong Wu <[email protected]>
…ssuing

The SSA branch's updateOrApplyStatus was missing FailedIssuanceAttempts
from the ApplyStatus payload. The non-SSA UpdateStatus path set all Status
fields. The trigger controller reads FailedIssuanceAttempts to calculate
issuance retry backoff — without it, retry delays don't work.

Signed-off-by: Yuedong Wu <[email protected]>
Create with FieldManager records ownership as operation:Update.
Use Apply when ServerSideApply is enabled so create ownership
matches updates (operation:Apply). Add create/update Apply
payload tests.

Signed-off-by: Yuedong Wu <[email protected]>
Add issuing unit test that ApplyStatus includes the field on
failure and omits it on success, and an integration test that
scalar status fields clear by omission only when solely owned.

Signed-off-by: Yuedong Wu <[email protected]>
@cert-manager-prow cert-manager-prow Bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. area/testing Issues relating to testing labels Sep 1, 2026
@cert-manager-prow

Copy link
Copy Markdown
Contributor

[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 hjoshi123 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

@wallrj wallrj mentioned this pull request Sep 1, 2026
39 of 41 tasks
@wallrj

wallrj commented Sep 1, 2026

Copy link
Copy Markdown
Member

/kind bug

with claude fable-5

@cert-manager-prow cert-manager-prow Bot added kind/bug Categorizes issue or PR as related to a bug. and removed needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Sep 1, 2026
@wallrj

wallrj commented Sep 1, 2026

Copy link
Copy Markdown
Member

Closing this cherry-pick rather than merging it. A post-merge review of #8793 (review comments here) found two regressions that only manifest with the ServerSideApply feature gate enabled — the very configuration this fix targets — so backporting it to release-1.21 as-is would trade one gate-on bug for two worse ones:

  1. The new SSA create path in the certificate-shim applies extraAnnotations instead of crt.Annotations, dropping everything setIssuerSpecificConfig sets — including the http01-parent-ref-kind/-name annotations — so Gateway/ListenerSet HTTP01 issuance hangs. The default configuration (no --extra-certificate-annotations) is the broken case; the new tests only cover the non-default case, where map aliasing masks the bug.
  2. Replacing Create with a Force: true Apply removes the AlreadyExists safety net: a same-named user-owned Certificate not yet in the informer cache is silently adopted (controller ownerReference injected) and later deleted when the TLS entry is removed. That's a data-loss path we shouldn't introduce in a patch release.

There's also a migration gap that patch-release users would hit disproportionately: status fields written before the gate was enabled belong to an operation:Update field manager, so the new clear-by-omission of lastFailureTime/failedIssuanceAttempts never prunes them, leaving permanently inflated trigger backoff after enabling the gate on an existing install.

Plan: fix these on master first, then raise a fresh cherry-pick of #8793 plus the follow-ups as one batch, with a release note covering the behaviour change (a forced apply now reverts hand-edits to annotation-derived spec fields).

with claude fable-5

@wallrj wallrj closed this Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/testing Issues relating to testing dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. kind/bug Categorizes issue or PR as related to a bug. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

3 participants