-
Notifications
You must be signed in to change notification settings - Fork 373
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 service destination in traceflow #979
Conversation
Thanks for your PR. The following commands are available:
These commands can only be run by members of the vmware-tanzu organization. |
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.
As a general comment, make sure that traceflow error messages are "wrapped" appropriately to provide enough context.
71c9187
to
025713f
Compare
Can one of the admins verify this patch? |
Thanks for your PR. The following commands are available:
These commands can only be run by members of the vmware-tanzu organization. |
if ob.Component == opsv1alpha1.SpoofGuard { | ||
sender = true | ||
} | ||
if ob.Action == opsv1alpha1.Delivered || ob.Action == opsv1alpha1.Dropped { | ||
receiver = true | ||
} | ||
if ob.TranslatedDstIP != "" { |
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.
Humm.. Feel not certain if worthwhile to figure out the Pod from IP. Do you think good enough to use IP to indicate the destination here?
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, if a translated IP is a Pod IP, it can be retrieved here.
ob.TranslatedDstIP will exist only when packet is processed by DNAT.
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 meant there will be costs to watch Pods and build IP -> Pod indexes. So, I feel maybe not worthwhile to translate IP back to Pods.
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.
Pods will be always watched in AntreaController (by NetworkPolicyController), thus the only extra cost is the PodIP index. I feel an additional index is acceptable.
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.
Could you share the memory overhead of the new index your saw?
BTW, I know for networkpolicy query, I remember we plan to add Pod IP index too, but still want to avoid obvious mem increase. We already saw some mem issues in scale tests.
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.
If you can send me details of the specific case which worries you, I can add an additional test to networkpolicy_controller_perf_test/controller_query_perf_test to directly test memory consumption.
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.
131.3M v.s. 137.7M sounds ok. But in our scale tests, we saw mem usage of ~10G with 150K Pods and 40K NetworkPolicies. Do you think in that case, the extra index will lead to Gs of more mem consumption?
I think the major different point is that I only added many Pods into cache and didn't touch NetworkPolicy. For NetworkPolicy, many additional elements will be cached such as rules and OVS flows.
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.
The price of the extra PodIP index is a map like below will be created and maintained when adding/updating/deleting pods. But unlike the Pod index of AddressGroup and AppliedToGroup that could have large number of Pods, each Pod has only 1 IP, the extra overhead is constant.
{
"1.1.1.1": []string{"ns1/pod1"},
"1.1.1.2": []string{"ns1/pod2"},
}
BenchmarkAddPortWithPodIPIndex-4 252216 4207 ns/op 1608 B/op 17 allocs/op
BenchmarkAddPortWithoutPodIPIndex-4 408417 3234 ns/op 1144 B/op 12 allocs/op
Given the difference is 3us vs 4us per pod, i.e. 300ms vs 400ms for 100k Pods, I think it should be ok.
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.
Ok. But can we add some comments at where we create the IP-Pod index to explain why we add the index and we evaluated the overhead is acceptable?
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.
Added comments to:
pkg/controller/traceflow/controller.go
// Add IP-Pod index. Each Pod has only 1 IP, the extra overhead is constant and acceptable.
// @tnqn evaluated the performance without/with IP index is 3us vs 4us per pod, i.e. 300ms vs 400ms for 100k Pods.
podInformer.Informer().AddIndexers(cache.Indexers{podIPIndex: podIPIndexFunc})
74215ac
to
faa088d
Compare
} | ||
if dstNodeIP != "" { | ||
// Check encap status if Node of destination Pod is remote or destination is IP/Service | ||
if dstNodeIP != "" || tf.Spec.Destination.Pod == "" { |
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.
Doesn't it need to wait for a while if the destination is service? what if the target pod is on another Node? so do IP on another Node case.
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. If destination is Service or IP/Pod not on current Node, then verify the tunnel/encap status and wait.
Change
if dstNodeIP != "" || tf.Spec.Destination.Pod == "" {
To
if dstMAC == "" {
And added comments.
Thanks for your PR. The following commands are available:
|
/test-all |
/test-windows-networkpolicy |
/test-windows-conformance |
/test-windows-networkpolicy |
4 similar comments
/test-windows-networkpolicy |
/test-windows-networkpolicy |
/test-windows-networkpolicy |
/test-windows-networkpolicy |
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
Result example: