-
Notifications
You must be signed in to change notification settings - Fork 369
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
Implement Antrea proxy #772
Conversation
Thanks for your PR. The following commands are available:
These commands can only be run by members of the vmware-tanzu organization. |
/test-conformance |
/test-networkpolicy |
296b664
to
d522aa7
Compare
/test-windows-conformance |
7fb5813
to
a33d19c
Compare
a33d19c
to
c207764
Compare
c207764
to
042161e
Compare
/test-all |
042161e
to
14db0c5
Compare
/test-all |
@weiqiangt @jianjuns just wanted to check if the plan was to enable this mode unconditionally starting with the next Antrea release (0.8.0)? Or have a config switch (temporarily or permanently) to enable / disable the feature? Personally I am fine with enabling unconditionally, I don't if a user would have as a requirement that kube-proxy must be used. This is relevant to @srikartati who is working on conntrack polling for IPFix flow information export. |
Just to be specific.. looking at supporting Pod-to-Service flows/connections as IPFIX flow records. |
I suggest to add a config option, and maybe keep the default to upstream kube-proxy for Linux nodes, until we are confident on the quality and have enough tests. |
5b55336
to
c97d15a
Compare
a0f6639
to
1f7353d
Compare
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.
Just some suggestions about comments improvement.
# Enable antrea proxy which provides ServiceLB for in-cluster services in antrea agent. | ||
# It should be enabled on Windows, otherwise NetworkPolicy will not take effect on | ||
# Service traffic. | ||
# AntreaProxy: false |
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 feel ok to add relatively mature features to the yamls but not all features. Creating a separate doc sounds good.
pkg/agent/proxy/proxier.go
Outdated
serviceConfig *config.ServiceConfig | ||
// endpointsChanges and serviceChanges contains all changes to endpoints and | ||
// services that happened since last syncProxyRules call. For a single object, | ||
// changes are accumulated, i.e. previous is state from before all of them, |
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.
Maybe you should add the comments about previous/current to endpointsChanges struct or endpointsChangesTracker funcs. Hard to understand from 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.
Moved.
k8sproxy "github.com/vmware-tanzu/antrea/third_party/proxy" | ||
) | ||
|
||
type endpointsChange struct { |
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 think you should add more comments to this file for structs and funcs. Not easy to understand the code without enough comments.
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.
Updated.
endpointsConfig *config.EndpointsConfig | ||
serviceConfig *config.ServiceConfig | ||
// endpointsChanges and serviceChanges contains all changes to endpoints and | ||
// services that happened since last syncProxyRules call. For a single object, |
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 think it would be much better if you can add some comments to explain the event sequence before syncProxyRules.
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.
Updated.
/test-windows-networkpolicy |
1f7353d
to
d82e51e
Compare
/test-all |
/test-networkpolicy |
d82e51e
to
c7ab11b
Compare
@weiqiangt the PR description about enableProxy is out of date, could you update? |
/test-all |
/test-all |
/test-conformance |
/test-e2e |
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.
Some small comments, mostly because of some typos in recently-added comments in the code. Otherwise LGTM. Glad that this is ready!
pkg/agent/openflow/pipeline.go
Outdated
endpointIP := net.ParseIP(endpoint.IP()).To4() | ||
ipVal := binary.BigEndian.Uint32(endpointIP) | ||
portVal := uint16(endpointPort) | ||
// TODO: use goto_table instead. |
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.
maybe a comment to this effect would have been nice
pkg/agent/openflow/client.go
Outdated
// affinityTimeout is not zero, it also installs the flow which has a learn | ||
// action to maintain the LB decision. | ||
// The group with the groupID must be installed before, otherwise the | ||
// installation will be failed. |
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.
s/will be failed/will fail
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.
Done.
pkg/agent/proxy/endpoints.go
Outdated
|
||
// endpointsChangesTracker tracks Endpoints changes. | ||
type endpointsChangesTracker struct { | ||
// hostname is used to tell whether the Endpoint locates on current Node. |
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.
s/locates/is located
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.
Done.
pkg/agent/proxy/endpoints.go
Outdated
|
||
// OnEndpointUpdate updates given Service's Endpoints change map based on the | ||
// <previous, current> Endpoints pair. It returns true if items changed, | ||
// otherwise return false. |
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.
s/return false/it returns false
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.
Done.
pkg/agent/proxy/endpoints.go
Outdated
} | ||
|
||
// endpointsToEndpointsMap translates single Endpoints object to EndpointsMap. | ||
// This function is used for incremental updated of EndpointsMap. |
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.
s/updated/update ?
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.
Done.
pkg/agent/proxy/proxier.go
Outdated
// endpointsChanges and serviceChanges contains all changes to endpoints and | ||
// services that happened since last syncProxyRules call. For a single object, | ||
// changes are accumulated. Once both endpointsChanges and serviceChanges | ||
// had been synced, syncProxyRules will start syncing rules to the OVS. |
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.
// had been synced, syncProxyRules will start syncing rules to the OVS. | |
// have been synced, syncProxyRules will start syncing rules to OVS. | |
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.
Done.
pkg/agent/proxy/proxier.go
Outdated
serviceChanges *serviceChangesTracker | ||
// syncProxyRulesMutex protects internal caches and states. | ||
syncProxyRulesMutex sync.Mutex | ||
// serviceMap stores services we expected to be installed. |
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.
we expect
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.
Done.
pkg/agent/proxy/proxier.go
Outdated
serviceMap k8sproxy.ServiceMap | ||
// serviceInstalledMap stores services we actually installed. | ||
serviceInstalledMap k8sproxy.ServiceMap | ||
// endpointsMap stores endpoints we expected to be installed. |
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.
we expect
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.
Done.
test/e2e/proxy_test.go
Outdated
} | ||
defer teardownTest(t, data) | ||
|
||
if enabled, err := proxyEnabled(data); err != nil { |
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.
maybe define skipIfProxyDisabled(t, data)
in this file to reduce verbosity of this test and the subsequent ones
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.
Done.
) | ||
|
||
func proxyEnabled(data *TestData) (bool, error) { | ||
key := "resubmit(,40),resubmit(,41)" |
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 follow-up to an earlier comment I made, there is already a GetAntreaConfigMap
method defined for e2e tests, but I am not sure it's a much better solution than what you are doing at the moment
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 we use the configmap method, then we will need to parse the config.
For now, I prefer to keep the current code.
In the future, as we may add more experimental features, we can have a particular function to retrieve featuregayte options in e2e tests. How do you think about this?
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.
Sounds good
pkg/agent/proxy/endpoints.go
Outdated
return endpointsMap | ||
} | ||
|
||
// Update updates an EndpointsMap base on current changes and returns stale |
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.
base -> based
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.
Done.
Co-authored-by: Quan Tian <[email protected]> Signed-off-by: Weiqiang TANG <[email protected]>
c7ab11b
to
6a82265
Compare
/test-all |
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, I believe all my comments have been addressed
/test-conformance |
/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.
All comments should have been addressed now, I'm going to merge this after remaining tests pass to give other feature developers to address the conflicts, which might need some efforts given all of them reply on openflow implementation..
Signed-off-by: Weiqiang TANG <[email protected]>
Signed-off-by: Weiqiang TANG <[email protected]>
AntreaProxy
option in FeatureGate for enabling Antrea proxy in the antrea agent. The default value for Linux is false while a Windows one is true.Fixes #463.
Signed-off-by: Weiqiang TANG [email protected]