Add docker image for TPROXY#6873
Conversation
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: costinm The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
I just modified my other PR to add the version to docker images |
Codecov Report
@@ Coverage Diff @@
## release-1.0 #6873 +/- ##
============================================
+ Coverage 71% 71% +1%
============================================
Files 360 360
Lines 31273 31128 -145
============================================
- Hits 22123 22082 -41
+ Misses 8275 8179 -96
+ Partials 875 867 -8
Continue to review full report at Codecov.
|
|
@rlenglet please take a look. I think we need to wire this up for sure. |
rlenglet
left a comment
There was a problem hiding this comment.
LGTM.
I would also modify the Helm template to default to this image if the mode is known to be TPROXY at Helm configuration time.
pilot/docker/Dockerfile.proxytproxy
Outdated
|
|
||
| ENV ISTIO_META_ISTIO_PROXY_SHA $proxy_version | ||
| ENV ISTIO_META_ISTIO_VERSION $istio_version | ||
| ENV ISTIO_META_INTERCEPTION_MODE TPROXY |
There was a problem hiding this comment.
That’s not necessary here, since that will be set by the injector.
There was a problem hiding this comment.
Actually, this should NOT be set to TPROXY if the other conditions are not met (run the sidecar with CAP_NET_ADMIN, in particular), otherwise Envoy will just keep crashing trying to set the IP_TRANSPARENT socket option on the listener.
So you really should remove this ENV from the Dockerfile.
There was a problem hiding this comment.
My plan is to make the init container customizable and identical with the sidecar container, and pass the same ENV on both. For 1.1 we may provide dynamic changes to the iptable capture.
The other 'conditions' should go away - if you specify tproxy sidecar (and init) image, it will take care of both and no extra customizations needed. This will also allow to clean up the iptable initializer, which is a mess right now - we'll have a script for tproxy and one for redirect.
Short term (1.0) - users will need to specify both image and the old annotation. Better then not working at all..
There was a problem hiding this comment.
if you specify tproxy sidecar (and init) image, it will take care of both and no extra customizations needed
That's not enough. You need to run istio-proxy with CAP_NET_ADMIN for TPROXY to work. And that can only be done by modifying the pod spec. If you don't want that, you'll have to always run istio-proxy with CAP_NET_ADMIN. I'm fine with that, but I got push back when I had proposed that.
There was a problem hiding this comment.
The other way would be to set envoy setuid root in this Dockerfile here. That will make sure that it gets CAP_NET_ADMIN. I'm fine with that too.
There was a problem hiding this comment.
Yes, I know - but requirements change. There are plans to have more flexibility in how we capture, which will need NET_ADMIN anyways ( proxy-agent may change iptables at runtime ). We still want to start proxy-agent as root
and exec envoy as 1337 - I still don't think it's ok to run envoy as root (as it happens in tproxy mode).
|
I would also recommend that you just build the tproxy image as derived from the proxyv2 image. You only need to RUN the chgrp/chmod commands on top of it. |
|
It looks like this version works - even on a kernel without -m socket support ( I think matching existing socket is an optimization to skip extra rules - I've used tproxy for UDP without socket and also works). The performance with small number of connections seem to still lag - haven't tested yet with large number, where tproxy is supposed to be better. There are further fixes and polish needed - in particular having pilot-agent run as root and exec |
|
Note the I sneaked in a small env variable that if set will allow the 'split port' mode. |
|
As an update - unlike 0.8, in 1.0 tproxy appears to be faster (as I expected). |
|
/test istio-pilot-e2e-envoyv2-v1alpha3 |
pilot/docker/Dockerfile.proxytproxy
Outdated
| COPY envoy_bootstrap_v2.json /var/lib/istio/envoy/envoy_bootstrap_tmpl.json | ||
|
|
||
| ENV ISTIO_META_ISTIO_PROXY_SHA $proxy_version | ||
| ENV ISTIO_META_ISTIO_VERSION $istio_version |
There was a problem hiding this comment.
These are outdated? ISTIO_META_ISTIO_PROXY_VERSION is what we read in Pilot IIRC
There was a problem hiding this comment.
Those are additional variables.
|
|
||
| # Remove the old chains, to generate new configs. | ||
| iptables -t nat -D PREROUTING -p tcp -j ISTIO_INBOUND 2>/dev/null | ||
| iptables -t mangle -D PREROUTING -p tcp -j ISTIO_INBOUND 2>/dev/null |
There was a problem hiding this comment.
shouldn't this be guarded? if TPROXY, then set the mangle?
rshriram
left a comment
There was a problem hiding this comment.
missing istio_meta_istio_proxy_version
|
/test e2e-mixer-no_auth |
interesting in knowing how can I reproduce the tests on my lab. any tooling to suggest? |
you can use https://fortio.org/ |
This complements the inject time version. Values based on the build time SHA of the proxy and version.