qontract-reconcile 0.10.1rc1170__py3-none-any.whl → 0.10.1rc1172__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.1rc1170
3
+ Version: 0.10.1rc1172
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
@@ -161,7 +161,7 @@ reconcile/aws_version_sync/merge_request_manager/merge_request_manager.py,sha256
161
161
  reconcile/change_owners/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
162
162
  reconcile/change_owners/approver.py,sha256=Z3_11vnK2WNOxjEEXVDh0224-_-qbt9d6mBeVE-7fsc,2259
163
163
  reconcile/change_owners/bundle.py,sha256=h30fU-JmLH5a-rCAovpzTeTkkkgZztsZ5A2raee0YuU,5355
164
- reconcile/change_owners/change_log_tracking.py,sha256=JzUmW6m_qg43r0a6WI__YX8-j_ejt1peIy6CkZJfZTg,9049
164
+ reconcile/change_owners/change_log_tracking.py,sha256=Mw8fuRmMYOEE4qfHJV5fbIjYjVsBw0WCWkIPMfkesMc,9137
165
165
  reconcile/change_owners/change_owners.py,sha256=0HRJhDm0oW3uYJFgzynqA1gA0lbhalhSkmWOiQmr-NM,17062
166
166
  reconcile/change_owners/change_types.py,sha256=YFqykx1I71wcUHEK_eDqPjEeQpPVV4bjqT9W3LgqNFw,32073
167
167
  reconcile/change_owners/changes.py,sha256=o4vylcFhu75hltJDghadm2qkpTXyMGiDeEw-jxl7pLI,18226
@@ -196,13 +196,13 @@ reconcile/external_resources/aws.py,sha256=309Zui7rE8XFJA1ZBLupl55Vp8Y5KKgXdsKQW
196
196
  reconcile/external_resources/factories.py,sha256=KrJDh52_8PeCEVjwfeVr1jwAJDdhMXRQ_XcBETfnKY4,4988
197
197
  reconcile/external_resources/integration.py,sha256=gBVO5dE8JyZ3xYcYik-MTIp_18oU7_hpYc_oztyfElQ,6753
198
198
  reconcile/external_resources/integration_secrets_sync.py,sha256=dX09O3r6KURziUYYfiki10orNjOGVma-XojhVqd0ww4,1667
199
- reconcile/external_resources/manager.py,sha256=tgHOFvP-dcPLLIhcjMn6EIELTBCycbXFNAuS-NX7l2s,17929
199
+ reconcile/external_resources/manager.py,sha256=7x3X4UUTpf8g3GAXF5BvY0Ba88m3kGFmB-eaqmP2j68,17776
200
200
  reconcile/external_resources/meta.py,sha256=noaytFzmShpzLA_ebGh7wuP45mOfHIOnnoUxivjDa1I,672
201
201
  reconcile/external_resources/metrics.py,sha256=nMbyonGZEJDD1lYzpQY2eR9TNwvxYC4ZCcpi6wrExcM,1037
202
202
  reconcile/external_resources/model.py,sha256=H3elpiqehg_jACy28fGV5_77n8gKclVO77-7cfbaMNA,9178
203
203
  reconcile/external_resources/reconciler.py,sha256=Lhzg0O9Sw65KrCae-J14g9PV82xdp29O4jS_T5YNgEY,9661
204
204
  reconcile/external_resources/secrets_sync.py,sha256=6n0oDPLjd9Ql0lf6zsr1AZw8A6EEe3yCzl20XodtgkE,16229
205
- reconcile/external_resources/state.py,sha256=UupSa6tl4-73_J6Fhisn-qHal3v3uAUS5s5sk85LGDs,9343
205
+ reconcile/external_resources/state.py,sha256=z086bnIUTOkzFmQvS9rSAhFsM3Aw_9PLKHBACJ-0tQc,9690
206
206
  reconcile/glitchtip/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
207
207
  reconcile/glitchtip/integration.py,sha256=XtewM9nfTPLnPSpYebP50GrveYOnhTvKNq3seSvL6u8,8343
208
208
  reconcile/glitchtip/reconciler.py,sha256=nUvDv7qG1ly0cA16MmlL6NV71yl1mJYLT2mui7lmi0Y,12402
