sovereign 0.27.0__py3-none-any.whl → 0.28.0__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/discovery.py CHANGED
@@ -163,6 +163,8 @@ def filter_resources(
163
163
  that does not match the name of the resource.
164
164
  If Envoy did not specifically request anything, every resource is retained.
165
165
  """
166
+ if len(requested) == 0:
167
+ return generated
166
168
  return [resource for resource in generated if resource_name(resource) in requested]
167
169
 
168
170
 
sovereign/schemas.py CHANGED
@@ -294,7 +294,9 @@ class Resources(List[str]):
294
294
  """
295
295
 
296
296
  def __contains__(self, item: object) -> bool:
297
- if len(self) == 0:
297
+ if (
298
+ len(self) == 0
299
+ ): # TODO: refactor to remove overriding __contains__; its being used in multiple places
298
300
  return True
299
301
  return super().__contains__(item)
300
302
 
@@ -305,13 +307,17 @@ class Status(BaseModel):
305
307
  details: List[Any]
306
308
 
307
309
 
310
+ def resources_factory() -> Resources:
311
+ return Resources()
312
+
313
+
308
314
  class DiscoveryRequest(BaseModel):
309
315
  node: Node = Field(..., title="Node information about the envoy proxy")
310
316
  version_info: str = Field(
311
317
  "0", title="The version of the envoy clients current configuration"
312
318
  )
313
- resource_names: list[str] | Resources = Field(
314
- Resources(), title="List of requested resource names"
319
+ resource_names: Resources = Field(
320
+ default_factory=resources_factory, title="List of requested resource names"
315
321
  )
316
322
  hide_private_keys: bool = False
317
323
  type_url: Optional[str] = Field(
@@ -353,6 +359,11 @@ class DiscoveryRequest(BaseModel):
353
359
  self.desired_controlplane,
354
360
  )
355
361
 
362
+ @field_validator("resource_names", mode="before")
363
+ @classmethod
364
+ def validate_resources(cls, v: Union[Resources, List[str]]) -> Resources:
365
+ return Resources(v)
366
+
356
367
 
357
368
  class DiscoveryResponse(BaseModel):
358
369
  version_info: str = Field(
@@ -88,14 +88,24 @@
88
88
  1: 'resource'
89
89
  } %}
90
90
  {% for resource in res %}
91
+ {% if "sovereign_error" in resource %}
92
+ <span class="panel-icon">
93
+ <i class="fas fa-arrow-right" aria-hidden="true"></i>
94
+ </span>
95
+ <div class="notification is-danger">
96
+ {{ resource["sovereign_error"] }}
97
+ </div>
98
+ {{ resource["sovereign_error"] }}
99
+ {% else %}
91
100
  {% set name = resource.get('name') or resource['cluster_name'] %}
92
101
  <a class="panel-block has-text-weight-medium"
93
- href="/ui/resources/{{ resource_type }}/{{ name }}">
94
- <span class="panel-icon">
95
- <i class="fas fa-arrow-right" aria-hidden="true"></i>
96
- </span>
97
- {{ name }}
98
- </a>
102
+ href="/ui/resources/{{ resource_type }}/{{ name }}">
103
+ <span class="panel-icon">
104
+ <i class="fas fa-arrow-right" aria-hidden="true"></i>
105
+ </span>
106
+ {{ name }}
107
+ </a>
108
+ {% endif %}
99
109
  {% endfor %}
100
110
  <div class="panel-block">
101
111
  <p class="content is-small">
@@ -103,8 +103,8 @@ async def resources(
103
103
  resource_type=xds_type,
104
104
  skip_auth=True,
105
105
  )
106
- except KeyError:
107
- ret["resources"] = []
106
+ except KeyError as e:
107
+ ret["resources"] = [{"sovereign_error": str(e)}]
108
108
  else:
109
109
  ret["resources"] += response.deserialize_resources()
110
110
  return html_templates.TemplateResponse(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sovereign
3
- Version: 0.27.0
3
+ Version: 0.28.0
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
@@ -4,7 +4,7 @@ sovereign/config_loader.py,sha256=PeaDp_BEU7TsHFdteHWWF8a6TkIkF8z3H7LqkzowcHc,62
4
4
  sovereign/configuration.py,sha256=lZce28KrlNehaWbOJIw-znoyy1pVKM0Gdwrsa236k0c,2482
5
5
  sovereign/constants.py,sha256=qdWD1lTvkaW5JGF7TmZhfksQHlRAJFVqbG7v6JQA9k8,46
6
6
  sovereign/context.py,sha256=NFv9n-T012Ky-P8y1DhiaUGCqa8Kk3IaI0AYcSpmKm4,6951
7
- sovereign/discovery.py,sha256=TPecAoUDHx6SbS5hE2K73uEgDro0Uzz3qsvOQMpFtGI,5899
7
+ sovereign/discovery.py,sha256=KHnWXUlceUglbR9eV5Q6LjPOpGv2dcrGOSus9-QLQJM,5952
8
8
  sovereign/error_info.py,sha256=r2KXBYq9Fo7AI2pmIpATWFm0pykr2MqfrKH0WWW5Sfk,1488
9
9
  sovereign/logging/access_logger.py,sha256=JMMzQvi7doFJGA__YYqyasdfAT9W31Ycu_oZ2ovAMis,2565
10
10
  sovereign/logging/application_logger.py,sha256=VI8EBRv_dB8vvTnSh3n-IaFtVh-GaNN4atjtLJdr2kI,1843
@@ -15,7 +15,7 @@ sovereign/middlewares.py,sha256=UoLdfhqMj_E6jXgtr-n0maQIBYe9n95s3BwaQZfebHo,3097
15
15
  sovereign/modifiers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  sovereign/modifiers/lib.py,sha256=DbXsxrrjnFE4Y7rbwpeiM5tS5w5NBwSdYH58AtDTP0I,2884
17
17
  sovereign/response_class.py,sha256=beMAFV-4L6DwyWzJzy71GkEW4gb7fzH1jd8-Tul13cU,427
18
- sovereign/schemas.py,sha256=MD1ECS3oP1qjIy0fk_EF-WSLEe9rsMHW6vmgPdZ8nwY,29601
18
+ sovereign/schemas.py,sha256=q-Y6xX3YxOM2ADcuafpK0bCgHpGcOQPgUPbLKwqWnCc,29963
19
19
  sovereign/server.py,sha256=z8Uz1UYIZix0S40Srk774WIMDN2jl2SozO8irib0wc4,1402
20
20
  sovereign/sources/__init__.py,sha256=g9hEpFk8j5i1ApHQpbc9giTyJW41Ppgsqv5P9zGxOJk,78
21
21
  sovereign/sources/file.py,sha256=A4UWoRU39v2Ex5Mtdl_uw53iMkslYylF4CiiwW7LOpk,689
@@ -27,7 +27,7 @@ sovereign/static/style.css,sha256=vG8HPsbCbPIZfHgy7gSeof97Pnp0okkyaXyJzIEEW-8,44
27
27
  sovereign/statistics.py,sha256=Xfj4oWMfCkbYc2ibF7rDUpbw6Zw6dI4N5BpCLDQc4j4,2336
28
28
  sovereign/templates/base.html,sha256=5vw3-NmN291pXRdArpCwhSce9bAYBWCJVRhvO5EmE9g,2296
29
29
  sovereign/templates/err.html,sha256=a3cEzOqyqWOIe3YxfTEjkxbTfxBxq1knD6GwzEFljfs,603
30
- sovereign/templates/resources.html,sha256=NnrnamWg_vJjY88efsMcjNsldg-K9TZnp6tFS5tkZOU,6366
30
+ sovereign/templates/resources.html,sha256=r67x1FeUgczh-0JlwFFu-qG_b2u9t-_P_If9jlKg2ZI,6832
31
31
  sovereign/templates/ul_filter.html,sha256=LrzZv5408Qq5UP4lcHVRwY2G6lXd3IiSNiJn1aH7Yqo,666
32
32
  sovereign/testing/loaders.py,sha256=3jBLqq7ZbUJSOAaX0VjDUlYAWWuJ9xetqkanzeoYiR4,248
33
33
  sovereign/testing/modifiers.py,sha256=7_c2hWXn_sYJ6997N1_uSWtClOikcOzu1yRCY56-l-4,361
@@ -54,9 +54,9 @@ sovereign/views/admin.py,sha256=9jUI3YqaU42AtzCCOCKDcfj_2JXoaMU6eOAD6WYPjoI,4312
54
54
  sovereign/views/crypto.py,sha256=o8NSyiUBy7v1pMOXt_1UBi68FNcGkXSlEVg9C18y8kY,3324
55
55
  sovereign/views/discovery.py,sha256=TVvWTMzWydsC-SNKL9WsSss_Hfnt2Ed4SVC2A8Na7Jo,5932
56
56
  sovereign/views/healthchecks.py,sha256=_WkMunlrFpqGTLgtNtRr7gCsDCv5kiuYxCyTi-dMEKM,1357
57
- sovereign/views/interface.py,sha256=Xi5F36Zn7ATbMtuhlE8f9xTEKj9T7GzHg6XLdb3bQjY,7023
58
- sovereign-0.27.0.dist-info/LICENSE.txt,sha256=2X125zvAb9AYLjCgdMDQZuufhm0kwcg31A8pGKj_-VY,560
59
- sovereign-0.27.0.dist-info/METADATA,sha256=OWJ2XCPs7WEPC4MHBlrBPGJoDOFacAio6irt2l5-oB8,6556
60
- sovereign-0.27.0.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
61
- sovereign-0.27.0.dist-info/entry_points.txt,sha256=T6HkcZHqKSDcK9d23svUU-vt-_DQbSV0SRt4_UtQGEc,289
62
- sovereign-0.27.0.dist-info/RECORD,,
57
+ sovereign/views/interface.py,sha256=TFXbYp5oXZPRkVnAo-NWQFBb8XMtB519FaV78ludCcI,7055
58
+ sovereign-0.28.0.dist-info/LICENSE.txt,sha256=2X125zvAb9AYLjCgdMDQZuufhm0kwcg31A8pGKj_-VY,560
59
+ sovereign-0.28.0.dist-info/METADATA,sha256=R6mLEGv_aFECE_dYbIaKBzfa0CbD6E1a7WBiqbJZFx4,6556
60
+ sovereign-0.28.0.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
61
+ sovereign-0.28.0.dist-info/entry_points.txt,sha256=T6HkcZHqKSDcK9d23svUU-vt-_DQbSV0SRt4_UtQGEc,289
62
+ sovereign-0.28.0.dist-info/RECORD,,