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 validateSidecarConflict #884

Merged
merged 1 commit into from
Feb 14, 2022

Conversation

pigletfly
Copy link
Contributor

Signed-off-by: pigletfly wangbing.adam@gmail.com

Ⅰ. Describe what this PR does

scenario: a same sidecar container exists in multiple other sidecarset

Ⅱ. Does this pull request fix one issue?

Ⅲ. Describe how to verify it

Ⅳ. Special notes for reviews

@kruise-bot kruise-bot added the size/M size/M: 30-99 label Jan 10, 2022
@pigletfly
Copy link
Contributor Author

/assign @zmberg

@pigletfly pigletfly force-pushed the fix-validate-sidecar-conflict branch from 2e56fc8 to ab96d20 Compare January 11, 2022 01:51
@codecov-commenter
Copy link

codecov-commenter commented Jan 11, 2022

Codecov Report

Merging #884 (870e806) into master (64b66e7) will increase coverage by 0.11%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #884      +/-   ##
==========================================
+ Coverage   47.90%   48.01%   +0.11%     
==========================================
  Files         119      119              
  Lines       11237    11233       -4     
==========================================
+ Hits         5383     5394      +11     
+ Misses       5038     5020      -18     
- Partials      816      819       +3     
Flag Coverage Δ
unittests 48.01% <100.00%> (+0.11%) ⬆️

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

Impacted Files Coverage Δ
...set/validating/sidecarset_create_update_handler.go 52.07% <100.00%> (+1.78%) ⬆️
pkg/controller/daemonset/daemonset_controller.go 36.38% <0.00%> (-0.88%) ⬇️
pkg/controller/cloneset/cloneset_controller.go 52.96% <0.00%> (ø)
pkg/controller/cloneset/sync/cloneset_update.go 44.94% <0.00%> (ø)
pkg/controller/sidecarset/sidecarset_controller.go 13.88% <0.00%> (ø)
pkg/controller/statefulset/stateful_set_control.go 62.58% <0.00%> (+0.08%) ⬆️
pkg/controller/uniteddeployment/revision.go 67.93% <0.00%> (+0.24%) ⬆️
pkg/controller/daemonset/daemonset_util.go 65.77% <0.00%> (+2.01%) ⬆️
pkg/controller/daemonset/update.go 26.76% <0.00%> (+2.52%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 64b66e7...870e806. Read the comment docs.

@zmberg
Copy link
Member

zmberg commented Jan 14, 2022

@pigletfly tks, you are right. But I'd like to think about it in a different way and see if you can:

matchedList := make([]*appsv1alpha1.SidecarSet, 0)
for i := range sidecarSets.Items {
obj := &sidecarSets.Items[i]
if !isSidecarSetNamespaceDiff(sidecarSet, obj) && util.IsSelectorOverlapping(sidecarSet.Spec.Selector, obj.Spec.Selector) {
matchedList = append(matchedList, obj)
}
}

This matchedList can be facilitated later.
Because only two sidecar overlaps are meaningful for comparison, and this situation does not exist "a same sidecar container exists in multiple other sidecarset"?

@pigletfly pigletfly force-pushed the fix-validate-sidecar-conflict branch 2 times, most recently from 43f42b6 to 115de9c Compare January 21, 2022 06:35
Signed-off-by: pigletfly <wangbing.adam@gmail.com>
@pigletfly pigletfly force-pushed the fix-validate-sidecar-conflict branch from 115de9c to 870e806 Compare January 21, 2022 07:10
@pigletfly
Copy link
Contributor Author

@zmberg PTAL

@zmberg
Copy link
Member

zmberg commented Feb 14, 2022

/lgtm

@FillZpp
Copy link
Member

FillZpp commented Feb 14, 2022

/approve

@kruise-bot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: FillZpp

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

The pull request process is described 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

@FillZpp FillZpp merged commit 411bda2 into openkruise:master Feb 14, 2022
@pigletfly pigletfly deleted the fix-validate-sidecar-conflict branch February 14, 2022 14:04
ppbits pushed a commit to ppbits/kruise that referenced this pull request Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants