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 tcpCheck in podProbe #1474

Merged
merged 1 commit into from
Feb 28, 2024
Merged

Conversation

BH4AWS
Copy link
Collaborator

@BH4AWS BH4AWS commented Dec 19, 2023

Ⅰ. Describe what this PR does

support tcp check in PodProber. This is the second pr submission(total: 5).

Ⅱ. Does this pull request fix one issue?

Ⅲ. Describe how to verify it

using the tcp check in podprobemarker.

Ⅳ. Special notes for reviews

@kruise-bot kruise-bot added the size/XL size/XL: 500-999 label Dec 19, 2023
@veophi
Copy link
Member

veophi commented Dec 20, 2023

almost LGTM

plz fix the ut.

@codecov-commenter
Copy link

codecov-commenter commented Dec 20, 2023

Codecov Report

Attention: Patch coverage is 91.72414% with 12 lines in your changes are missing coverage. Please review.

Project coverage is 49.09%. Comparing base (5421ee7) to head (5667ad3).

Files Patch % Lines
...ler/podprobemarker/podprobemarker_event_handler.go 33.33% 3 Missing and 1 partial ⚠️
...ller/podprobemarker/pod_probe_marker_controller.go 94.54% 2 Missing and 1 partial ⚠️
...bemarker/validating/probe_create_update_handler.go 91.66% 1 Missing and 2 partials ⚠️
pkg/daemon/podprobe/prober.go 93.33% 1 Missing ⚠️
pkg/daemon/podprobe/worker.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1474      +/-   ##
==========================================
+ Coverage   48.55%   49.09%   +0.53%     
==========================================
  Files         157      157              
  Lines       22480    22604     +124     
==========================================
+ Hits        10916    11098     +182     
+ Misses      10360    10297      -63     
- Partials     1204     1209       +5     
Flag Coverage Δ
unittests 49.09% <91.72%> (+0.53%) ⬆️

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.

@@ -95,8 +96,8 @@ func (p *enqueueRequestForPod) Update(evt event.UpdateEvent, q workqueue.RateLim
if newInitialCondition == nil {
return
}
if kubecontroller.IsPodActive(new) && (oldInitialCondition == nil || oldInitialCondition.Status == corev1.ConditionFalse) &&
newInitialCondition.Status == corev1.ConditionTrue {
if kubecontroller.IsPodActive(new) && (((oldInitialCondition == nil || oldInitialCondition.Status == corev1.ConditionFalse) &&
Copy link
Member

Choose a reason for hiding this comment

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

the if clause is too complex , consider move IsPodActive to a separate clause, e.g.
if !kubecontroller.IsPodActive(new) { return }

Copy link
Collaborator Author

@BH4AWS BH4AWS Dec 20, 2023

Choose a reason for hiding this comment

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

using two if clause to support the condition judgment

`

if !kubecontroller.IsPodActive(new) {
	return
}


if ((oldInitialCondition == nil || oldInitialCondition.Status == corev1.ConditionFalse) &&
	newInitialCondition.Status == corev1.ConditionTrue) || old.Status.PodIP != new.Status.PodIP {...}

`

if kubecontroller.IsPodActive(new) && (oldInitialCondition == nil || oldInitialCondition.Status == corev1.ConditionFalse) &&
newInitialCondition.Status == corev1.ConditionTrue {
if kubecontroller.IsPodActive(new) && (((oldInitialCondition == nil || oldInitialCondition.Status == corev1.ConditionFalse) &&
newInitialCondition.Status == corev1.ConditionTrue) || (old.Status.PodIP != new.Status.PodIP)) {
ppms, err := p.getPodProbeMarkerForPod(new)
if err != nil {
klog.Errorf("List PodProbeMarker fialed: %s", err.Error())
Copy link
Member

Choose a reason for hiding this comment

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

plz fix typo here ""List PodProbeMarker fialed" -> ""List PodProbeMarker fail"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

test/e2e/apps/podprobemarker.go Show resolved Hide resolved
@ls-2018
Copy link
Member

ls-2018 commented Dec 20, 2023

plz fix dco.

// look up a port in a container by name & convert container name port
if probe.Probe.TCPSocket != nil {
probe, err = convertTcpSocketProbeCheckPort(probe, pod)
if err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

plz add ut of Reconcile for tcpsocket and httpget

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

@kruise-bot kruise-bot added size/XXL and removed size/XL size/XL: 500-999 labels Dec 23, 2023
@BH4AWS BH4AWS force-pushed the support_tcp_probe branch 9 times, most recently from 02f62f6 to a92a23d Compare December 27, 2023 14:40
@BH4AWS BH4AWS force-pushed the support_tcp_probe branch 3 times, most recently from 2d0faee to 53eb747 Compare January 4, 2024 14:37
Signed-off-by: jicheng.sk <jicheng.sk@alibaba-inc.com>
@furykerry
Copy link
Member

/lgtm

@zmberg
Copy link
Member

zmberg commented Feb 28, 2024

/approve

@kruise-bot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: zmberg

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 2dcebc6 into openkruise:master Feb 28, 2024
27 checks passed
@zmberg zmberg added this to the 1.6 milestone Mar 7, 2024
ppbits pushed a commit to ppbits/kruise that referenced this pull request Apr 4, 2024
Co-authored-by: jicheng.sk <jicheng.sk@alibaba-inc.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants