Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support inplace-update restart count #1097

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

diannaowa
Copy link
Contributor

Ⅰ. Describe what this PR does

Add inPlaceUpdate restart count to annotation.
the result is shown below:
Annotations:

apps.kruise.io/inplace-update-containers-restart-count: '{"nginx":{"revision":"sample-d97f89dcf","restartCount":1,"timestamp":"2022-03-24T08:03:23Z"},"sidecar":{"revision":"sample-d97f89dcf","restartCount":1,"timestamp":"2022-03-24T08:03:23Z"}}'
apps.kruise.io/inplace-update-pod-restart-count: "2"

apps.kruise.io/inplace-update-pod-restart-count: The Pod restart count.
apps.kruise.io/inplace-update-containers-restart-count: Every container restart count of the pod.
(revision: the revision of the container updated.)

The revision and timestamp maybe is different between the containers when we just update one(or a part of containers in the pod) container of the pod.Because we just update the restart count of the container when it will be updated(inplace-update).

Ⅱ. Does this pull request fix one issue?

fixes #910

Ⅲ. Describe how to verify it

Ⅳ. Special notes for reviews

@kruise-bot kruise-bot added the size/L size/L: 100-499 label Oct 7, 2022
@codecov-commenter
Copy link

codecov-commenter commented Oct 7, 2022

Codecov Report

Attention: Patch coverage is 53.19149% with 22 lines in your changes missing coverage. Please review.

Project coverage is 49.31%. Comparing base (209d476) to head (67b3c7c).
Report is 65 commits behind head on master.

Current head 67b3c7c differs from pull request most recent head bc70823

Please upload reports for the commit bc70823 to get more accurate results.

Files Patch % Lines
pkg/util/inplaceupdate/inplace_update.go 53.19% 16 Missing and 6 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1097      +/-   ##
==========================================
+ Coverage   47.82%   49.31%   +1.49%     
==========================================
  Files         161      137      -24     
  Lines       23395    19334    -4061     
==========================================
- Hits        11188     9535    -1653     
+ Misses      10993     8743    -2250     
+ Partials     1214     1056     -158     
Flag Coverage Δ
unittests 49.31% <53.19%> (+1.49%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@furykerry furykerry requested a review from zmberg October 18, 2022 02:56
@FillZpp
Copy link
Member

FillZpp commented Oct 24, 2022

@diannaowa How about a discussion on the community meeting this Thursday? You can add this topic into the agenda https://shimo.im/docs/gXqmeQOYBehZ4vqo

@zmberg
Copy link
Member

zmberg commented Jan 5, 2023

#910

@zmberg zmberg removed this from the v1.4 milestone Feb 14, 2023
@zmberg zmberg self-assigned this Feb 14, 2023
@zmberg zmberg added this to the v1.5 milestone Jun 8, 2023
@zmberg zmberg modified the milestones: v1.5, 1.6, 1.7 Mar 7, 2024
@kruise-bot
Copy link

[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 ask for approval from zmberg by writing /assign @zmberg in a comment. For more information see:The Kubernetes Code Review Process.

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

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

Signed-off-by: Liu Zhenwei <[email protected]>
Signed-off-by: liuzhenwei <[email protected]>
Signed-off-by: Liu Zhenwei <[email protected]>
Signed-off-by: liuzhenwei <[email protected]>
Signed-off-by: Liu Zhenwei <[email protected]>
Signed-off-by: liuzhenwei <[email protected]>
Signed-off-by: liuzhenwei <[email protected]>
}

containers := make(map[string]bool)
if spec.ContainerImages != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This if judgment can be removed, just keep the for statement below

}
}

if spec.UpdateEnvFromMetadata {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as above

if clone, err = opts.PatchSpecToPod(clone, &spec, &updateState); err != nil {
return err
}
// record restart count of the pod(containers)
recordPodAndContainersRestartCount(clone, &spec, updateState.Revision)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not an in-place upgrade here, and it doesn't feel like it should be judged

@zmberg zmberg removed this from the 1.7 milestone Jul 30, 2024
@ABNER-1
Copy link
Member

ABNER-1 commented Jul 31, 2024

Hi @diannaowa
I have few questions:

The modifications seem to target the InPlaceUpdateContainersRestartKey and InPlaceUpdatePodRestartKey primarily in the following scenarios:

  • When patch a pod during an in-place update.
  • When finish Grace Period.
  • When update Next Batch container need to in-place update.

Specifically, the action taken is to increase the restart count for containers which will in-place upgrade (the revision does not match the updated revision).

Is it correct to interpret that these annotations are intended to log the restart counts of containers specifically due to in-place upgrades?

I feel that tracking the restart count prior to each in-place upgrade does not provide meaningful data for the current version.

My expectation was that the restart counts for each container would be logged post-completion of an in-place upgrade, effectively resetting the count to zero. Then
abnormal restart count for the current version's containers = restart count in status - logged restart count in annotation

@ABNER-1 ABNER-1 removed the lgtm label Oct 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/L size/L: 100-499
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature request] add inPlaceUpdate restart count to annotation
7 participants