-
Notifications
You must be signed in to change notification settings - Fork 366
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 e2e test RejectServiceTraffic #3892
Conversation
Codecov Report
@@ Coverage Diff @@
## main #3892 +/- ##
==========================================
+ Coverage 63.63% 66.31% +2.67%
==========================================
Files 293 556 +263
Lines 43224 87863 +44639
==========================================
+ Hits 27504 58262 +30758
- Misses 13484 25908 +12424
- Partials 2236 3693 +1457
Flags with carried forward coverage won't be shown. Click here to find out more. |
6c93ac0
to
f44b79d
Compare
createAgnhostServiceAndBackendPods should create the service with the selector that can only selects the Pod created together with it. Previous selector selected all Pods using agnhost image, causing traffic destined for service to be forwarded to unexpected Pod. This patch also changed to use same Pod selector for Service and ClusterNetworkPolicy to avoid redundancy and inconsistency. Signed-off-by: Quan Tian <qtian@vmware.com>
f44b79d
to
f294668
Compare
@@ -194,7 +194,7 @@ func (data *TestData) createAgnhostServiceAndBackendPods(t *testing.T, name, nam | |||
ipProtocol = corev1.IPv6Protocol | |||
} | |||
require.NoError(t, data.podWaitForRunning(defaultTimeout, name, namespace)) | |||
svc, err := data.CreateService(name, namespace, 80, 80, map[string]string{"app": "agnhost"}, false, false, svcType, &ipProtocol) | |||
svc, err := data.CreateService(name, namespace, 80, 80, map[string]string{"app": "agnhost", "antrea-e2e": name}, false, false, svcType, &ipProtocol) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I doubt if this change really works. Lable "antrea-e2e":$podName
is also added on all Pods automaticallly which are created by function createPodOnNode
. If "app": "agnhost"
is matching other Pods created not in this case, it should be the same.
If the target of this change is to use a different Service selector to get accurate Pods, we should introduce a different label/selector key in the created object from the default settings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lable "antrea-e2e":$podName is also added on all Pods automaticallly which are created by function
createPodOnNode
That's the purpose of the change, podName is different, right? createPodOnNode(pod1)
and createPodOnNode(pod2)
will get two Pods with different labels: {"app": "agnhost", "antrea-e2e": "pod1"}
, {"app": "agnhost", "antrea-e2e": "pod2"}
, and service1 only selects the former and service2 only selects the latter, anything wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wenyingd does the explanation address your question?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thanks for the explanation.
This PR is stale because it has been open 90 days with no activity. Remove stale label or comment, or this will be closed in 90 days |
This PR is stale because it has been open 90 days with no activity. Remove stale label or comment, or this will be closed in 90 days |
@GraysonWu @wenyingd ping for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for the fix.
/test-e2e |
/skip-e2e |
createAgnhostServiceAndBackendPods should create the service with the selector that can only selects the Pod created together with it. Previous selector selected all Pods using agnhost image, causing traffic destined for service to be forwarded to unexpected Pod. This patch also changed to use same Pod selector for Service and ClusterNetworkPolicy to avoid redundancy and inconsistency. Signed-off-by: Quan Tian <qtian@vmware.com>
createAgnhostServiceAndBackendPods should create the service with the
selector that can only selects the Pod created together with it.
Previous selector selected all Pods using agnhost image, causing
traffic destined for service to be forwarded to unexpected Pod.
This patch also changed to use same Pod selector for Service and
ClusterNetworkPolicy to avoid redundancy and inconsistency.
Signed-off-by: Quan Tian qtian@vmware.com