Skip to content

Conversation

@hawkw
Copy link
Contributor

@hawkw hawkw commented Dec 19, 2022

Currently, the proxy-injector may set the following environment variables to configure the policies that the proxy should use for specific inbound ports:

  • LINKERD2_PROXY_INBOUND_PORTS_DISABLE_PROTOCOL_DETECTION
  • LINKERD2_PROXY_INBOUND_PORTS_REQUIRE_IDENTITY
  • LINKERD2_PROXY_INBOUND_PORTS_REQUIRE_TLS

However, when the proxy is configured with a policy service address, these environment variables are never used, even when they are set. Instead, the proxy will always look up those ports with the policy controller, which will then tell it to do...what the environment variable would have already told it to do (because the env vars are generated based on the same annotations that would tell the policy controller what policy to send). This means we do unnecessary policy resolutions for those ports.

This branch updates the proxy so that these environment variables are always honored, even when a policy controller is configured. This way, the unnecessary lookups are avoided. Critically, we should note that we will never do a policy lookup for a port that is configured by one of these environment variables.

If a port is present in both LINKERD2_PROXY_INBOUND_PORTS (the list of ports for which we proactively start policy controller watches), as well as configured by one of the policy env vars, we will still look that port up with the policy controller, rather than using the env var configuration. A warning is logged in this case.

Currently, the proxy-injector may set the following environment
variables to configure the policies that the proxy should use for
specific inbound ports:

- `LINKERD2_PROXY_INBOUND_PORTS_DISABLE_PROTOCOL_DETECTION`
- `LINKERD2_PROXY_INBOUND_PORTS_REQUIRE_IDENTITY`
- `LINKERD2_PROXY_INBOUND_PORTS_REQUIRE_TLS`

However, when the proxy is configured with a policy service address,
these environment variables are never used, even when they are set.
Instead, the proxy will always look up those ports with the policy
controller, which will then tell it to do...what the environment
variable would have already told it to do (because the env vars are
generated based on the same annotations that would tell the policy
controller what policy to send). This means we do unnecessary policy
resolutions for those ports.

This branch updates the proxy so that these environment variables are
always honored, even when a policy controller is configured. This way,
the unnecessary lookups are avoided. Critically, we should note that we
will never do a policy lookup for a port that is configured by one of
these environment variables.

If a port is present in both `LINKERD2_PROXY_INBOUND_PORTS` (the list of
ports for which we proactively start policy controller watches), as well
as configured by one of the policy env vars, we will still look that
port up with the policy controller, rather than using the env var
configuration. A warning is logged in this case.
@hawkw hawkw marked this pull request as ready for review December 19, 2022 20:21
@hawkw hawkw requested a review from a team as a code owner December 19, 2022 20:21
@olix0r olix0r marked this pull request as draft December 28, 2022 18:04
@hawkw hawkw closed this Feb 22, 2023
@olix0r olix0r deleted the eliza/port-defaulting branch March 7, 2023 22:03
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.

2 participants