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

Introduce discovery cache timeout values #10831

Merged
merged 6 commits into from
May 5, 2023
Merged

Conversation

mateiidavid
Copy link
Member

The proxy caches results in-memory, both for inbound and outbound service (and policy) discovery. While the proxy's default values are great in most cases, certain client configurations may require overrides. The proxy supports overriding the default values, however, it currently does not offer an easy way for users to configure them.

This PR introduces two new values in Linkerd's control plane chart. The values control the inbound and outbound cache discovery idle timeout -- the amount of time a result will be kept in the cache if unused. Setting this value will change the configuration for all injected proxies, but not for the control plane.


Tests

Overriding options through CLI
$ bin/linkerd install --set proxy.outboundDiscoveryCacheUnusedTimeout="10s" \
       --set proxy.inboundDiscoveryCacheUnusedTimeout="120s" \
       | k apply -f -

Control plane does not receive the overrides:

$ k get po -n linkerd linkerd-destination-77b4f9849b-ptlhk -o yaml | grep 'LINKERD2_PROXY_\\w*_DISCOVERY_IDLE_TIMEOUT' -A 1
<nothing>

but injected proxies do

$ kubectl apply -f curl.yaml
$ k get po curl-c48c64d4-26wtn -o yaml | grep 'LINKERD2_PROXY_\\w*_DISCOVERY_IDLE_TIMEOUT' -A 1
    - name: LINKERD2_PROXY_OUTBOUND_DISCOVERY_IDLE_TIMEOUT
      value: 10s
    - name: LINKERD2_PROXY_INBOUND_DISCOVERY_IDLE_TIMEOUT
      value: 120s
Overriding through Helm
$ helm dep update linkerd-control-plane
$ helm install linkerd2 \
       --set proxy.outboundDiscoveryCacheUnusedTimeout="30s" \
       --set proxy.inboundDiscoveryCacheUnusedTimeout="99s" \
       --set-file identityTrustAnchorsPEM=ca.crt \
       --set-file identity.issuer.tls.crtPEM=issuer.crt \
       --set-file identity.issuer.tls.keyPEM=issuer.key \
       --create-namespace \
       --namespace linkerd \
       --set linkerdVersion=dev-33adae2b-matei \ # needs to be overridden
       ./linkerd-control-plane/

Control plane will not receive overrides:

$ k get po -n linkerd linkerd-destination-66d7ffc5f9-m7l7z -o yaml | grep 'LINKERD2_PROXY_\\w*_DISCOVERY_IDLE_TIMEOUT' -A 1
<nothing>
$  k get po curl-c48c64d4-gbtjc -o yaml | grep 'LINKERD2_PROXY_\\w*_DISCOVERY_IDLE_TIMEOUT' -A 1
    - name: LINKERD2_PROXY_OUTBOUND_DISCOVERY_IDLE_TIMEOUT
      value: 30s
    - name: LINKERD2_PROXY_INBOUND_DISCOVERY_IDLE_TIMEOUT
      value: 99s

The proxy caches results in-memory, both for inbound and outbound
service (and policy) discovery. While the proxy's default values are
great in most cases, certain client configurations may require
overrides. The proxy supports overriding the default values, however, it
currently does not offer an easy way for users to configure them.

This PR introduces two new values in Linkerd's control plane chart. The
values control the inbound and outbound cache discovery idle timeout --
the amount of time a result will be kept in the cache if unused. Setting
this value will change the configuration for all injected proxies, but
not for the control plane.

Signed-off-by: Matei David <matei@buoyant.io>
@mateiidavid mateiidavid requested a review from a team as a code owner April 27, 2023 15:34
Signed-off-by: Matei David <matei@buoyant.io>
Signed-off-by: Matei David <matei@buoyant.io>
Signed-off-by: Matei David <matei@buoyant.io>
@@ -230,10 +230,12 @@ Kubernetes: `>=1.21.0-0`
| proxy.image.pullPolicy | string | imagePullPolicy | Pull policy for the proxy container Docker image |
| proxy.image.version | string | linkerdVersion | Tag for the proxy container Docker image |
| proxy.inboundConnectTimeout | string | `"100ms"` | Maximum time allowed for the proxy to establish an inbound TCP connection |
| proxy.inboundDiscoveryCacheUnusedTimeout | string | `"90s"` | Maximum time allowed before an unused inbound discovery result is evicted from the cache, defaults to 90s if unspecified |
Copy link
Member

Choose a reason for hiding this comment

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

Probably don't need to describe the default value in the comment since we can see the default value in the second column now.

Signed-off-by: Matei David <matei@buoyant.io>
@mateiidavid mateiidavid merged commit 38c186b into main May 5, 2023
@mateiidavid mateiidavid deleted the matei/add-cache-helm-values branch May 5, 2023 13:33
mateiidavid added a commit that referenced this pull request Jun 1, 2023
The proxy caches results in-memory, both for inbound and outbound
service (and policy) discovery. While the proxy's default values are
great in most cases, certain client configurations may require
overrides. The proxy supports overriding the default values, however, it
currently does not offer an easy way for users to configure them.

This PR introduces two new values in Linkerd's control plane chart. The
values control the inbound and outbound cache discovery idle timeout --
the amount of time a result will be kept in the cache if unused. Setting
this value will change the configuration for all injected proxies, but
not for the control plane.


---------

Signed-off-by: Matei David <matei@buoyant.io>
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.

3 participants