You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Preserve deployment and template metadata 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:
- Deployment-level labels (was already the case) and annotations (new)
- Pod template labels and annotations (e.g., kubectl.kubernetes.io/restartedAt)
The fix uses kmeta.UnionMaps to merge desired state with existing state,
allowing external annotations/labels to take precedence while still
permitting Knative to manage its own metadata.
Changes:
- cruds.go: Added preservation of deployment and template-level metadata
- table_test.go: Added test case to verify external metadata preservation
0 commit comments