qontract-reconcile 0.10.1rc1023__py3-none-any.whl → 0.10.1rc1025__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.1rc1023
3
+ Version: 0.10.1rc1025
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
@@ -186,7 +186,7 @@ reconcile/dynatrace_token_provider/metrics.py,sha256=xiKkl8fTEBQaXJelGCPNTZhHAWd
186
186
  reconcile/dynatrace_token_provider/model.py,sha256=gkpqo5rRRueBXnIMjp4EEHqBUBuU65TRI8zpdb8GJ0A,241
187
187
  reconcile/dynatrace_token_provider/ocm.py,sha256=iHMsgbsLs-dlrB9UXmWNDF7E4UDe49JOsLa9rnowKfo,4282
188
188
  reconcile/endpoints_discovery/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
189
- reconcile/endpoints_discovery/integration.py,sha256=OFdSno8C5VVOoXALI5BFxHA3hfIhTZ55lJaMa0jLt0s,12210
189
+ reconcile/endpoints_discovery/integration.py,sha256=dnZ42vrrc3q3-EDO7qE5HVjwHrnpb4_2O_QhFhi8Q-U,12333
190
190
  reconcile/endpoints_discovery/merge_request.py,sha256=NktpwMUoQ9TvBzOeHSPC09OqxWmgZBZVy-Eqmsm_vrA,2909
191
191
  reconcile/endpoints_discovery/merge_request_manager.py,sha256=oY3lovy5DcUgHNEDzWrbOPabzZtaGMns6YLl5ipZJ0c,6346
192
192
  reconcile/external_resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -194,10 +194,10 @@ reconcile/external_resources/aws.py,sha256=JvjKaABy2Pg8u8Lq82Acv4zMvpE3_qGKes7OG
194
194
  reconcile/external_resources/factories.py,sha256=DXgaLxoO87zZ76VOpRpu2GeYGhsbfOnOx5mrzgo4Gf4,4767
195
195
  reconcile/external_resources/integration.py,sha256=y1gJ16woMBC3J9qniMmS5y3lCkAs7V_ETZRUwjKqaO0,6628
196
196
  reconcile/external_resources/integration_secrets_sync.py,sha256=cMEZhgCvABAMf-DWF051L6CRnJQdfbsISA_b1xuS940,1670
197
- reconcile/external_resources/manager.py,sha256=xVwcFAPFG0HyMl_uzj8D6XXdH-Zmcw541DX0IHs57Jc,15278
198
- reconcile/external_resources/meta.py,sha256=cMT9OsKcUY26qwEjlQ02EkorvOBNqWj0JVMwfJa3Mg0,634
197
+ reconcile/external_resources/manager.py,sha256=Q1l53Q0QHS7dvxCU66_BBpWLpNf6he0FfNzxVKJmVN8,15102
198
+ reconcile/external_resources/meta.py,sha256=noaytFzmShpzLA_ebGh7wuP45mOfHIOnnoUxivjDa1I,672
199
199
  reconcile/external_resources/metrics.py,sha256=m2TIOao2N7pD6k45driFbBGVCC_N7ai44m-lLPfa5qk,454
200
- reconcile/external_resources/model.py,sha256=oXxJkjhV53lwwAuxUCBrjJ8aCJmQdgcKWv68ugJPK4k,7229
200
+ reconcile/external_resources/model.py,sha256=RjGMHgt_J1_HQjfBodFGvdWpYKJupKB4xtWuggSnMtA,8270
201
201
  reconcile/external_resources/reconciler.py,sha256=E50X_lnOD0OWYXMzyZld1P6dCFJFYjHGyICWff9bxlc,9323
202
202
  reconcile/external_resources/secrets_sync.py,sha256=6n0oDPLjd9Ql0lf6zsr1AZw8A6EEe3yCzl20XodtgkE,16229
203
203
  reconcile/external_resources/state.py,sha256=fKU6PLYOZ2ZTaIwvt1BNlNOnIqcewLijOyT3Lgcd1NE,9677
@@ -288,8 +288,8 @@ reconcile/gql_definitions/endpoints_discovery/__init__.py,sha256=47DEQpj8HBSa-_T
288
288
  reconcile/gql_definitions/endpoints_discovery/namespaces.py,sha256=FqJ0H7NdsIm5BgVnuJV9wLcj7i667VhCN559tWJ-WsA,3054
289
289
  reconcile/gql_definitions/external_resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
