qontract-reconcile 0.10.1rc660__py3-none-any.whl → 0.10.1rc662__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: qontract-reconcile
3
- Version: 0.10.1rc660
3
+ Version: 0.10.1rc662
4
4
  Summary: Collection of tools to reconcile services with their desired state as defined in the app-interface DB.
5
5
  Home-page: https://github.com/app-sre/qontract-reconcile
6
6
  Author: Red Hat App-SRE Team
@@ -616,7 +616,7 @@ reconcile/utils/state.py,sha256=zjsprjbOb0WddzmAvh8ACqAt0fcayrX2YPfz7qceRWw,1609
616
616
  reconcile/utils/structs.py,sha256=LcbLEg8WxfRqM6nW7NhcWN0YeqF7SQzxOgntmLs1SgY,352
617
617
  reconcile/utils/template.py,sha256=wTvRU4AnAV_o042tD4Mwls2dwWMuk7MKnde3MaCjaYg,331
618
618
  reconcile/utils/terraform_client.py,sha256=7L55Rvxfzj3KtJH8AD8D8YRfBnFpHiTFqSa5e2_9jtk,32092
619
- reconcile/utils/terrascript_aws_client.py,sha256=iM5ouzJh8qE7ixsbpo_JIaeJdLau7yBFu6AFeTqFK3M,271964
619
+ reconcile/utils/terrascript_aws_client.py,sha256=tX-dBE8dmvtvZWDGJ0JjTRNx11MIOIhwZJIueOaEYjA,272396
620
620
  reconcile/utils/three_way_diff_strategy.py,sha256=nyqeQsLCoPI6e16k2CF3b9KNgQLU-rPf5RtfdUfVMwE,4468
621
621
  reconcile/utils/throughput.py,sha256=iP4UWAe2LVhDo69mPPmgo9nQ7RxHD6_GS8MZe-aSiuM,344
622
622
  reconcile/utils/unleash.py,sha256=1D56CsZfE3ShDtN3IErE1T2eeIwNmxhK-yYbCotJ99E,3601
@@ -634,6 +634,9 @@ reconcile/utils/aws_api_typed/organization.py,sha256=dJ7J02BNHu7UDyFa9083b92vSam
634
634
  reconcile/utils/aws_api_typed/sts.py,sha256=5Sauncj9Fif3YDLkJYkBZrtOX0v0bGAqOmY0A5Bh9yA,1237
635
635
  reconcile/utils/cloud_resource_best_practice/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
636
636
  reconcile/utils/cloud_resource_best_practice/aws_rds.py,sha256=EvE6XKLsrZ531MJptKqPht2lOETrOjySTHXk6CzMgo0,2279
637
+ reconcile/utils/clusterhealth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
638
+ reconcile/utils/clusterhealth/providerbase.py,sha256=6YmFCw2fbUqgte5wagJsmcM9_gJQabj0dTXKBO0RNJo,1171
639
+ reconcile/utils/clusterhealth/telemeter.py,sha256=a_RDNQMdjELltdeSFAsheK25EEu9ElX48ksLhOOOsvI,1448
637
640
  reconcile/utils/glitchtip/__init__.py,sha256=FT6iBhGqoe7KExFdbgL8AYUb64iW_4snF5__Dcl7yt0,258
638
641
  reconcile/utils/glitchtip/client.py,sha256=uqRK4XL5V2_bQpRyM3XTX8JKCaMpSOCkcm7jmuqYvwU,10584
639
642
  reconcile/utils/glitchtip/models.py,sha256=_oqZXNkyRTsAnx6tF4WUURSBj0cc9UNS4okOQYfAfB4,6435
@@ -720,8 +723,8 @@ tools/test/test_app_interface_metrics_exporter.py,sha256=SX7qL3D1SIRKFo95FoQztvf
720
723
  tools/test/test_qontract_cli.py,sha256=OvalpVRfY4pNmpMaWHHYqBjV68b1eGQjX8SCyTAXb1w,3501