@@ -880,8 +880,8 @@ tools/test/test_qontract_cli.py,sha256=iuzKbQ6ahinvjoQmQLBrG4shey0z-1rB6qCgS8T6d
880
880
  tools/test/test_saas_promotion_state.py,sha256=dy4kkSSAQ7bC0Xp2CociETGN-2aABEfL6FU5D9Jl00Y,6056
881
881
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
882
882
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
883
- qontract_reconcile-0.10.1rc1170.dist-info/METADATA,sha256=jImSzLQtbCTK_xWaoXSosEFCUSEwNc55O8fQkGPhaxA,2213
884
- qontract_reconcile-0.10.1rc1170.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
885
- qontract_reconcile-0.10.1rc1170.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
886
- qontract_reconcile-0.10.1rc1170.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
887
- qontract_reconcile-0.10.1rc1170.dist-info/RECORD,,
883
+ qontract_reconcile-0.10.1rc1172.dist-info/METADATA,sha256=VURbPodqYl3iXjbLU02eZ9mX9amA9vN-zsDGQrCDvk0,2213
884
+ qontract_reconcile-0.10.1rc1172.dist-info/WHEEL,sha256=bFJAMchF8aTQGUgMZzHJyDDMPTO3ToJ7x23SLJa1SVo,92
885
+ qontract_reconcile-0.10.1rc1172.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
886
+ qontract_reconcile-0.10.1rc1172.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
887
+ qontract_reconcile-0.10.1rc1172.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.44.0)
2
+ Generator: bdist_wheel (0.45.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -40,6 +40,7 @@ class ChangeLogItem:
40
40
  change_types: list[str] = field(default_factory=list)
41
41
  error: bool = False
42
42
  apps: list[str] = field(default_factory=list)
43
+ description: str = ""
43
44
 
44
45
 
45
46
  @dataclass
@@ -136,6 +137,7 @@ class ChangeLogIntegration(QontractReconcileIntegration[ChangeLogIntegrationPara
136
137
  change_log_item = ChangeLogItem(
137
138
  commit=commit,
138
139
  merged_at=merged_at,
140
+ description=gl_commit.message.split("\n")[2],
139
141
  )
140
142
  change_log.items.append(change_log_item)
141
143
  obj = diff_state.get(key, None)
@@ -93,14 +93,6 @@ class ReconciliationStatus(BaseModel):
93
93
  reconcile_time: int = 0
94
94
  resource_status: ResourceStatus
95
95
 
96
- @property
97
- def has_errors(self) -> bool:
98
- return self.resource_status == ResourceStatus.ERROR
99
-
100
- @property
101
- def needs_secret_sync(self) -> bool:
102
- return self.resource_status == ResourceStatus.PENDING_SECRET_SYNC
103
-
104
96
  def publish_metrics(self, r: Reconciliation, spec: ExternalResourceSpec) -> None:
105
97
  job_name = ReconciliationK8sJob(reconciliation=r).name()
106
98
 
@@ -133,7 +125,7 @@ class ReconciliationStatus(BaseModel):
133
125
  self.reconcile_time,
134
126
  )
135
127
 
136
- if self.has_errors:
128
+ if self.resource_status.has_errors:
137
129
  metrics.inc_counter(
138
130
  ExternalResourcesReconcileErrorsCounter(
139
131
  app=spec.namespace["app"]["name"],
@@ -277,29 +269,22 @@ class ExternalResourcesManager:
277
269
  r: Reconciliation,
278
270
  state: ExternalResourceState,
279
271
  ) -> ReconciliationStatus:
280
- """Gets the resource reconciliation state from the Job and updates the
281
- Resource state accordingly. It also returns if the target outputs secret needs
282
- to be reconciled.
283
-
272
+ """Gets the reconciliation job status and returns a ReconciliationStatus object with the new
273
+ resource status and other reconciliation data.
284
274
  :param r: Reconciliation object
285
275
  :param state: State object
286
276
  :return: ReconciliationStatus
287
277
  """
288
278
 
289
279
  status = ReconciliationStatus(resource_status=state.resource_status)
290
-
291
- if state.resource_status not in {
292
- ResourceStatus.DELETE_IN_PROGRESS,
293
- ResourceStatus.IN_PROGRESS,
294
- }:
280
+ if not state.resource_status.is_in_progress:
281
+ logging.info(
282
+ "Reconciliation In progress. Action: %s, Key:%s",
283
+ state.reconciliation.action,
284
+ state.reconciliation.key,
285
+ )
295
286
  return status
296
287
 
297
- logging.info(
298
- "Reconciliation In progress. Action: %s, Key:%s",
299
- state.reconciliation.action,
300
- state.reconciliation.key,
301
- )
302
-
303
288
  # Need to check the reconciliation set in the state, not the desired one
304
289
  # as the reconciliation object might be from a previous desired state
305
290
  status.resource_status = state.resource_status
@@ -339,20 +324,21 @@ class ExternalResourcesManager:
339
324
  self,
340
325
  r: Reconciliation,
341
326
  state: ExternalResourceState,
342
- status: ReconciliationStatus,
327
+ reconciliation_status: ReconciliationStatus,
343
328
  ) -> None:
344
- # There is no need to update the state
345
- # if it's marked in progress
346
- if state.resource_status in {
347
- ResourceStatus.DELETE_IN_PROGRESS,
348
- ResourceStatus.IN_PROGRESS,
349
- }:
329
+ if (
330
+ state.resource_status.is_in_progress
331
+ and reconciliation_status.resource_status.is_in_progress
332
+ ):
333
+ logging.debug(
334
+ "Reconciliation is still in progress. There is no need to update the state"
335
+ )
350
336
  return
351
337
  state.ts = datetime.now(UTC)
352
- if status.resource_status == ResourceStatus.DELETED:
338
+ if reconciliation_status.resource_status == ResourceStatus.DELETED:
353
339
  self.state_mgr.del_external_resource_state(r.key)
354
340
  else:
355
- state.resource_status = status.resource_status
341
+ state.resource_status = reconciliation_status.resource_status
356
342
  self.state_mgr.set_external_resource_state(state)
357
343
 
358
344
  def _set_resource_reconciliation_in_progress(
@@ -416,10 +402,10 @@ class ExternalResourcesManager:
416
402
  to_sync_keys: set[ExternalResourceKey] = set()
417
403
  for r in desired_r.union(deleted_r):
418
404
  state = self.state_mgr.get_external_resource_state(r.key)
419
- status = self._get_reconciliation_status(r, state)
420
- self._update_resource_state(r, state, status)
405
+ reconciliation_status = self._get_reconciliation_status(r, state)
406
+ self._update_resource_state(r, state, reconciliation_status)
421
407
 
422
- if status.needs_secret_sync:
408
+ if reconciliation_status.resource_status.needs_secret_sync:
423
409
  to_sync_keys.add(r.key)
424
410
 
425
411
  if self._resource_needs_reconciliation(reconciliation=r, state=state):
@@ -427,7 +413,7 @@ class ExternalResourcesManager:
427
413
  self._set_resource_reconciliation_in_progress(r, state)
428
414
 
429
415
  if spec := self.er_inventory.get(r.key):
430
- status.publish_metrics(r, spec)
416
+ reconciliation_status.publish_metrics(r, spec)
431
417
 
432
418
  pending_sync_keys = self.state_mgr.get_keys_by_status(
433
419
  ResourceStatus.PENDING_SECRET_SYNC
@@ -38,6 +38,18 @@ class ResourceStatus(StrEnum):
38
38
  PENDING_SECRET_SYNC: str = "PENDING_SECRET_SYNC"
39
39
  RECONCILIATION_REQUESTED: str = "RECONCILIATION_REQUESTED"
40
40
 
41
+ @property
42
+ def is_in_progress(self) -> bool:
43
+ return self in {ResourceStatus.IN_PROGRESS, ResourceStatus.DELETE_IN_PROGRESS}
44
+
45
+ @property
46
+ def needs_secret_sync(self) -> bool:
47
+ return self == ResourceStatus.PENDING_SECRET_SYNC
48
+
49
+ @property
50
+ def has_errors(self) -> bool:
51
+ return self == ResourceStatus.ERROR
52
+
41
53
 
42
54
  class ExternalResourceState(BaseModel):
43
55
  key: ExternalResourceKey