sovereign 0.24.4__py3-none-any.whl → 0.24.6__py3-none-any.whl

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.

Potentially problematic release.


This version of sovereign might be problematic. Click here for more details.

sovereign/utils/eds.py CHANGED
@@ -26,12 +26,16 @@ def _upstream_kwargs(
26
26
  if hard_fail:
27
27
  raise
28
28
  ip_addresses = [upstream["address"]]
29
- return {
29
+ ret = {
30
30
  "addrs": ip_addresses,
31
31
  "port": upstream["port"],
32
32
  "region": default_region or upstream.get("region", "unknown"),
33
33
  "zone": proxy_region,
34
34
  }
35
+ if "health_check_config" in upstream:
36
+ ret["health_check_config"] = upstream["health_check_config"]
37
+
38
+ return ret
35
39
 
36
40
 
37
41
  def total_zones(endpoints: List[Dict[str, Dict[str, Any]]]) -> int:
@@ -84,14 +88,21 @@ def locality_lb_endpoints(
84
88
  return ret
85
89
 
86
90
 
87
- def lb_endpoints(addrs: List[str], port: int, region: str, zone: str) -> Dict[str, Any]:
91
+ def lb_endpoints(
92
+ addrs: List[str],
93
+ port: int,
94
+ region: str,
95
+ zone: str,
96
+ health_check_config: Optional[Dict[str, Any]] = None,
97
+ ) -> Dict[str, Any]:
88
98
  """
89
99
  Creates an envoy endpoint.LbEndpoints proto
90
100
 
91
- :param addrs: The IP addresses or hostname(s) of the upstream.
92
- :param port: The port that the upstream should be accessed on.
93
- :param region: The region of the upstream.
94
- :param zone: The region of the proxy asking for the endpoint configuration.
101
+ :param addrs: The IP addresses or hostname(s) of the upstream.
102
+ :param port: The port that the upstream should be accessed on.
103
+ :param region: The region of the upstream.
104
+ :param zone: The region of the proxy asking for the endpoint configuration.
105
+ :param health_check_config: Optional health check config for the upstream.
95
106
  """
96
107
  if PRIORITY_MAPPING is None:
97
108
  raise RuntimeError(
@@ -100,20 +111,25 @@ def lb_endpoints(addrs: List[str], port: int, region: str, zone: str) -> Dict[st
100
111
  )
101
112
  node_priorities = PRIORITY_MAPPING.get(zone, {})
102
113
  priority = node_priorities.get(region, 10)
114
+
115
+ endpoints = []
116
+ for addr in addrs:
117
+ endpoint = {
118
+ "endpoint": {
119
+ "address": {
120
+ "socket_address": {
121
+ "address": addr,
122
+ "port_value": port,
123
+ }
124
+ },
125
+ }
126
+ }
127
+ if health_check_config:
128
+ endpoint["endpoint"]["health_check_config"] = health_check_config
129
+ endpoints.append(endpoint)
130
+
103
131
  return {
104
132
  "priority": priority,
105
133
  "locality": {"zone": region},
106
- "lb_endpoints": [
107
- {
108
- "endpoint": {
109
- "address": {
110
- "socket_address": {
111
- "address": addr,
112
- "port_value": port,
113
- }
114
- }
115
- }
116
- }
117
- for addr in addrs
118
- ],
134
+ "lb_endpoints": endpoints,
119
135
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sovereign
3
- Version: 0.24.4
3
+ Version: 0.24.6
4
4
  Summary: Envoy Proxy control-plane written in Python
5
5
  Home-page: https://pypi.org/project/sovereign/
6
6
  License: Apache-2.0
@@ -34,7 +34,7 @@ sovereign/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
34
  sovereign/utils/auth.py,sha256=9rruWP-Ok8ec9l_MzWY3oUZKI8s7jt0Dmx3kHWnTRgQ,1772
35
35
  sovereign/utils/crypto.py,sha256=Xf6eBFOVDy1MWiOAmZTMYllOaSxi_JCGg6dFrceywvg,3465
36
36
  sovereign/utils/dictupdate.py,sha256=JkDjg16u7sW6A_4Q2oX1PY_MtJU7m1VivZWn9VLZ9V8,2559
37
- sovereign/utils/eds.py,sha256=3NwvQpFMxeWJ8pT1XhzqikrgT26HjObms4Ieh3hivOM,3894
37
+ sovereign/utils/eds.py,sha256=sCEDj1y-0Crs40cHZLiPGVb7ed1f8vFqgHLY5R2LMbw,4377
38
38
  sovereign/utils/entry_point_loader.py,sha256=BEVodk-um70RvT1nSOu_IB-hr1K4ppthXod0VZEiZJ8,526
39
39
  sovereign/utils/mock.py,sha256=s2LS8RzGjwIqsgDPQnpQs6W39hehq88II0dOefvoq0w,1342
40
40
  sovereign/utils/resources.py,sha256=rPrWgcIt4YhV-Dz88_kr5WrQNiSKt-jTlOZ8EIJxJx8,472
@@ -48,8 +48,8 @@ sovereign/views/crypto.py,sha256=nxp6bkPU9GZw_zOk0fsJdz_XRQPXxPI6cXQDL9-cigU,204
48
48
  sovereign/views/discovery.py,sha256=DzFfG8fdFHKAZzmWZi9YzFP2PYLCf3tPlEAY3udNyNg,5980
49
49
  sovereign/views/healthchecks.py,sha256=_WkMunlrFpqGTLgtNtRr7gCsDCv5kiuYxCyTi-dMEKM,1357
50
50
  sovereign/views/interface.py,sha256=Y2fbR26cSF8eKQHfTbnv5WKEdgqaGNwys0lEGUTjXqw,7041
51
- sovereign-0.24.4.dist-info/LICENSE.txt,sha256=2X125zvAb9AYLjCgdMDQZuufhm0kwcg31A8pGKj_-VY,560
52
- sovereign-0.24.4.dist-info/METADATA,sha256=LqqpmlxRdURu6o4bvIiNo_0_zOWbD4hWsck8Fpn0HDY,6420
53
- sovereign-0.24.4.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
54
- sovereign-0.24.4.dist-info/entry_points.txt,sha256=kOn848ucVbNvtsGABDuwzOHmNiOb0Ey8dV85Z3dLv3Y,222
55
- sovereign-0.24.4.dist-info/RECORD,,
51
+ sovereign-0.24.6.dist-info/LICENSE.txt,sha256=2X125zvAb9AYLjCgdMDQZuufhm0kwcg31A8pGKj_-VY,560
52
+ sovereign-0.24.6.dist-info/METADATA,sha256=g_JPBObGtgSbJgimhZdP_3Q9dS6gKZ_E__KiTcgFSKc,6420
53
+ sovereign-0.24.6.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
54
+ sovereign-0.24.6.dist-info/entry_points.txt,sha256=kOn848ucVbNvtsGABDuwzOHmNiOb0Ey8dV85Z3dLv3Y,222
55
+ sovereign-0.24.6.dist-info/RECORD,,