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

SidecarSet hot upgrade containers should be consistent with pod's #850

Merged
merged 1 commit into from
Dec 20, 2021

Conversation

veophi
Copy link
Member

@veophi veophi commented Dec 15, 2021

Signed-off-by: veophi vec.g.sun@gmail.com

Ⅰ. Describe what this PR does

SidecarSet hot upgrade containers should be consistent with pod's, otherwise, will not match the pod/sidecarset.

Ⅱ. Does this pull request fix one issue?
fixed #855

@kruise-bot kruise-bot requested review from Fei-Guo and zmberg December 15, 2021 06:32
@kruise-bot kruise-bot added the size/M size/M: 30-99 label Dec 15, 2021
@codecov-commenter
Copy link

codecov-commenter commented Dec 15, 2021

Codecov Report

Merging #850 (aea75a3) into master (3a6e489) will decrease coverage by 0.12%.
The diff coverage is 22.72%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #850      +/-   ##
==========================================
- Coverage   48.36%   48.23%   -0.13%     
==========================================
  Files         118      118              
  Lines       11017    11036      +19     
==========================================
- Hits         5328     5323       -5     
- Misses       4878     4902      +24     
  Partials      811      811              
Flag Coverage Δ
unittests 48.23% <22.72%> (-0.13%) ⬇️

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

Impacted Files Coverage Δ
pkg/control/sidecarcontrol/util.go 49.34% <0.00%> (-5.41%) ⬇️
pkg/webhook/pod/mutating/sidecarset.go 73.52% <33.33%> (-0.73%) ⬇️
...troller/sidecarset/sidecarset_pod_event_handler.go 66.66% <100.00%> (+0.46%) ⬆️
pkg/controller/sidecarset/sidecarset_processor.go 70.11% <100.00%> (-4.03%) ⬇️
pkg/controller/cloneset/cloneset_controller.go 52.96% <0.00%> (ø)

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 3a6e489...aea75a3. Read the comment docs.

@veophi veophi changed the title SidecarSet container upgrade type should be consistent with pod SidecarSet container upgrade containers should be consistent with pod's Dec 15, 2021
@veophi veophi force-pushed the sidecarset-hot-upgrade branch from eeabcab to da27df2 Compare December 15, 2021 06:57
@veophi veophi changed the title SidecarSet container upgrade containers should be consistent with pod's SidecarSet upgrade containers should be consistent with pod's Dec 15, 2021
@veophi veophi changed the title SidecarSet upgrade containers should be consistent with pod's SidecarSet hot upgrade containers should be consistent with pod's Dec 15, 2021
@@ -79,6 +79,10 @@ func (h *PodCreateHandler) sidecarsetMutatingPod(ctx context.Context, req admiss
} else if !matched {
continue
}
// if it is update event, check whether pod is consistent with sidecarSet container upgrade type
if isUpdated && !sidecarcontrol.IsPodConsistentWithSidecarSetContainerUpgradeType(pod, &sidecarSet) {
Copy link
Member

Choose a reason for hiding this comment

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

if isPodInjectedSidecar(s, pod) && !sidecarcontrol.IsPodConsistentWithSidecarSetContainerUpgradeType(pod, &sidecarSet) {
continue
}

Copy link
Member Author

Choose a reason for hiding this comment

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

done

var container *corev1.Container
switch sc.UpgradeStrategy.UpgradeType {
case appsv1alpha1.SidecarContainerHotUpgrade:
container = util.GetContainer(fmt.Sprintf("%v-1", sc.Name), pod)
Copy link
Member

Choose a reason for hiding this comment

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

also check for the backup container?
container2 = util.GetContainer(fmt.Sprintf("%v-2", sc.Name), pod)

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@veophi veophi force-pushed the sidecarset-hot-upgrade branch from aea75a3 to 9e5b968 Compare December 17, 2021 09:45
Copy link
Member

@furykerry furykerry left a comment

Choose a reason for hiding this comment

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

/lgtm

Signed-off-by: veophi <vec.g.sun@gmail.com>
@veophi veophi force-pushed the sidecarset-hot-upgrade branch from 9e5b968 to 2483d7b Compare December 20, 2021 04:05
@kruise-bot kruise-bot removed the lgtm label Dec 20, 2021
Copy link
Member

@FillZpp FillZpp left a comment

Choose a reason for hiding this comment

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

/lgtm

@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

@kruise-bot kruise-bot merged commit 0417db8 into openkruise:master Dec 20, 2021
FillZpp pushed a commit that referenced this pull request Jan 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
6 participants