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

feat(destination): Add meshed HTTP/2 keep-alive settings #12504

Merged
merged 3 commits into from
Apr 30, 2024
Merged

Conversation

olix0r
Copy link
Member

@olix0r olix0r commented Apr 25, 2024

This commit adds destination controller configuration that enables default
keep-alives for meshed HTTP/2 clients.

This is accomplished by encoding the raw protobuf message structure into the
helm values, and then encoding that as JSON in the destination controller's
command-line options. This allows operators to set any supported HTTP/2 client
configuration without having to modify the destination controller.

@olix0r
Copy link
Member Author

olix0r commented Apr 30, 2024

Validated via the diagnostics commands:

:; bin/linkerd diagnostics endpoints web-svc.emojivoto.svc.cluster.local:8080 -o json                                                                 
[
  {
    "namespace": "emojivoto",
    "ip": "10.42.0.103",
    "port": 8080,
    "pod": "web-8d58dcdcd-cp4vv",
    "service": "web-svc.emojivoto",
    "weight": 10000,
    "http2": {
      "keep_alive": {
        "interval": {
          "seconds": 10
        },
        "timeout": {
          "seconds": 3
        },
        "while_idle": true
      }
    },
    "labels": {
      "control_plane_ns": "linkerd",
      "deployment": "web",
      "pod": "web-8d58dcdcd-cp4vv",
      "pod_template_hash": "8d58dcdcd",
      "serviceaccount": "web",
      "zone": ""
    }
  }
]
:; bin/linkerd diagnostics profile 10.42.0.103                                                                                                                                                                       
{
  "retry_budget": {
    "retry_ratio": 0.2,
    "min_retries_per_second": 10,
    "ttl": {
      "seconds": 10
    }
  },
  "endpoint": {
    "addr": {
      "ip": {
        "Ip": {
          "Ipv4": 170524775
        }
      },
      "port": 80
    },
    "weight": 10000,
    "metric_labels": {
      "control_plane_ns": "linkerd",
      "deployment": "web",
      "namespace": "emojivoto",
      "pod": "web-8d58dcdcd-cp4vv",
      "pod_template_hash": "8d58dcdcd",
      "serviceaccount": "web",
      "zone": ""
    },
    "tls_identity": {
      "Strategy": {
        "DnsLikeIdentity": {
          "name": "web.emojivoto.serviceaccount.identity.linkerd.cluster.local"
        }
      },
      "server_name": {
        "name": "web.emojivoto.serviceaccount.identity.linkerd.cluster.local"
      }
    },
    "protocol_hint": {
      "Protocol": {
        "H2": {}
      }
    },
    "http2": {
      "keep_alive": {
        "interval": {
          "seconds": 10
        },
        "timeout": {
          "seconds": 3
        },
        "while_idle": true
      }
    }
  }
}

proxy consuming this:

[     2.100208s] DEBUG ThreadId(01) outbound:accept{client.addr=10.42.0.105:51604 server.addr=10.43.213.5:80}:proxy{addr=10.43.213.5:80}:service{ns=emojivoto name=web-svc port=80}:pool:endpoint{addr=10.42.0.103:8080}:http.endpoint: linkerd_proxy_http::client: Building HTTP client settings=OrigProtoUpgrade(ClientParams { flow_control: Some(Fixed { initial_stream_window_size: 65535, initial_connection_window_size: 1048576 }), keep_alive: Some(ClientKeepAlive { interval: 10s, timeout: 3s, while_idle: true }), max_concurrent_reset_streams: None, max_frame_size: None, max_send_buf_size: None }, PoolSettings { max_idle: 18446744073709551615, idle_timeout: 3s })

@olix0r olix0r marked this pull request as ready for review April 30, 2024 18:30
@olix0r olix0r requested a review from a team as a code owner April 30, 2024 18:30
This commit adds destination controller configuration that enables default
keep-alives for meshed HTTP/2 clients.

This is accomplished by encoding the raw protobuf message structure into the
helm values, and then encoding that as JSON in the destination controller's
command-line options. This allows operators to set any supported HTTP/2 client
configuration without having to modify the destination controller.
@@ -206,6 +206,9 @@ spec:
- -identity-trust-domain={{.Values.identityTrustDomain | default .Values.clusterDomain}}
- -default-opaque-ports={{.Values.proxy.opaquePorts}}
- -enable-pprof={{.Values.enablePprof | default false}}
{{- if (.Values.destinationController).meshedHttp2ClientProtobuf }}
- --meshed-http2-client-params={{ toJson .Values.destinationController.meshedHttp2ClientProtobuf }}
Copy link
Member

Choose a reason for hiding this comment

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

since this is in a yaml list of args, does that mean that it will gracefully handle json which contains spaces? or would we need to introduce quoting/escaping?

Copy link
Member Author

Choose a reason for hiding this comment

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

toJson (mustToJson): Convert list, slice, array, dict, or object to JSON.
toPrettyJson (mustToPrettyJson): Convert list, slice, array, dict, or object to indented JSON.
toRawJson (mustToRawJson): Convert list, slice, array, dict, or object to JSON with HTML characters unescaped.

toJson gives us a compact, escaped string. Non-newline whitespace is fine in this context.

@olix0r olix0r enabled auto-merge (squash) April 30, 2024 19:27
@olix0r olix0r merged commit aef8a02 into main Apr 30, 2024
37 checks passed
@olix0r olix0r deleted the ver/dst-h2 branch April 30, 2024 19:35
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.

None yet

2 participants