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

Add documentation for except support in ipBlock #6677

Merged
merged 1 commit into from
Oct 21, 2024

Conversation

Dyanngg
Copy link
Contributor

@Dyanngg Dyanngg commented Sep 17, 2024

Documentation for #6658

docs/antrea-network-policy.md Outdated Show resolved Hide resolved
docs/antrea-network-policy.md Outdated Show resolved Hide resolved
docs/antrea-network-policy.md Outdated Show resolved Hide resolved
docs/antrea-network-policy.md Outdated Show resolved Hide resolved
docs/antrea-network-policy.md Outdated Show resolved Hide resolved
docs/antrea-network-policy.md Outdated Show resolved Hide resolved
docs/antrea-network-policy.md Outdated Show resolved Hide resolved
docs/antrea-network-policy.md Outdated Show resolved Hide resolved
@Dyanngg
Copy link
Contributor Author

Dyanngg commented Oct 17, 2024

/skip-all

Copy link
Contributor

@antoninbas antoninbas left a comment

Choose a reason for hiding this comment

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

Did we want to include a note about the possible impact of having too many rules with too many excepts? I know this can lead to a rule explosion, but I am not sure it matters too much as there is no constraining cap on the number of flows with the same priority? I don't think there is a significant impact on datapath performance. More flows would increase memory usage.

ephemeral and unpredictable.

Starting with Antrea v2.2, Antrea-native policies now support an `except` field under
ipBlock, which can be used to carve out specific CIDRs in the base IP range:
Copy link
Contributor

Choose a reason for hiding this comment

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

ipBlock -> ipBlock

I don't think you applied Jiajun's suggestion BTW?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did, just forgot to paste it to the other place...

docs/antrea-network-policy.md Outdated Show resolved Hide resolved
@Dyanngg
Copy link
Contributor Author

Dyanngg commented Oct 17, 2024

Did we want to include a note about the possible impact of having too many rules with too many excepts? I know this can lead to a rule explosion, but I am not sure it matters too much as there is no constraining cap on the number of flows with the same priority? I don't think there is a significant impact on datapath performance. More flows would increase memory usage.

Added a short note, let me know if it is good from your perspective

antoninbas
antoninbas previously approved these changes Oct 17, 2024
Copy link
Contributor

@antoninbas antoninbas left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines 925 to 926
evaluations for lower priority rules. A large number of policy rules with `except` ipBlocks
can also have negative impacts on Antrea memory usage.
Copy link
Contributor

Choose a reason for hiding this comment

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

It's fine by me. @tnqn do you know if a high number of flows can also impact latency / throughput. I imagine that it is possible with a large number of diverse connections.

Copy link
Member

Choose a reason for hiding this comment

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

According to my understanding on how the flow classfication runs, the cost is relative to the number of different mask lengths, instead of the number of flows. For example, in the worst case, there could be 31 mask lengths and OVS may have to calculate the masked IP 31 times to see if it matches flows in this table. Even a single policy rule can cause this if well-designed. On the other hand, if a large number of policy rules have the same mask length for their except ipBlocks, they shouldn't really cause much negative impacts. So the cost is kind of consistent regardless of the number of flows.

For the memory usage, I feel it may be not worth emphasizing its memory impact. An IPBlock with an except ipBlock can result in 31 IPNets in the worst case, but a podSelector can result in tens or hundreds of IPs either.
And the implementation of except in Antrea policy is not different from it in K8s policy.

Copy link
Contributor

Choose a reason for hiding this comment

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

An IPBlock with an except ipBlock can result in 31 IPNets in the worst case

technically, I can have multiple except cidrs and generate many more IPNets than that

but yes, I agree with the overall statement

Comment on lines 925 to 926
evaluations for lower priority rules. A large number of policy rules with `except` ipBlocks
can also have negative impacts on Antrea memory usage.
Copy link
Member

Choose a reason for hiding this comment

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

According to my understanding on how the flow classfication runs, the cost is relative to the number of different mask lengths, instead of the number of flows. For example, in the worst case, there could be 31 mask lengths and OVS may have to calculate the masked IP 31 times to see if it matches flows in this table. Even a single policy rule can cause this if well-designed. On the other hand, if a large number of policy rules have the same mask length for their except ipBlocks, they shouldn't really cause much negative impacts. So the cost is kind of consistent regardless of the number of flows.

For the memory usage, I feel it may be not worth emphasizing its memory impact. An IPBlock with an except ipBlock can result in 31 IPNets in the worst case, but a podSelector can result in tens or hundreds of IPs either.
And the implementation of except in Antrea policy is not different from it in K8s policy.

docs/antrea-network-policy.md Outdated Show resolved Hide resolved
@Dyanngg
Copy link
Contributor Author

Dyanngg commented Oct 21, 2024

/skip-all

@antoninbas antoninbas merged commit 42a50ff into antrea-io:main Oct 21, 2024
49 of 53 checks passed
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