Skip to content

Add containerName param to probe func#3006

Merged
tnqn merged 2 commits into
antrea-io:mainfrom
GraysonWu:e2e-probe-container
Nov 17, 2021
Merged

Add containerName param to probe func#3006
tnqn merged 2 commits into
antrea-io:mainfrom
GraysonWu:e2e-probe-container

Conversation

@GraysonWu
Copy link
Copy Markdown
Contributor

@GraysonWu GraysonWu commented Nov 9, 2021

This PR has two changes:

  1. Adds a parameter containerName to probe func.

Previously we use "c[port]" as containerName in probe to call
runCommandFromPod. But in this case, probe func couldn't work
with the client created by createAgnhostPodOnNode or functions that
create Pod with different container names. We hope probe func could
be more generic, so I add containerName parameter. Let the caller
to choose the containerName.

  1. Changes the way that how we decides the connectivity.

Our framework will do probe 3 times to get the connectivity. Previous
logic is:

  • If one of them connected, then it's connected.
  • If no one connected and one of them is timeout, then it's
    dropped.
  • All other situation return rejected.

This could be a problem. For example: testRejectServiceTraffic
creates an agnhost Pod as client and use probe func to do the
probe. But agnhost Pod doesn't have "c[port]" container. So this
probe falls into the third case. It will always return rejected which
is also what we expected! Also, sometimes, due to the pressure on our
testbed or other test-side timing issues, it will return timeout. We
shouldn't take this as a dropped.

Now change the the logic to:

  • If no one connected and at least one got rejected, then return
    rejected.
  • If no one rejected and at least one connected, then return
    connected.
  • If all probes timeout, then return dropped.
  • All other sithation return error.

Signed-off-by: wgrayson wgrayson@vmware.com

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Nov 9, 2021

Codecov Report

Merging #3006 (b33ec6c) into main (363f2d8) will increase coverage by 0.07%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3006      +/-   ##
==========================================
+ Coverage   60.71%   60.79%   +0.07%     
==========================================
  Files         292      292              
  Lines       24708    24708              
==========================================
+ Hits        15002    15021      +19     
+ Misses       8058     8050       -8     
+ Partials     1648     1637      -11     
Flag Coverage Δ
kind-e2e-tests 47.90% <ø> (+0.05%) ⬆️
unit-tests 40.16% <ø> (+0.03%) ⬆️

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

Impacted Files Coverage Δ
pkg/agent/controller/traceflow/packetin.go 59.25% <0.00%> (-5.35%) ⬇️
pkg/controller/networkpolicy/store/addressgroup.go 83.01% <0.00%> (-3.78%) ⬇️
...agent/controller/traceflow/traceflow_controller.go 69.85% <0.00%> (-3.55%) ⬇️
pkg/controller/traceflow/controller.go 71.95% <0.00%> (-2.12%) ⬇️
...kg/agent/flowexporter/connections/conntrack_ovs.go 76.36% <0.00%> (-1.22%) ⬇️
pkg/agent/flowexporter/exporter/exporter.go 80.64% <0.00%> (-0.65%) ⬇️
pkg/agent/controller/networkpolicy/reconciler.go 76.77% <0.00%> (-0.21%) ⬇️
pkg/agent/agent.go 52.15% <0.00%> (+0.19%) ⬆️
pkg/agent/route/route_linux.go 47.26% <0.00%> (+0.59%) ⬆️
pkg/agent/openflow/client.go 57.76% <0.00%> (+0.87%) ⬆️
... and 6 more

Comment thread pkg/agent/controller/networkpolicy/reject.go Outdated
Comment thread test/e2e/k8s_util.go
Comment on lines +117 to +146
func decideProbeResult(stderr string, probeNum int) PodConnectivityMark {
countConnected := probeNum - strings.Count(stderr, "\n")
countDropped := strings.Count(stderr, "TIMEOUT")
countRejected := strings.Count(stderr, "REFUSED") + strings.Count(stderr, "no route to host")

return curConnectivity
if countRejected == 0 && countConnected > 0 {
return Connected
}
if countConnected == 0 && countRejected > 0 {
return Rejected
}
if countDropped == probeNum {
return Dropped
}
return Error
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

wasn't this part of another PR aimed at fixing FQDN e2e test flakes?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is in that FQDN flake PR. Because this PR is also kind of involved in this decideProbeResult issue, I'm thinking if this could be merged by this PR?

Comment thread test/e2e/k8s_util.go Outdated
@GraysonWu GraysonWu force-pushed the e2e-probe-container branch 2 times, most recently from 63e92ca to 3395789 Compare November 9, 2021 20:30
Dyanngg
Dyanngg previously approved these changes Nov 9, 2021
Copy link
Copy Markdown
Contributor

@Dyanngg Dyanngg left a comment

Choose a reason for hiding this comment

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

lgtm

@GraysonWu GraysonWu force-pushed the e2e-probe-container branch 2 times, most recently from ac29963 to a8e9bbb Compare November 11, 2021 23:04
tnqn
tnqn previously approved these changes Nov 12, 2021
Copy link
Copy Markdown
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

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

LGTM, a minor comment

Comment thread test/e2e/k8s_util.go
Comment thread test/e2e/k8s_util.go Outdated
@GraysonWu GraysonWu force-pushed the e2e-probe-container branch 2 times, most recently from 21e7d4f to 71d2375 Compare November 15, 2021 21:01
@GraysonWu GraysonWu requested a review from tnqn November 16, 2021 00:40
tnqn
tnqn previously approved these changes Nov 16, 2021
Copy link
Copy Markdown
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

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

LGTM

@tnqn
Copy link
Copy Markdown
Member

tnqn commented Nov 16, 2021

/test-e2e
/test-ipv6-e2e
/test-ipv6-only-e2e
/test-windows-e2e

This PR has two changes:

1. Adds a parameter `containerName` to `probe` func.

Previously we use "c[port]" as containerName in `probe` to call
`runCommandFromPod`. But in this case, `probe` func couldn't work
with the client created by `createAgnhostPodOnNode` or functions that
create Pod with different container names. We hope `probe` func could
be more generic, so I add `containerName` parameter. Let the caller
to choose the containerName.

2. Changes the way that how we decides the connectivity.

Our framework will do probe 3 times to get the connectivity. Previous
logic is:
  - If one of them connected, then it's connected.
  - If no one connected and one of them is timeout, then it's
    dropped.
  - All other situation return rejected.

This could be a problem. For example: `testRejectServiceTraffic`
creates an agnhost Pod as client and use `probe` func to do the
probe. But agnhost Pod doesn't have "c[port]" container. So this
probe falls into the third case. It will always return rejected which
is also what we expected! Also, sometimes, due to the pressure on our
testbed or other test-side timing issues, it will return timeout. We
shouldn't take this as a `dropped`.

Now change the the logic to:
  - If no one connected and at least one got rejected, then return
    rejected.
  - If no one rejected and at least one connected, then return
    connected.
  - If all probes timeout, then return dropped.
  - All other sithation return error.

Signed-off-by: wgrayson <wgrayson@vmware.com>
Signed-off-by: wgrayson <wgrayson@vmware.com>
@GraysonWu
Copy link
Copy Markdown
Contributor Author

Test ACNPRejectIngressUDP failed in IPv6 env. The root cause is agnhost returns a different key string for IPv6 UDP case.
Code and comment updated.

@GraysonWu
Copy link
Copy Markdown
Contributor Author

/test-e2e
/test-ipv6-e2e
/test-ipv6-only-e2e
/test-windows-e2e

@GraysonWu GraysonWu requested a review from tnqn November 16, 2021 22:09
Copy link
Copy Markdown
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

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

LGTM

@tnqn
Copy link
Copy Markdown
Member

tnqn commented Nov 17, 2021

/skip-conformance
/skip-networkpolicy

@tnqn tnqn merged commit db0c92d into antrea-io:main Nov 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants