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

fix(gracedelete webhook): limit the PodDeletionIndicationLabel update… #197

Merged
merged 6 commits into from
May 6, 2024

Conversation

cyh-ant
Copy link
Contributor

@cyh-ant cyh-ant commented Apr 26, 2024

… frequency to avoid update conflict

1. Does this PR affect any open issues?(Y/N) and add issue references (e.g. "fix #123", "re #123".):

  • N

2. What is the scope of this PR (e.g. component or file name):

pkg/webhook/server/generic/pod/gracedelete/webhook.go

3. Provide a description of the PR(e.g. more details, effects, motivations or doc link):

  • Contains experimental features

Fix GraceDelete#Validating method bug. Limit the PodDeletionIndicationLabel update frequency to 10s(default), to avoid update conflict when workload update or scale down, delete pod constantly.

4. Are there any breaking changes?(Y/N) and describe the breaking changes(e.g. more details, motivations or doc link):

  • N

5. Are there test cases for these changes?(Y/N) select and add more details, references or doc links:

  • Unit test
  • Manual test (add detailed scripts or steps below)

6. Release note

@@ -37,6 +37,10 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
)

var (
updatePodDeletionIndicationLabelInterval = 5 * 1000 * 1000 * 1000
Copy link
Collaborator

Choose a reason for hiding this comment

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

change to 5*time.Second?

// limit the AnnotationGraceDeleteTimestamp update frequency to updateGraceDeleteTimestampAnnoInterval,
// to avoid update conflict caused by workload delete pod constantly
if timestamp, ok := newPod.Annotations[appsv1alpha1.AnnotationGraceDeleteTimestamp]; ok {
unixNano, err := strconv.ParseInt(timestamp, 10, 64)
Copy link
Collaborator

Choose a reason for hiding this comment

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

unixNano => lastDeleteTimestamp

Copy link
Collaborator

@wu8685 wu8685 left a comment

Choose a reason for hiding this comment

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

lgtm

@wu8685 wu8685 merged commit 1a13fd4 into KusionStack:main May 6, 2024
5 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators May 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

提供灰度流量的能力
2 participants