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

Update ovs-pipeline.md #2725

Merged
merged 1 commit into from
Oct 25, 2021
Merged

Conversation

hongliangl
Copy link
Contributor

Signed-off-by: Hongliang Liu [email protected]

@hongliangl hongliangl force-pushed the ovs-pipeline-doc branch 2 times, most recently from 083d6ae to 3c38a98 Compare September 8, 2021 01:54
docs/design/ovs-pipeline.md Outdated Show resolved Hide resolved
docs/design/ovs-pipeline.md Outdated Show resolved Hide resolved
for more information.
* *IN_PORT action*: an action to output the packet on the port on which it was
received. This is the only standard way to output the packet to the input port.
* *session affinity*: when accessing a Service, to make sure that connections from
Copy link
Contributor

Choose a reason for hiding this comment

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

How about: "a load balancer feature that always selects the same backend server for connections from a particular clients. For a K8s Service, session affinity can be enabled by setting..."?

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 changed a little.

* *session affinity*: a load balancer feature that always selects the same backend
  Endpoint for connections from a particular client. For a K8s Service, session
  affinity can be enabled by setting `service.spec.sessionAffinity` to "ClientIP"
  (default is "None"). See [K8s Service](https://kubernetes.io/docs/concepts/services-networking/service/)
  for more information about session affinity.

Copy link
Contributor

@jianjuns jianjuns Sep 16, 2021

Choose a reason for hiding this comment

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

Sure. Maybe change Endpoint to endpoint (I feel no reason to capitalize endpoint).

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 changed Endpoint to Pod. I thought that Pod is more accurate.

docs/design/ovs-pipeline.md Outdated Show resolved Hide resolved
docs/design/ovs-pipeline.md Outdated Show resolved Hide resolved
docs/design/ovs-pipeline.md Outdated Show resolved Hide resolved
docs/design/ovs-pipeline.md Outdated Show resolved Hide resolved
docs/design/ovs-pipeline.md Outdated Show resolved Hide resolved
docs/design/ovs-pipeline.md Outdated Show resolved Hide resolved
docs/design/ovs-pipeline.md Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Sep 15, 2021

Codecov Report

Merging #2725 (5c6668a) into main (e32664e) will decrease coverage by 20.34%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #2725       +/-   ##
===========================================
- Coverage   61.26%   40.92%   -20.35%     
===========================================
  Files         284      158      -126     
  Lines       23562    19539     -4023     
===========================================
- Hits        14436     7996     -6440     
- Misses       7564    10796     +3232     
+ Partials     1562      747      -815     
Flag Coverage Δ
kind-e2e-tests ?
unit-tests 40.92% <ø> (+0.05%) ⬆️

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

Impacted Files Coverage Δ
pkg/ovs/openflow/default.go 0.00% <0.00%> (-100.00%) ⬇️
pkg/util/runtime/runtime.go 0.00% <0.00%> (-100.00%) ⬇️
pkg/agent/cniserver/pod_configuration_linux.go 0.00% <0.00%> (-100.00%) ⬇️
pkg/ovs/openflow/logs.go 9.52% <0.00%> (-90.48%) ⬇️
pkg/apis/controlplane/register.go 0.00% <0.00%> (-90.00%) ⬇️
pkg/agent/nodeportlocal/k8s/annotations.go 0.00% <0.00%> (-83.88%) ⬇️
pkg/agent/agent_linux.go 0.00% <0.00%> (-80.00%) ⬇️
pkg/agent/client.go 0.00% <0.00%> (-77.42%) ⬇️
pkg/ovs/ovsconfig/ovs_client_linux.go 0.00% <0.00%> (-76.93%) ⬇️
pkg/flowaggregator/certificate.go 0.00% <0.00%> (-76.58%) ⬇️
... and 231 more

Copy link
Contributor

@jianjuns jianjuns left a comment

Choose a reason for hiding this comment

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

A few more comments.

Flow 1 is used to match packet whose destination IP is virtual hairpin IP and
change the destination IP of the matched packet by loading register `NXM_OF_IP_SRC`
to `NXM_OF_IP_DST`. Bit 18 in NXM_NX_REG0 is set to 0x1, which indicates that packet
should be output to the port on which it was received, which is done by table [L2ForwardingOutTable].
Copy link
Contributor

Choose a reason for hiding this comment

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

done by -> done in

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks,updated.


* `load:0x2->NXM_NX_REG4[16..18]` is used to set the value of bits [16..18] in NXM_NX_REG4
to 0b002, which indicates that Endpoint selection has been done. Note that, the Endpoint
selection has not really been done yet - it will be done in the target OVS group, so
Copy link
Contributor

@jianjuns jianjuns Sep 17, 2021

Choose a reason for hiding this comment

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

Read it again, and feel "done in the target OVS group" is hard to understand. Should we say "done by the group action"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done by the group action is better.

The actions of the above flow:

* `load:0x2->NXM_NX_REG4[16..18]` is used to set the value of bits [16..18] in NXM_NX_REG4
to 0b002, which indicates that Endpoint selection has been done. Note that, the Endpoint
Copy link
Contributor

Choose a reason for hiding this comment

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

How about: "selection "is performed""

Copy link
Contributor Author

@hongliangl hongliangl Sep 17, 2021

Choose a reason for hiding this comment

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

IMO, it is a little wierde to use perform only for this sentence as other related sentences use done.

Copy link
Contributor

Choose a reason for hiding this comment

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

I want to use "performed" is just because it is not really "done", and for the same reason I would use "is" rather than "has been", and also quote "is performed".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got what you meant, thanks for explaining.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

* `load:0x2->NXM_NX_REG4[16..18]` is used to set the value of bits [16..18] in NXM_NX_REG4
to 0b002, which indicates that Endpoint selection has been done. Note that, the Endpoint
selection has not really been done yet - it will be done in the target OVS group, so
the current action should be done in the OVS group entry after Endpoint selection. However,
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest to remove the "so..." sentence. It is even confusing with it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed.

selection has not really been done yet - it will be done in the target OVS group, so
the current action should be done in the OVS group entry after Endpoint selection. However,
according to PR [#2101](https://github.com/antrea-io/antrea/pull/2101), to hold more
Endpoints in an OVS group entry, it is a workaround way to do the current action here.
Copy link
Contributor

Choose a reason for hiding this comment

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

workaround way -> workaround

Copy link
Contributor

Choose a reason for hiding this comment

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

Still I cannot understand what you want to express here. Probably you should add more information to explain why the workaround can help hold more endpoints, or say: "However, we set the bits here, for the purpose of supporting more Endpoints in an OVS group. Check PR #2101 to learn more information."

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 prefer to say "However, we set the bits here, for the purpose of supporting more Endpoints in an OVS group. Check PR #2101 to learn more information". It's a little complicated to explain the reason, and I think it is unnecessary to explain in the doc.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok

according to PR [#2101](https://github.com/antrea-io/antrea/pull/2101), to hold more
Endpoints in an OVS group entry, it is a workaround way to do the current action here.
* `load:0x1->NXM_NX_REG0[19]` is used to set the value of bit 19 in NXM_NX_REG0 to 0x1,
which means that the source and destination MACs should be rewritten.
Copy link
Contributor

Choose a reason for hiding this comment

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

should be -> need to be

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, updated.

according to PR [#2101](https://github.com/antrea-io/antrea/pull/2101), to hold more
Endpoints in an OVS group entry, it is a workaround way to do the current action here.
* `load:0x1->NXM_NX_REG0[19]` is used to set the value of bit 19 in NXM_NX_REG0 to 0x1,
which means that the source and destination MACs should be rewritten.
Copy link
Contributor

Choose a reason for hiding this comment

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

should be -> need to be

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, updated.

jianjuns
jianjuns previously approved these changes Sep 17, 2021
Copy link
Contributor

@jianjuns jianjuns left a comment

Choose a reason for hiding this comment

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

Comments on the SVG diagram:

  1. Service ClusterIP/LoadBalancer traffic -> ClusterIP/LoadBalancer Service traffic. The same for NodePort.
  2. Could we keep the version when AntreaProxy is disabled? Do not have a good idea how to do that. Could we put the fragment of "ContrackStateTable, DNATTable, AntreaPolicyEgressRuleTable, output:gw, kube-proxy", after the main diagram?

We probably need @antoninbas to check the SVG format.

@hongliangl
Copy link
Contributor Author

Service ClusterIP/LoadBalancer traffic -> ClusterIP/LoadBalancer Service traffic. The same for NodePort.

Updated

Could we keep the version when AntreaProxy is disabled? Do not have a good idea how to do that. Could we put the fragment of "ContrackStateTable, DNATTable, AntreaPolicyEgressRuleTable, output:gw, kube-proxy", after the main diagram?

If keeping the version when AntreaProxy is disabled, I think we need another document. I have made some assumptions for this document as we can see the following:

This document currently makes the following assumptions:

Antrea is used in encap mode (an overlay network is created between all Nodes)
AntreaProxy is enabled
All the Nodes are Linux Nodes
IPv6 is disabled

I think we may maintain a document for each of the following cases if possible:

  • AntreaProxy is disabled.
  • AntreaProxy is enabled and ProxyAll is disabled.
  • AntreaProxy is enabled and ProxyAll is enabled.

But I don't have a good idea how to deal with the common parts(e.g, table 0, table 110, register introduction) of above three cases.

@jianjuns
Copy link
Contributor

Probably not worthwhile to maintain two docs. How about just keep the pipeline SVG or a corner of it for the kube-proxy case?

@hongliangl
Copy link
Contributor Author

Probably not worthwhile to maintain two docs. How about just keep the pipeline SVG or a corner of it for the kube-proxy case?

If we keep the pipeline SVG with AntreaProxy disabled, I think we need also to explain table DnatTable and add more explanation for table ServiceHairpinTable, HairpinSNATTable(They should not exist when AntreaProxy is disabled).
For table SpoofGuardTable, when AntreaProxy is disabled, the IP packet goes to ConntrackTable, otherwise the IP packet should go to ServiceHairpinTable. I think we should explain this, but this may confuse readers. Since AntreaProxy is enabled by default, I think we may not keep the pipeline SVG with AntreaProxy disabled.

a corner of it for the kube-proxy case?

Do you mean that we add a extra chapter to explain the case with AntreaProxy disabled?

@jianjuns
Copy link
Contributor

Do you mean that we add a extra chapter to explain the case with AntreaProxy disabled?
Yeah, maybe we can add a section to talk about AntreaProxy disabled. It just needs to talk about the differences, like DNATTable.

@jianjuns
Copy link
Contributor

It is ok to me too, if you like to merge the current PR. I can create another PR to add the contents with kube-proxy back.

@hongliangl
Copy link
Contributor Author

It is ok to me too, if you like to merge the current PR. I can create another PR to add the contents with kube-proxy back.

Updated, I have add contents with kube-proxy back.

![OVS pipeline](../assets/ovs-pipeline-antrea-proxy.svg)

If feature AntreaProxy is disabled, the pipeline is as the following:

![OVS pipeline](../assets/ovs-pipeline.svg)
Copy link
Contributor

@jianjuns jianjuns Sep 22, 2021

Choose a reason for hiding this comment

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

How about adding a separate section under Tables that talks about the case when kube-proxy is used, and put the diagram and DNATTable there?
@antoninbas : thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, that sounds good to me. We should just emphasize the default case, which is AntreaProxy enabled.

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.

took a quick look at the SVG file and the formatting looks good to me; I didn't review the rest of this PR

![OVS pipeline](../assets/ovs-pipeline-antrea-proxy.svg)

If feature AntreaProxy is disabled, the pipeline is as the following:

![OVS pipeline](../assets/ovs-pipeline.svg)
Copy link
Contributor

Choose a reason for hiding this comment

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

yes, that sounds good to me. We should just emphasize the default case, which is AntreaProxy enabled.

Comment on lines 221 to 225
If feature AntreaProxy is enabled, the pipeline is as the following:

![OVS pipeline](../assets/ovs-pipeline-antrea-proxy.svg)

If feature AntreaProxy is disabled, the pipeline is as the following:
Copy link
Contributor

Choose a reason for hiding this comment

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

s/as the following/as follows

@hongliangl
Copy link
Contributor Author

took a quick look at the SVG file and the formatting looks good to me; I didn't review the rest of this PR

Thanks.

@hongliangl hongliangl force-pushed the ovs-pipeline-doc branch 2 times, most recently from 7366e62 to b613906 Compare September 23, 2021 01:49

### DNATTable (40)

This table is create when feature AntreaProxy is disabled. Its only job is to
Copy link
Contributor

Choose a reason for hiding this comment

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

is created only when AntreaProxy is disabled

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

### DNATTable (40)

This table is create when feature AntreaProxy is disabled. Its only job is to
send traffic destined to Services through the local gateway, without any
Copy link
Contributor

Choose a reason for hiding this comment

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

gateway -> gateway interface, to be clearer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, updated.

Policies.

The table-miss flow entry (flow 2) for this table forwards all non-Service
traffic to the next table, [EgressRuleTable].
Copy link
Contributor

Choose a reason for hiding this comment

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

EgressRuleTable -> AntreaPolicyEgressRuleTable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, updated.

@@ -929,12 +1135,53 @@ The first flow outputs all unicast packets to the correct port (the port was
resolved by the "dmac" table, [L2ForwardingCalcTable]). IP packets for which
[L2ForwardingCalcTable] did not set bit 16 of NXM_NX_REG0 will be dropped.

## Tables (AntreaProxy is disabled)

![OVS pipeline](../assets/ovs-pipeline.svg)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you rename DnatTable to DNATTable in the SVG?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, updated, @antoninbas could you please review the updated SVG file? Thanks!

Signed-off-by: Hongliang Liu <[email protected]>
@hongliangl
Copy link
Contributor Author

/skip-all

@hongliangl
Copy link
Contributor Author

/skip-test-ipv6-conformance
/skip-test-ipv6-e2e
/skip-test-ipv6-networkpolicy
/skip-test-ipv6-only-conformance
/skip-test-ipv6-only-networkpolicy
/skip-test-windows-conformance
/skip-test-windows-e2e
/skip-test-windows-networkpolicy

@jianjuns
Copy link
Contributor

@hongliangl : I am going to merge this PR. Do you have any further revision to make?

@jianjuns
Copy link
Contributor

/skip-all

@jianjuns jianjuns merged commit f45c104 into antrea-io:main Oct 25, 2021
@hongliangl
Copy link
Contributor Author

@hongliangl : I am going to merge this PR. Do you have any further revision to make?

@jianjuns , thanks for merging this. No more further revision.

@hongliangl hongliangl deleted the ovs-pipeline-doc branch April 28, 2022 12:00
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.

4 participants