721
724
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
722
725
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
723
- qontract_reconcile-0.10.1rc660.dist-info/METADATA,sha256=dtN7pUdCsIWJSJNGAGjZ5gLutIcmOFCi5Y1mhdeJHsY,2382
724
- qontract_reconcile-0.10.1rc660.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
725
- qontract_reconcile-0.10.1rc660.dist-info/entry_points.txt,sha256=rIxI5zWtHNlfpDeq1a7pZXAPoqf7HG32KMTN3MeWK_8,429
726
- qontract_reconcile-0.10.1rc660.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
727
- qontract_reconcile-0.10.1rc660.dist-info/RECORD,,
726
+ qontract_reconcile-0.10.1rc662.dist-info/METADATA,sha256=xAYklbK2n0Hx1Z9xs0KoH9Y1zbE69OON9UxpfPO0_CU,2382
727
+ qontract_reconcile-0.10.1rc662.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
728
+ qontract_reconcile-0.10.1rc662.dist-info/entry_points.txt,sha256=rIxI5zWtHNlfpDeq1a7pZXAPoqf7HG32KMTN3MeWK_8,429
729
+ qontract_reconcile-0.10.1rc662.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
730
+ qontract_reconcile-0.10.1rc662.dist-info/RECORD,,
File without changes
@@ -0,0 +1,40 @@
1
+ from abc import ABC, abstractmethod
2
+ from typing import Optional
3
+
4
+ from pydantic import BaseModel
5
+
6
+
7
+ class ClusterHealth(BaseModel):
8
+ source: str
9
+ errors: Optional[set[str]] = None
10
+
11
+ def has_health_errors(self) -> bool:
12
+ return bool(self.errors)
13
+
14
+
15
+ def build_assumed_cluster_health() -> ClusterHealth:
16
+ return ClusterHealth(source="assumption")
17
+
18
+
19
+ class ClusterHealthProvider(ABC):
20
+ """
21
+ A base class for cluster health providers.
22
+ """
23
+
24
+ @abstractmethod
25
+ def cluster_health(self, cluster_external_id: str, org_id: str) -> ClusterHealth:
26
+ """
27
+ Provides health information for an individual cluster in an organization
28
+ """
29
+
30
+
31
+ class EmptyClusterHealthProvider(ClusterHealthProvider):
32
+ """
33
+ A default implementation of a cluster health provider that returns no health
34
+ information. Not every environment has a healthprovider available and this
35
+ implementation helps avoiding to check for the existance of a health provider
36
+ in various code places for such environments.
37
+ """
38
+
39
+ def cluster_health(self, cluster_external_id: str, org_id: str) -> ClusterHealth:
40
+ return build_assumed_cluster_health()
@@ -0,0 +1,37 @@
1
+ from functools import lru_cache
2
+
3
+ from reconcile.utils.clusterhealth.providerbase import (
4
+ ClusterHealth,
5
+ ClusterHealthProvider,
6
+ )
7
+ from reconcile.utils.grouping import group_by
8
+ from reconcile.utils.prometheus import PrometheusQuerier
9
+
10
+ TELEMETER_SOURCE = "telemeter"
11
+
12
+
13
+ class TelemeterClusterHealthProvider(ClusterHealthProvider):
14
+ def __init__(self, querier: PrometheusQuerier):
15
+ self.querier = querier
16
+
17
+ @lru_cache(maxsize=None)
18
+ def cluster_health_for_org(self, org_id: str) -> dict[str, ClusterHealth]:
19
+ vectors_by_cluster = group_by(
20
+ self.querier.instant_vector_query(telemeter_alert_query(org_id)),
21
+ lambda v: v.mandatory_label("_id"),
22
+ )
23
+ return {
24
+ cluster_id: ClusterHealth(
25
+ errors={alert.mandatory_label("alertname") for alert in vectors},
26
+ source=TELEMETER_SOURCE,
27
+ )
28
+ for cluster_id, vectors in vectors_by_cluster.items()
29
+ }
30
+
31
+ def cluster_health(self, cluster_external_id: str, org_id: str) -> ClusterHealth:
32
+ health = self.cluster_health_for_org(org_id=org_id).get(cluster_external_id)
33
+ return health or ClusterHealth(source=TELEMETER_SOURCE)
34
+
35
+
36
+ def telemeter_alert_query(organization_id: str) -> str:
37
+ return f'alerts{{alertstate="firing", severity="critical"}} * on (_id) group_left(organization) max(ocm_subscription{{organization="{organization_id}"}}) by (_id, organization)'
@@ -4071,6 +4071,15 @@ class TerrascriptClient: # pylint: disable=too-many-public-methods
4071
4071
  for k, v in cluster_mode.items():
4072
4072
  values[k] = v
4073
4073
  values.pop("availability_zones", None)
4074
+ elif spec.provider == "msk":
4075
+ if ebs_volume_size := values.get("broker_node_group_info", {}).pop(
4076
+ "ebs_volume_size", None
4077
+ ):
4078
+ values["broker_node_group_info"].setdefault(
4079
+ "storage_info", {}
4080
+ ).setdefault("ebs_storage_info", {})[
4081
+ "volume_size"
4082
+ ] = ebs_volume_size
4074
4083
 
4075
4084
  return values
4076
4085