290
290
  reconcile/gql_definitions/external_resources/aws_accounts.py,sha256=XR69j9dpTQ0gv8y-AZN7AJ0dPvO-wbHscyCDgrax6Bk,2046
291
- reconcile/gql_definitions/external_resources/external_resources_modules.py,sha256=g2KB2wRnb8zF7xCmDJJFmiRdE4z4aYa9HtY3vCBVwMA,2441
292
- reconcile/gql_definitions/external_resources/external_resources_namespaces.py,sha256=pXx58C8a2TfClsPqdRmRlQ3ILAX7Irnz-Ank8C8N_gM,40994
291
+ reconcile/gql_definitions/external_resources/external_resources_modules.py,sha256=HFOQjmNbNxk0j5nChxppQeCnJjeDsqibJkPgA7R1zRw,2417
292
+ reconcile/gql_definitions/external_resources/external_resources_namespaces.py,sha256=uNk0HOAH96qdLuDBE6VzjcIPB--PHvOLDitJ2IzPM40,41618
293
293
  reconcile/gql_definitions/external_resources/external_resources_settings.py,sha256=Hw9n_90BPG6Lnt2PT3mHc6p0KEm2CxKxvSGRFc_Dhus,2982
294
294
  reconcile/gql_definitions/fragments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
295
295
  reconcile/gql_definitions/fragments/aus_organization.py,sha256=uBKbTuBa3CZmTXR5HOcGhRcu2U9kM93KbYmoWTxcpB0,4767
@@ -668,7 +668,7 @@ reconcile/utils/environ.py,sha256=psk07d2xyjbUzjOCDdNWgavaNolL_t2sq3sn2gFfY9k,50
668
668
  reconcile/utils/exceptions.py,sha256=DwfnWUpVOotpP79RWZ2pycmG6nKCL00RBIeZLYkQPW4,635
669
669
  reconcile/utils/expiration.py,sha256=3JaXH4psksR7z262k7FmdyREjCLqm66OpVMEbcfdWRo,1213
670
670
  reconcile/utils/extended_early_exit.py,sha256=QSktrmfw37zSRMNk930tDbQsVeKxaPPPD43e79DGwZw,6754
671
- reconcile/utils/external_resource_spec.py,sha256=3z3Y2JGY8cO7hPc8JHkdczmrP81D7TKQ4uT128WhE_M,7006
671
+ reconcile/utils/external_resource_spec.py,sha256=bhH_xneFwATdFumTPkiQmcVKYI0gcaWuqV6FpFdf_P0,7006
672
672
  reconcile/utils/external_resources.py,sha256=ObBOGBRTsDQ2s9rojfeUfFMoR8ls4Kg-AnpsyF6m7u8,7539
673
673
  reconcile/utils/filtering.py,sha256=S4PbMHuFr3ED0P2Q_ea5CAaB7FimI62B-F5YTaKrphA,402
674
674
  reconcile/utils/git.py,sha256=JkpbUO10oBTtNHZ1IhjyG6dTOUizc7I5H0vm7NvDVNw,1409
@@ -834,7 +834,7 @@ tools/app_interface_metrics_exporter.py,sha256=zkwkxdAUAxjdc-pzx2_oJXG25fo0Fnyd5
834
834
  tools/app_interface_reporter.py,sha256=1ZP58LYV6ww3XOLVxgy8NKasMb1jQmp4BNqzTEB0VBE,17723
835
835
  tools/glitchtip_access_reporter.py,sha256=oPBnk_YoDuljU3v0FaChzOwwnk4vap1xEE67QEjzdqs,2948
836
836
  tools/glitchtip_access_revalidation.py,sha256=8kbBJk04mkq28kWoRDDkfCGIF3GRg3pJrFAh1sW0dbk,2821
837
- tools/qontract_cli.py,sha256=bFTYOymVksNKp_ntG2l9GoA40tODuxeRDU3rO4J-CjA,128875
837
+ tools/qontract_cli.py,sha256=8HbIKtepnmoQteb9Q31iJXFG7_y2o_g6JEkIhXnoncM,128916
838
838
  tools/sd_app_sre_alert_report.py,sha256=e9vAdyenUz2f5c8-z-5WY0wv-SJ9aePKDH2r4IwB6pc,5063
839
839
  tools/template_validation.py,sha256=qpKYaTgk0GOPGa2Ct5_5sKdwIHtCAKIBGzsMPuJU5fw,3371
840
840
  tools/cli_commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -865,8 +865,8 @@ tools/test/test_qontract_cli.py,sha256=_D61RFGAN5x44CY1tYbouhlGXXABwYfxKSWSQx3Jr
865
865
  tools/test/test_saas_promotion_state.py,sha256=dy4kkSSAQ7bC0Xp2CociETGN-2aABEfL6FU5D9Jl00Y,6056
866
866
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
867
867
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
868
- qontract_reconcile-0.10.1rc1023.dist-info/METADATA,sha256=95lGKHZNgD5yHqqGO71hefbNr2QuHpG0K7kW7B1VI9c,2213
869
- qontract_reconcile-0.10.1rc1023.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
870
- qontract_reconcile-0.10.1rc1023.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
871
- qontract_reconcile-0.10.1rc1023.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
872
- qontract_reconcile-0.10.1rc1023.dist-info/RECORD,,
868
+ qontract_reconcile-0.10.1rc1025.dist-info/METADATA,sha256=dUsRqkEgrR_aSPJqnY-4retmHRgWmF0hqlNW9n8MXQA,2213
869
+ qontract_reconcile-0.10.1rc1025.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
870
+ qontract_reconcile-0.10.1rc1025.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
871
+ qontract_reconcile-0.10.1rc1025.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
872
+ qontract_reconcile-0.10.1rc1025.dist-info/RECORD,,
@@ -221,6 +221,9 @@ class EndpointsDiscoveryIntegration(
221
221
  """Compile a list of apps with their endpoints to add, change and delete."""
222
222
  apps: dict[str, App] = {}
223
223
  for namespace in namespaces:
224
+ logging.debug(
225
+ f"Processing namespace {namespace.cluster.name}/{namespace.name}"
226
+ )
224
227
  routes = self.get_routes(oc_map, namespace)
225
228
  endpoints_to_add, endpoints_to_change, endpoints_to_delete = (
226
229
  self.get_endpoint_changes(
@@ -41,9 +41,6 @@ from reconcile.utils.external_resource_spec import (
41
41
  )
42
42
  from reconcile.utils.secret_reader import SecretReaderBase
43
43
 
44
- FLAG_RESOURCE_MANAGED_BY_ERV2 = "managed_by_erv2"
45
- FLAG_DELETE_RESOURCE = "delete"
46
-
47
44
 
48
45
  def setup_factories(
49
46
  settings: ExternalResourcesSettingsV1,
@@ -323,9 +320,7 @@ class ExternalResourcesManager:
323
320
  return resource
324
321
 
325
322
  def _serialize_resource_input(self, resource: ExternalResource) -> str:
326
- return resource.json(
327
- exclude={"data": {FLAG_RESOURCE_MANAGED_BY_ERV2, FLAG_DELETE_RESOURCE}}
328
- )
323
+ return resource.json()
329
324
 
330
325
  def handle_resources(self) -> None:
331
326
  desired_r = self._get_desired_objects_reconciliations()
@@ -14,3 +14,4 @@ SECRET_UPDATED_AT_TIMEFORMAT = "%Y-%m-%dT%H:%M:%SZ"
14
14
 
15
15
  FLAG_RESOURCE_MANAGED_BY_ERV2 = "managed_by_erv2"
16
16
  FLAG_DELETE_RESOURCE = "delete"
17
+ MODULE_OVERRIDES = "module_overrides"
@@ -13,13 +13,18 @@ from typing import Any
13
13
 
14
14
  from pydantic import BaseModel
15
15
 
16
+ from reconcile.external_resources.meta import (
17
+ FLAG_DELETE_RESOURCE,
18
+ FLAG_RESOURCE_MANAGED_BY_ERV2,
19
+ MODULE_OVERRIDES,
20
+ )
16
21
  from reconcile.gql_definitions.external_resources.external_resources_modules import (
17
22
  ExternalResourcesModuleV1,
18
23
  )
19
24
  from reconcile.gql_definitions.external_resources.external_resources_namespaces import (
25
+ ExternalResourcesModuleOverridesV1,
20
26
  NamespaceTerraformProviderResourceAWSV1,
21
27
  NamespaceTerraformResourceRDSV1,
22
- NamespaceTerraformResourceRoleV1,
23
28
  NamespaceV1,
24
29
  )
25
30
  from reconcile.utils.exceptions import FetchResourceError
@@ -60,30 +65,48 @@ class ExternalResourceKey(BaseModel, frozen=True):
60
65
  return f"{self.provision_provider}/{self.provisioner_name}/{self.provider}/{self.identifier}"
61
66
 
62
67
 
68
+ SUPPORTED_RESOURCE_PROVIDERS = NamespaceTerraformProviderResourceAWSV1
69
+ SUPPORTED_RESOURCE_TYPES = NamespaceTerraformResourceRDSV1
70
+
71
+
63
72
  class ExternalResourcesInventory(MutableMapping):
64
73
  _inventory: dict[ExternalResourceKey, ExternalResourceSpec] = {}
65
74
 
75
+ def _build_external_resource_spec(
76
+ self,
77
+ namespace: NamespaceV1,
78
+ provider: SUPPORTED_RESOURCE_PROVIDERS,
79
+ resource: SUPPORTED_RESOURCE_TYPES,
80
+ ) -> ExternalResourceSpec:
81
+ spec = ExternalResourceSpec(
82
+ provision_provider=provider.provider,
83
+ provisioner=provider.provisioner.dict(),
84
+ resource=resource.dict(
85
+ exclude={
86
+ FLAG_RESOURCE_MANAGED_BY_ERV2,
87
+ FLAG_DELETE_RESOURCE,
88
+ MODULE_OVERRIDES,
89
+ }
90
+ ),
91
+ namespace=namespace.dict(),
92
+ )
93
+ spec.metadata[FLAG_DELETE_RESOURCE] = resource.delete
94
+ spec.metadata[MODULE_OVERRIDES] = resource.module_overrides
95
+ return spec
96
+
66
97
  def __init__(self, namespaces: Iterable[NamespaceV1]) -> None:
67
98
  desired_providers = [
68
99
  (p, ns)
69
100
  for ns in namespaces
70
101
  for p in ns.external_resources or []
71
- if isinstance(p, NamespaceTerraformProviderResourceAWSV1) and p.resources
102
+ if isinstance(p, SUPPORTED_RESOURCE_PROVIDERS) and p.resources
72
103
  ]
73
104
 
74
105
  desired_specs = [
75
- ExternalResourceSpec(
76
- provision_provider=p.provider,
77
- provisioner=p.provisioner.dict(),
78
- resource=r.dict(),
79
- namespace=ns.dict(),
80
- )
106
+ self._build_external_resource_spec(ns, p, r)
81
107
  for (p, ns) in desired_providers
82
108
  for r in p.resources
83
- if isinstance(
84
- r, NamespaceTerraformResourceRDSV1 | NamespaceTerraformResourceRoleV1
85
- )
86
- and r.managed_by_erv2
109
+ if isinstance(r, SUPPORTED_RESOURCE_TYPES) and r.managed_by_erv2
87
110
  ]
88
111
 
89
112
  for spec in desired_specs:
@@ -181,14 +204,22 @@ class ExternalResourceModuleConfiguration(BaseModel, frozen=True):
181
204
  def resolve_configuration(
182
205
  module: ExternalResourcesModuleV1, spec: ExternalResourceSpec
183
206
  ) -> "ExternalResourceModuleConfiguration":
184
- # TODO: Modify resource schemas to include this attributes
185
- data = {
186
- "image": module.image,
187
- "version": module.default_version,
188
- "reconcile_drift_interval_minutes": module.reconcile_drift_interval_minutes,
189
- "reconcile_timeout_minutes": module.reconcile_timeout_minutes,
190
- }
191
- return ExternalResourceModuleConfiguration.parse_obj(data)
207
+ module_overrides = spec.metadata.get(
208
+ "module_overrides"
209
+ ) or ExternalResourcesModuleOverridesV1(
210
+ module_type=None,
211
+ image=None,
212
+ version=None,
213
+ reconcile_timeout_minutes=None,
214
+ )
215
+
216
+ return ExternalResourceModuleConfiguration(
217
+ image=module_overrides.image or module.image,
218
+ version=module_overrides.version or module.version,
219
+ reconcile_drift_interval_minutes=module.reconcile_drift_interval_minutes,
220
+ reconcile_timeout_minutes=module_overrides.reconcile_timeout_minutes
221
+ or module.reconcile_timeout_minutes,
222
+ )
192
223
 
193
224
 
194
225
  class Reconciliation(BaseModel, frozen=True):
@@ -25,7 +25,7 @@ query ExternalResourcesModules {
25
25
  provider
26
26
  module_type
27
27
  image
28
- default_version
28
+ version
29
29
  reconcile_drift_interval_minutes
30
30
  reconcile_timeout_minutes
31
31
  outputs_secret_sync
@@ -45,9 +45,9 @@ class ExternalResourcesModuleV1(ConfiguredBaseModel):
45
45
  provider: str = Field(..., alias="provider")
46
46
  module_type: str = Field(..., alias="module_type")
47
47
  image: str = Field(..., alias="image")
48
- default_version: str = Field(..., alias="default_version")
49
- reconcile_drift_interval_minutes: str = Field(..., alias="reconcile_drift_interval_minutes")
50
- reconcile_timeout_minutes: str = Field(..., alias="reconcile_timeout_minutes")
48
+ version: str = Field(..., alias="version")
49
+ reconcile_drift_interval_minutes: int = Field(..., alias="reconcile_drift_interval_minutes")
50
+ reconcile_timeout_minutes: int = Field(..., alias="reconcile_timeout_minutes")
51
51
  outputs_secret_sync: bool = Field(..., alias="outputs_secret_sync")
52
52
 
53
53
 
@@ -109,6 +109,12 @@ query ExternalResourcesNamespaces {
109
109
  }
110
110
  managed_by_erv2
111
111
  delete
112
+ module_overrides {
113
+ module_type
114
+ image
115
+ version
116
+ reconcile_timeout_minutes
117
+ }
112
118
  }
113
119
  ... on NamespaceTerraformResourceS3_v1 {
114
120
  region
@@ -535,6 +541,13 @@ class AWSRDSDataClassificationV1(ConfiguredBaseModel):
535
541
  loss_impact: Optional[str] = Field(..., alias="loss_impact")
536
542
 
537
543
 
544
+ class ExternalResourcesModuleOverridesV1(ConfiguredBaseModel):
545
+ module_type: Optional[str] = Field(..., alias="module_type")
546
+ image: Optional[str] = Field(..., alias="image")
547
+ version: Optional[str] = Field(..., alias="version")
548
+ reconcile_timeout_minutes: Optional[int] = Field(..., alias="reconcile_timeout_minutes")
549
+
550
+
538
551
  class NamespaceTerraformResourceRDSV1(NamespaceTerraformResourceAWSV1):
539
552
  region: Optional[str] = Field(..., alias="region")
540
553
  identifier: str = Field(..., alias="identifier")
@@ -554,6 +567,7 @@ class NamespaceTerraformResourceRDSV1(NamespaceTerraformResourceAWSV1):
554
567
  data_classification: Optional[AWSRDSDataClassificationV1] = Field(..., alias="data_classification")
555
568
  managed_by_erv2: Optional[bool] = Field(..., alias="managed_by_erv2")
556
569
  delete: Optional[bool] = Field(..., alias="delete")
570
+ module_overrides: Optional[ExternalResourcesModuleOverridesV1] = Field(..., alias="module_overrides")
557
571
 
558
572
 
559
573
  class AWSS3EventNotificationV1(ConfiguredBaseModel):
@@ -88,13 +88,13 @@ class ExternalResourceSpec:
88
88
  secret: Mapping[str, str] = field(init=False, default_factory=lambda: {})
89
89
  # Metadata is used for processing data that shuold not be included in the secret data
90
90
  # e.g: ERV2 adds a updated_at attribute that acts as optimistic lock.
91
- metadata: MutableMapping[str, str] = field(
91
+ metadata: MutableMapping[str, Any] = field(
92
92
  init=False, compare=False, repr=False, hash=False, default_factory=lambda: {}
93
93
  )
94
94
 
95
95
  @property
96
96
  def marked_to_delete(self) -> bool:
97
- return self.resource.get("delete") or False
97
+ return self.metadata.get("delete") or False
98
98
 
99
99
  @property
100
100
  def provider(self) -> str:
tools/qontract_cli.py CHANGED
@@ -60,9 +60,9 @@ from reconcile.external_resources.integration import (
60
60
  get_aws_api,
61
61
  )
62
62
  from reconcile.external_resources.manager import (
63
- FLAG_RESOURCE_MANAGED_BY_ERV2,
64
63
  setup_factories,
65
64
  )
65
+ from reconcile.external_resources.meta import FLAG_RESOURCE_MANAGED_BY_ERV2
66
66
  from reconcile.external_resources.model import (
67
67
  ExternalResourceKey,
68
68
  ExternalResourcesInventory,