Skip to content

Conversation

@knative-prow-robot
Copy link
Contributor

This is an automated cherry-pick of #16199

Preserve deployment and template annotations and labels during reconcile

When running `kubectl rollout restart deployment`, Kubernetes adds the
`kubectl.kubernetes.io/restartedAt` annotation to the deployment's pod
template to trigger a rolling restart. However, Knative's reconciler was
removing this annotation by completely replacing the deployment spec,
causing new pods to be immediately terminated instead of completing the
rollout.

This change preserves externally-added metadata at both the deployment
level and template level during reconciliation by filtering Knative-controlled
keys (*.knative.dev and app label) from the current state before merging with
the desired state. This ensures Knative maintains full control over its own
metadata while preserving external additions.
@knative-prow knative-prow bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 12, 2025
@knative-prow knative-prow bot requested review from gauron99 and skonto December 12, 2025 12:44
@linkvt
Copy link
Contributor

linkvt commented Dec 12, 2025

As requested by a user in #16199 (comment)

@codecov
Copy link

codecov bot commented Dec 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.02%. Comparing base (2f3129a) to head (93c01b5).
⚠️ Report is 3 commits behind head on release-1.20.

Additional details and impacted files
@@               Coverage Diff                @@
##           release-1.20   #16303      +/-   ##
================================================
- Coverage         80.05%   80.02%   -0.04%     
================================================
  Files               214      214              
  Lines             13281    13289       +8     
================================================
+ Hits              10632    10634       +2     
- Misses             2291     2297       +6     
  Partials            358      358              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dprotaso
Copy link
Member

/hold

I'm holding a bunch of PRs for 1.20 release - waiting to get confirmation of a metric fix

@knative-prow knative-prow bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 12, 2025
@dprotaso
Copy link
Member

/hold cancel

@knative-prow knative-prow bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 16, 2025
@dprotaso
Copy link
Member

/lgtm
/approve

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Dec 17, 2025
@knative-prow
Copy link

knative-prow bot commented Dec 17, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dprotaso, knative-prow-robot

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

The pull request process is described 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

@knative-prow knative-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 17, 2025
@knative-prow knative-prow bot merged commit 576e775 into knative:release-1.20 Dec 17, 2025
92 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants