async-grpc-xds 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49d59879d476dd4d2e5f134a637371d29e1d0f352b35f22494630e424919e64d
4
- data.tar.gz: 8a6898813f97f84ef507a4bd001f8fc224912d297296cc3439f523853bf43f44
3
+ metadata.gz: fb5e9b5b4fbb4b738a33f5714254602767c65774e0d3cab49c0c7528042885c5
4
+ data.tar.gz: 7c1fc5b76c954ed6c2a61f6b2f3e154f1287492f9f81438cfccec0788d803beb
5
5
  SHA512:
6
- metadata.gz: 0f19714dcf5dd780cdfa9e7df25dcc52aa921ece5f168d10b0e8b2b34896a171098f4c907590e0ca27f8e43bf01e0e737faeb41bb2a746770762bb7dd807d1dd
7
- data.tar.gz: a5c9b8d7e1cfff638f626c03f7643c5e27385365e30cb9bdaaf7802c3ba8655fd71dff1523506f2cb96ab70d9230a86ec9040bccf1c446b4de9ea15eb6788990
6
+ metadata.gz: ba0e68b3e2b1a7767ae5d3e62646818a746d5553d7a2187511914d2cb8cc37a491fae834865294936c6982abefff76b676b0b8bfb67ad93eca55eb3b9f6245d9
7
+ data.tar.gz: e973bf4dd5bbf1e54efd2c6fba9134960d879a66039e49c0361b47d6bacba1f9e458d0cbcd4c109fe2d134794fef3983c86911332564a3557244b39bb95fbdde
checksums.yaml.gz.sig CHANGED
@@ -1,6 +1,4 @@
1
- e�(Ѽ�\�H�UB1��*�P�g���S��$������<+�V��jJǻ?�6 �X�K���Oș�J5C�x�j����5�y�OuWy%�YG�|�'��n�#P�Q9;(hd-N+�Wn�}�m�2ic�@!���m��C�4� ~,�?�+
2
- p燙D.�O-��ΐ:�wx/je�6��N��_��GC���U���:� u:zѫj{=�J��C0+o��͞?6
3
- �@��O���}C��Ay*쥏�8u�J��F���B�w�Z�� o�S����B�?����2.YR��B���v��,�pN�5v��p�
4
- �|_��%)��"�n ��'�Pq {��Ix���+l���C�
5
- w�͋�(:���/�W,EE�D�
6
- �����73
1
+ w�ʚ���,T�\L���'��b�b.�v����yϏ<[B����9|*�94Bū��;�`���������jB
2
+ �@�3̮�e\*~zW� *��/)D6��*�6�d�B��V�/�_IF����
3
+ ��ah:��#
4
+ �U��u�R?���)�[|5J�2�X|�S�f�F��r��f�Y��x�l ����kU��-y1+�e�x8�����L=G��ϡ�{z����ǀل
@@ -22,11 +22,12 @@ module Async
22
22
  # @parameter name [String] The cluster name.
23
23
  # @parameter service_name [String] The EDS service name.
24
24
  # @parameter load_balancing_policy [Envoy::Config::Cluster::V3::LoadBalancingPolicy | Nil] The typed Envoy load-balancing policy.
25
+ # @parameter health_checks [Array(Envoy::Config::Core::V3::HealthCheck)] The active health checks applied to cluster endpoints.
25
26
  # @parameter connect_timeout [Numeric] The upstream connection timeout in seconds.
26
27
  # @parameter protocol [Symbol] The canonical upstream protocol, either `:http1` or `:http2`.
27
28
  # @returns [Envoy::Config::Cluster::V3::Cluster] The generated cluster resource.
28
29
  # @raises [ArgumentError] If the upstream protocol is unsupported.
29
- def build(name, service_name: name, load_balancing_policy: nil, connect_timeout: 5, protocol: :http2)
30
+ def build(name, service_name: name, load_balancing_policy: nil, health_checks: [], connect_timeout: 5, protocol: :http2)
30
31
  options = {
31
32
  name: name.to_s,
32
33
  type: Envoy::Config::Cluster::V3::Cluster::DiscoveryType::EDS,
@@ -37,6 +38,7 @@ module Async
37
38
  )
38
39
  ),
39
40
  connect_timeout: duration(connect_timeout),
41
+ health_checks: health_checks,
40
42
  }
