qontract-reconcile 0.10.1rc821__py3-none-any.whl → 0.10.1rc823__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.1rc821
3
+ Version: 0.10.1rc823
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
@@ -13,7 +13,7 @@ reconcile/checkpoint.py,sha256=R2WFXUXLTB4sWMi4GeA4eegsuf_1-Q4vH8M0Toh3Ij4,5036
13
13
  reconcile/cli.py,sha256=UnVVYcG6lqGAhUcXXCUsxw-eVlU4AyHjI5fAE4E_4DQ,101994
14
14
  reconcile/closedbox_endpoint_monitoring_base.py,sha256=SMhkcQqprWvThrIJa3U_3uh5w1h-alleW1QnCJFY4Qw,4909
15
15
  reconcile/cluster_deployment_mapper.py,sha256=2Ah-nu-Mdig0pjuiZl_XLrmVAjYzFjORR3dMlCgkmw0,2352
16
- reconcile/dashdotdb_base.py,sha256=a5aPLVxyqPSbjdB0Ty-uliOtxwvEbbEljHJKxdK3-Zk,4813
16
+ reconcile/dashdotdb_base.py,sha256=R2JuwiXAEYAFiCtnztM_IIr1rtVzPpaWAmgxuDa2FgY,4813
17
17
  reconcile/dashdotdb_cso.py,sha256=FoXrWGpOwXG5jf0eklN84tjJVUAYzKat7rtq_28JMlQ,3672
18
18
  reconcile/dashdotdb_dora.py,sha256=bqQtgTmOmQnjwvOon5YS3py8rrkwP5frUpCgOIQkz8k,17743
19
19
  reconcile/dashdotdb_dvo.py,sha256=YXqpI6fBQAql-ybGI0grj9gWMzmKiAvPE__pNju6obk,8996
@@ -784,7 +784,7 @@ tools/app_interface_metrics_exporter.py,sha256=zkwkxdAUAxjdc-pzx2_oJXG25fo0Fnyd5
784
784
  tools/app_interface_reporter.py,sha256=upA-J-n-HXHKVDINRuMR7vTt-iJvQORKUVi9D3leQto,17738
785
785
  tools/glitchtip_access_reporter.py,sha256=oPBnk_YoDuljU3v0FaChzOwwnk4vap1xEE67QEjzdqs,2948
786
786
  tools/glitchtip_access_revalidation.py,sha256=8kbBJk04mkq28kWoRDDkfCGIF3GRg3pJrFAh1sW0dbk,2821
787
- tools/qontract_cli.py,sha256=_hap0giaBiU0o7SbHRmFsZ3yqXq7ULjK_omuifKBUqo,117165
787
+ tools/qontract_cli.py,sha256=_-ianEfVdOU8ZCDjZ-jLfkNMtQT2qw3uwjO-XnTRsKw,117904
788
788
  tools/sd_app_sre_alert_report.py,sha256=e9vAdyenUz2f5c8-z-5WY0wv-SJ9aePKDH2r4IwB6pc,5063
789
789
  tools/template_validation.py,sha256=-U-lTGeLaci8yWPEblCJeev2DOlY1jM9QOOh-O1zts8,3376
790
790
  tools/cli_commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -811,8 +811,8 @@ tools/test/test_app_interface_metrics_exporter.py,sha256=SX7qL3D1SIRKFo95FoQztvf
811
811
  tools/test/test_qontract_cli.py,sha256=_D61RFGAN5x44CY1tYbouhlGXXABwYfxKSWSQx3Jrss,4941
812
812
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
813
813
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
814
- qontract_reconcile-0.10.1rc821.dist-info/METADATA,sha256=9YwIJk3JplE2wqgGPe54l4-pdaFStcLWcb9UK5jCSdI,2314
815
- qontract_reconcile-0.10.1rc821.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
816
- qontract_reconcile-0.10.1rc821.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
817
- qontract_reconcile-0.10.1rc821.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
818
- qontract_reconcile-0.10.1rc821.dist-info/RECORD,,
814
+ qontract_reconcile-0.10.1rc823.dist-info/METADATA,sha256=BZQWX3LX2zeeorNJTNU98S3I_tQ-5Uj3YTxrECoi25g,2314
815
+ qontract_reconcile-0.10.1rc823.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
816
+ qontract_reconcile-0.10.1rc823.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
817
+ qontract_reconcile-0.10.1rc823.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
818
+ qontract_reconcile-0.10.1rc823.dist-info/RECORD,,
@@ -153,7 +153,7 @@ class DashdotdbBase:
153
153
  f"Basic {b64encode(f'{username}:{password}'.encode()).decode('utf-8')}"
154
154
  )
155
155
  response = requests.get(
156
- url, params=params, headers=headers, verify=ssl_verify, timeout=(5, 120)
156
+ url, params=params, headers=headers, verify=ssl_verify, timeout=(5, 300)
157
157
  )
158
158
  response.raise_for_status()
159
159
 
tools/qontract_cli.py CHANGED
@@ -2619,17 +2619,57 @@ def maintenances(ctx):
2619
2619
  print_output(ctx.obj["options"], data, columns)
2620
2620
 
2621
2621
 
2622
+ class MigrationStatusCount:
2623
+ def __init__(self, app: str) -> None:
2624
+ self.app = app
2625
+ self._source = 0
2626
+ self._target = 0
2627
+
2628
+ def inc(self, source_or_target: str) -> None:
2629
+ match source_or_target:
2630
+ case "source":
2631
+ self._source += 1
2632
+ case "target":
2633
+ self._target += 1
2634
+ case _:
2635
+ raise ValueError("hcp migration label must be source or target")
2636
+
2637
+ @property
2638
+ def classic(self) -> int:
2639
+ return self._source
2640
+
2641
+ @property
2642
+ def hcp(self) -> int:
2643
+ return self._target
2644
+
2645
+ @property
2646
+ def total(self) -> int:
2647
+ return self.classic + self.hcp
2648
+
2649
+ @property
2650
+ def progress(self) -> float:
2651
+ return round(self.hcp / self.total * 100, 0)
2652
+
2653
+ @property
2654
+ def item(self) -> dict[str, Any]:
2655
+ return {
2656
+ "app": self.app,
2657
+ "classic": self.classic or "0",
2658
+ "hcp": self.hcp or "0",
2659
+ "progress": self.progress or "0",
2660
+ }
2661
+
2662
+
2622
2663
  @get.command()
2623
2664
  @click.pass_context
2624
2665
  def hcp_migration_status(ctx):
2625
- counts: dict[str, dict[str, int]] = {}
2666
+ counts: dict[str, MigrationStatusCount] = {}
2667
+ total_count = MigrationStatusCount("total")
2626
2668
  saas_files = get_saas_files()
2627
2669
  for sf in saas_files:
2628
2670
  if sf.publish_job_logs:
2629
2671
  # ignore post deployment test saas files
2630
2672
  continue
2631
- app = sf.app.parent_app.name if sf.app.parent_app else sf.app.name
2632
- counts.setdefault(app, {"source": 0, "target": 0})
2633
2673
  for rt in sf.resource_templates:
2634
2674
  if rt.provider == "directory" or "dashboard" in rt.name:
2635
2675
  # ignore grafana dashboards
@@ -2644,26 +2684,15 @@ def hcp_migration_status(ctx):
2644
2684
  if t.delete:
2645
2685
  continue
2646
2686
  if hcp_migration := t.namespace.cluster.labels.get("hcp_migration"):
2647
- counts[app][hcp_migration] += 1
2648
-
2649
- data = []
2650
- for a, c in counts.items():
2651
- source = c["source"]
2652
- target = c["target"]
2653
- item = {}
2654
- item["app"] = a
2655
- item["classic"] = source or "0"
2656
- item["hcp"] = target or "0"
2657
- total = source + target
2658
- if total == 0:
2659
- continue
2660
- progress = round(target / total * 100, 2) or "0"
2661
- item["progress"] = progress
2662
- data.append(item)
2663
-
2664
- summary_completed = len([d for d in data if d["progress"] == 100])
2665
- print(f"SUMMARY: {summary_completed} / {len(data)} COMPLETED")
2687
+ app = sf.app.parent_app.name if sf.app.parent_app else sf.app.name
2688
+ counts.setdefault(app, MigrationStatusCount(app))
2689
+ counts[app].inc(hcp_migration)
2690
+ total_count.inc(hcp_migration)
2666
2691
 
2692
+ data = [c.item for c in counts.values()]
2693
+ print(
2694
+ f"SUMMARY: {total_count.hcp} / {total_count.total} COMPLETED ({total_count.progress}%)"
2695
+ )
2667
2696
  columns = ["app", "classic", "hcp", "progress"]
2668
2697
  print_output(ctx.obj["options"], data, columns)
2669
2698