Set kubectl.kubernetes.io/restartedAt annotation on workload redeploy - #18496
Merged
Conversation
Contributor
|
🔄 Auto-Retry Failed Run The Tests workflow run Follow up on the retried run here if needed: https://github.com/rancher/dashboard/actions/runs/30123230857 |
marcelofukumoto
marked this pull request as ready for review
July 28, 2026 21:46
codyrancher
approved these changes
Jul 29, 2026
codyrancher
left a comment
Member
There was a problem hiding this comment.
Verified that this change adds the appropriate annotation
This applies for all resources, not just prometheus which I think it fine since it's a well known annotation. https://kubernetes.io/docs/reference/labels-annotations-taints/#kubectl-k8s-io-restart-at
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.
Summary
Fixes #16445
Occurred changes and/or fixed issues
When redeploying a Prometheus-managed StatefulSet, only some pods were restarted.
The dashboard set only the
cattle.io/timestampannotation to trigger a rollingupdate, but the Prometheus operator does not recognize this annotation and reverts
it before the rollout completes.
This PR additionally sets the standard
kubectl.kubernetes.io/restartedAtannotationon the pod template during redeploy. The Prometheus operator recognizes and preserves
this annotation, so the rolling update completes successfully for all pods.
Technical notes summary
KUBECTL_RESTARTED_ATconstant (kubectl.kubernetes.io/restartedAt) toshell/config/labels-annotations.js.RedeployWorkloadDialog.vueto set bothcattle.io/timestampandkubectl.kubernetes.io/restartedAtin the pod template annotations whenredeploying. See
shell/dialog/RedeployWorkloadDialog.vue.metadata initialization, multi-workload redeploy, and error handling.
Areas or cases that should be tested
Areas which could experience regressions
Screenshot/Video
Before (Ready 1/2, only one pod restarted):
After (Ready 2/2, both pods restarted successfully):
Checklist
Admin,Standard UserandUser Base