41
43
 
42
44
  options[:load_balancing_policy] = load_balancing_policy if load_balancing_policy
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2026, by Samuel Williams.
5
+
6
+ require "google/protobuf/duration_pb"
7
+ require "google/protobuf/wrappers_pb"
8
+
9
+ require "envoy/config/core/v3/health_check_pb"
10
+
11
+ module Async
12
+ module GRPC
13
+ module XDS
14
+ # Builds Envoy HTTP active health checks.
15
+ module HTTPHealthCheck
16
+ extend self
17
+
18
+ # Build an HTTP active health check.
19
+ # @parameter path [String] The request path used to check each endpoint.
20
+ # @parameter interval [Numeric] The interval between checks in seconds.
21
+ # @parameter timeout [Numeric] The check timeout in seconds.
22
+ # @parameter unhealthy_threshold [Integer] The consecutive failures required to mark an endpoint unhealthy.
23
+ # @parameter healthy_threshold [Integer] The consecutive successes required to mark an endpoint healthy.
24
+ # @returns [Envoy::Config::Core::V3::HealthCheck] The generated health check.
25
+ def build(path, interval: 1, timeout: 1, unhealthy_threshold: 2, healthy_threshold: 1)
26
+ Envoy::Config::Core::V3::HealthCheck.new(
27
+ timeout: duration(timeout),
28
+ interval: duration(interval),
29
+ unhealthy_threshold: Google::Protobuf::UInt32Value.new(value: Integer(unhealthy_threshold)),
30
+ healthy_threshold: Google::Protobuf::UInt32Value.new(value: Integer(healthy_threshold)),
31
+ http_health_check: Envoy::Config::Core::V3::HealthCheck::HttpHealthCheck.new(path: path.to_s)
32
+ )
33
+ end
34
+
35
+ private
36
+
37
+ def duration(value)
38
+ seconds = value.to_i
39
+
40
+ Google::Protobuf::Duration.new(
41
+ seconds: seconds,
42
+ nanos: ((value.to_f - seconds) * 1_000_000_000).to_i
43
+ )
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -9,7 +9,7 @@ module Async
9
9
  module GRPC
10
10
  # @namespace
11
11
  module XDS
12
- VERSION = "0.2.0"
12
+ VERSION = "0.3.0"
13
13
  end
14
14
  end
15
15
  end
@@ -15,6 +15,7 @@ require_relative "xds/context"
15
15
  require_relative "xds/client"
16
16
  require_relative "xds/cluster"
17
17
  require_relative "xds/endpoint"
18
+ require_relative "xds/http_health_check"
18
19
  require_relative "xds/client_side_weighted_round_robin"
19
20
  require_relative "xds/control_plane"
20
21
  require_relative "xds/service"
data/readme.md CHANGED
@@ -26,6 +26,10 @@ docker compose -f xds/docker-compose.yaml up --build --exit-code-from tests
26
26
 
27
27
  Please see the [project releases](https://socketry.github.io/async-grpc-xds/releases/index) for all releases.
28
28
 
29
+ ### v0.3.0
30
+
31
+ - Add Envoy HTTP active health-check resources and attach health checks to generated clusters.
32
+
29
33
  ### v0.2.0
30
34
 
31
35
  - Add ORCA load reporting messages, service interface, and client-side weighted-round-robin resources.
data/releases.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Releases
2
2
 
3
+ ## v0.3.0
4
+
5
+ - Add Envoy HTTP active health-check resources and attach health checks to generated clusters.
6
+
3
7
  ## v0.2.0
4
8
 
5
9
  - Add ORCA load reporting messages, service interface, and client-side weighted-round-robin resources.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-grpc-xds
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -138,6 +138,7 @@ files:
138
138
  - lib/async/grpc/xds/discovery_client.rb
139
139
  - lib/async/grpc/xds/endpoint.rb
140
140
  - lib/async/grpc/xds/health_checker.rb
141
+ - lib/async/grpc/xds/http_health_check.rb
141
142
  - lib/async/grpc/xds/load_balancer.rb
142
143
  - lib/async/grpc/xds/resource_cache.rb
143
144
  - lib/async/grpc/xds/resources.rb
metadata.gz.sig CHANGED
Binary file