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

delete operation-type when all IDs' operate finished #207

Merged

Conversation

ColdsteelRail
Copy link
Member

@ColdsteelRail ColdsteelRail commented May 23, 2024

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

  • N
  • Y

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

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

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Other

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

  • N
  • Y

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

  • Unit test
  • Integration test
  • Benchmark (add benchmark stats below)
  • Manual test (add detailed scripts or steps below)
  • Other

6. Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ColdsteelRail ColdsteelRail changed the title execute lifecycle parallel with multi ID delete operation-type when all IDs' operate finished May 23, 2024
Copy link
Collaborator

@shaofan-hs shaofan-hs left a comment

Choose a reason for hiding this comment

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

Add a unit test for mutating webhook?

@@ -49,7 +50,7 @@ func (lc *OpsLifecycle) Validating(ctx context.Context, c client.Client, oldPod,
expectedLabels := make(map[string]struct{})
foundLabels := make(map[string]struct{})
for label := range newPod.Labels {
for _, v := range pairLabelPrefixesMap { // Labels must exist together and have the same ID
for _, v := range v1alpha1.WellKnownLabelPrefixesWithID { // Validate well known lifecycle Labels format
Copy link
Collaborator

Choose a reason for hiding this comment

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

Labels
->
labels

@shaofan-hs shaofan-hs merged commit 86cb197 into KusionStack:main Jun 20, 2024
5 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jun 20, 2024
@KusionStack KusionStack deleted a comment from ColdsteelRail Jun 20, 2024
@ColdsteelRail
Copy link
Member Author

在 lifecycle 的设计中,允许多个 ID(controller) 运维同一个对象,并且让这些 ID 经历同 1 次摘挂流,但存在一个问题:假设 ID-A 和 ID-B 运维同一个 Pod,率先执行完 Operation 的 ID-A 会在挂流前等待 ID-B,此时 ID-A 的 {id: type} 标签被提前删除,但后续阶段还需用到 {id: type} 标签,导致 ID-A 被死锁在 operation 阶段。该 PR 修复了这个问题,当且仅当所有 ID 进入挂流阶段时,才删除 {id: type} 信息

@ColdsteelRail
Copy link
Member Author

In the design of the lifecycle, it is allowed for multiple IDs (controllers) to manage the same object and go through the attachment-detachment process together. However, there exists a problem: suppose ID-A and ID-B are managing the same Pod. If ID-A finishes its operation first, it will wait for ID-B before the detachment phase. At this point, the {id: type} label of ID-A is prematurely deleted, but this label is still needed in later stages, causing ID-A to be deadlocked in the operation phase. This PR fixes the issue by ensuring that the {id: type} information is only deleted when all IDs have entered the detachment phase.

@ColdsteelRail ColdsteelRail deleted the lifecycle-parallel-for-multi-id branch July 8, 2024 06:11
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