qontract-reconcile 0.10.1rc1109__py3-none-any.whl → 0.10.1rc1110__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.1rc1109
3
+ Version: 0.10.1rc1110
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
@@ -61,7 +61,7 @@ reconcile/ocm_groups.py,sha256=-rTPMewkdyo1De6gs4u-294p3z34oUbGfuNi8ov56Sk,3424
61
61
  reconcile/ocm_machine_pools.py,sha256=poGfITOCJEMwYAJpiuL8SytgTcBmGIKEZPgNGld80TY,16563
62
62
  reconcile/ocm_update_recommended_version.py,sha256=IYkfLXIprOW1jguZeELcGP1iBPuj-b53R-FTqKulMl8,4204
63
63
  reconcile/ocm_upgrade_scheduler_org_updater.py,sha256=aLgyInt9oIWAg0XtCiwJRUSwdPx3masKV8kHzkyEEOQ,4282
64
- reconcile/openshift_base.py,sha256=l3stMLbjRj3Z18orwyRv8ZN5IqVRaEwQ9tgiQJjDI5w,52641
64
+ reconcile/openshift_base.py,sha256=6hWLBQ6HF6ignq74PWxVDTxPs84kno0yQnomdx_o8K0,52736
65
65
  reconcile/openshift_cluster_bots.py,sha256=AmCLCrlsZ_Wd5qMPzlv-O01i47WGJuojEc-Jgt2n77c,10942
66
66
  reconcile/openshift_clusterrolebindings.py,sha256=sDgHi_t2ayE3O6zZ5CLao7uBmihxRK8K70w2GSADz-w,5822
67
67
  reconcile/openshift_groups.py,sha256=sK2wLWwNupztbfyFPl32VH42s_s8Mu3g-URdlisnwJc,9382
@@ -75,7 +75,7 @@ reconcile/openshift_resources.py,sha256=I2nO_C37mG3rfyGrd4cGwN3mVseVGuTAHAyhFzLy
75
75
  reconcile/openshift_resources_base.py,sha256=1A5_699p0rdsMwRQRPzePEfjhhq5eB2Obwxx4Ibr8jA,41205
76
76
  reconcile/openshift_rolebindings.py,sha256=9mlJ2FjWUoH-rsjtasreA_hV-K5Z_YR00qR_RR60OZM,6555
77
77
  reconcile/openshift_routes.py,sha256=fXvuPSjcjVw1X3j2EQvUAdbOepmIFdKk-M3qP8QzPiw,1075
78
- reconcile/openshift_saas_deploy.py,sha256=UZlm29JujJVS3MzSm6uehlC3y-jZxl6WVwMeKRdN11U,12773
78
+ reconcile/openshift_saas_deploy.py,sha256=T1dvb9zajisaJNjbnR6-AZHU-itscHtr4oCqLj8KCK0,13037
79
79
  reconcile/openshift_saas_deploy_change_tester.py,sha256=12uyBwaeMka1C3_pejmQPIBPAx2V1sJ4dJkScq-2e2M,8793
80
80
  reconcile/openshift_saas_deploy_trigger_base.py,sha256=Ss_FE31d8jR2f3lbSiU0ROBMVI1kg-Y_8nxLavFPFko,14036
81
81
  reconcile/openshift_saas_deploy_trigger_cleaner.py,sha256=roLyVAVntaQptKaZbnN1LyLvCA8fyvqELfjU6M8xfeY,3511
@@ -699,7 +699,7 @@ reconcile/utils/make.py,sha256=QaEwucrzbl8-VHS66Wfdjfo0ubmAcvt_hZGpiGsKU50,231
699
699
  reconcile/utils/metrics.py,sha256=QN37XJDajWt-FdVGgqqDUkhemwTj0srfb-rhkIBxvsE,18591
700
700
  reconcile/utils/models.py,sha256=BYsgjWyuwO7obMhqADsqEQ-_YJrmy8LmFKHSLMFbo1g,4645
701
701
  reconcile/utils/oauth2_backend_application_session.py,sha256=6W16sMpnWEPFDUX7qi5Cui2yOnmLfpgUxWtB3Ii35D0,4177
702
- reconcile/utils/oc.py,sha256=B_XFgL3yPhztKGrQNl7sdjCZV3t7zpmN0k62WnOiWlk,66015
702
+ reconcile/utils/oc.py,sha256=AjwQnzLxnMv0ML70GfjTHeYmiNsztI8kgXQF3N0Hvfw,66088
703
703
  reconcile/utils/oc_connection_parameters.py,sha256=7DiEGo--TJelfYoZXJFyTBPeTw9kXL3L58vy2fiJnes,9643
704
704
  reconcile/utils/oc_filters.py,sha256=Tz3OwtbUaYKmxENFls5CtPVzkZDeFXknw53dJe-wbT8,1382
705
705
  reconcile/utils/oc_map.py,sha256=U8cYhiaZsomkofzbIjVrl7E7crRxkS2JKsFpVeeHVE8,8964
@@ -870,8 +870,8 @@ tools/test/test_qontract_cli.py,sha256=_D61RFGAN5x44CY1tYbouhlGXXABwYfxKSWSQx3Jr
870
870
  tools/test/test_saas_promotion_state.py,sha256=dy4kkSSAQ7bC0Xp2CociETGN-2aABEfL6FU5D9Jl00Y,6056
871
871
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
872
872
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
873
- qontract_reconcile-0.10.1rc1109.dist-info/METADATA,sha256=xkpjJve4vseH5U9biXZ2ku_Jc0lSIvJudH_ROUPvaQ0,2213
874
- qontract_reconcile-0.10.1rc1109.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
875
- qontract_reconcile-0.10.1rc1109.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
876
- qontract_reconcile-0.10.1rc1109.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
877
- qontract_reconcile-0.10.1rc1109.dist-info/RECORD,,
873
+ qontract_reconcile-0.10.1rc1110.dist-info/METADATA,sha256=_zirPDusBEjVZlm4_iZZ18epfv7-X0dL3liL66u5o8M,2213
874
+ qontract_reconcile-0.10.1rc1110.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
875
+ qontract_reconcile-0.10.1rc1110.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
876
+ qontract_reconcile-0.10.1rc1110.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
877
+ qontract_reconcile-0.10.1rc1110.dist-info/RECORD,,
@@ -300,7 +300,9 @@ def populate_current_state(
300
300
  return
301
301
  try:
302
302
  for item in spec.oc.get_items(
303
- spec.kind, namespace=spec.namespace, resource_names=spec.resource_names
303
+ spec.kind,
304
+ namespace=spec.namespace,
305
+ resource_names=spec.resource_names,
304
306
  ):
305
307
  openshift_resource = OR(item, integration, integration_version)
306
308
 
@@ -331,6 +333,7 @@ def fetch_current_state(
331
333
  init_api_resources: bool = False,
332
334
  cluster_admin: bool = False,
333
335
  caller: str | None = None,
336
+ init_projects: bool = False,
334
337
  ) -> tuple[ResourceInventory, OC_Map]:
335
338
  ri = ResourceInventory()
336
339
  settings = queries.get_app_interface_settings()
@@ -344,6 +347,7 @@ def fetch_current_state(
344
347
  thread_pool_size=thread_pool_size,
345
348
  init_api_resources=init_api_resources,
346
349
  cluster_admin=cluster_admin,
350
+ init_projects=init_projects,
347
351
  )
348
352
  state_specs = init_specs_to_fetch(
349
353
  ri,
@@ -33,6 +33,7 @@ from reconcile.utils.secret_reader import create_secret_reader
33
33
  from reconcile.utils.semver_helper import make_semver
34
34
  from reconcile.utils.slack_api import SlackApi
35
35
  from reconcile.utils.state import init_state
36
+ from reconcile.utils.unleash import get_feature_toggle_state
36
37
 
37
38
  QONTRACT_INTEGRATION = "openshift-saas-deploy"
38
39
  QONTRACT_INTEGRATION_VERSION = make_semver(0, 1, 0)
@@ -216,6 +217,11 @@ def run(
216
217
  logging.warning("no targets found")
217
218
  sys.exit(ExitCodes.SUCCESS)
218
219
 
220
+ # check enable_init_projects flag status
221
+ enable_init_projects = get_feature_toggle_state(
222
+ "enable_init_projects",
223
+ default=False,
224
+ )
219
225
  ri, oc_map = ob.fetch_current_state(
220
226
  namespaces=[ns.dict(by_alias=True) for ns in saasherder.namespaces],
221
227
  thread_pool_size=thread_pool_size,
@@ -224,6 +230,7 @@ def run(
224
230
  init_api_resources=True,
225
231
  cluster_admin=bool(saasherder.cluster_admin),
226
232
  use_jump_host=use_jump_host,
233
+ init_projects=enable_init_projects,
227
234
  )
228
235
  if defer: # defer is provided by the method decorator. this makes just mypy happy
229
236
  defer(oc_map.cleanup)
reconcile/utils/oc.py CHANGED
@@ -370,6 +370,7 @@ class OCCli: # pylint: disable=too-many-public-methods
370
370
  self.api_resources_lock = threading.RLock()
371
371
  self.init_api_resources = init_api_resources
372
372
  self.api_resources = {}
373
+ self.projects = set()
373
374
  if self.init_api_resources:
374
375
  self.api_resources = self.get_api_resources()
375
376
 
@@ -379,7 +380,7 @@ class OCCli: # pylint: disable=too-many-public-methods
379
380
  kind = "Project.project.openshift.io"
380
381
  else:
381
382
  kind = "Namespace"
382
- self.projects = [p["metadata"]["name"] for p in self.get_all(kind)["items"]]
383
+ self.projects = {p["metadata"]["name"] for p in self.get_all(kind)["items"]}
383
384
 
384
385
  self.slow_oc_reconcile_threshold = float(
385
386
  os.environ.get("SLOW_OC_RECONCILE_THRESHOLD", 600)
@@ -442,6 +443,7 @@ class OCCli: # pylint: disable=too-many-public-methods
442
443
  self.api_resources_lock = threading.RLock()
443
444
  self.init_api_resources = init_api_resources
444
445
  self.api_resources = {}
446
+ self.projects = set()
445
447
  if self.init_api_resources:
446
448
  self.api_resources = self.get_api_resources()
447
449
 
@@ -451,7 +453,7 @@ class OCCli: # pylint: disable=too-many-public-methods
451
453
  kind = "Project.project.openshift.io"
452
454
  else:
453
455
  kind = "Namespace"
454
- self.projects = [p["metadata"]["name"] for p in self.get_all(kind)["items"]]
456
+ self.projects = {p["metadata"]["name"] for p in self.get_all(kind)["items"]}
455
457
 
456
458
  self.slow_oc_reconcile_threshold = float(
457
459
  os.environ.get("SLOW_OC_RECONCILE_THRESHOLD", 600)
@@ -605,9 +607,8 @@ class OCCli: # pylint: disable=too-many-public-methods
605
607
  return self._msg_to_process_reconcile_time(namespace, resource)
606
608
 
607
609
  def project_exists(self, name):
608
- if self.init_projects:
609
- return name in self.projects
610
-
610
+ if name in self.projects:
611
+ return True
611
612
  try:
612
613
  if self.is_kind_supported("Project"):
613
614
  self.get(None, "Project.project.openshift.io", name)
@@ -1265,14 +1266,14 @@ class OCNative(OCCli):
1265
1266
  raise Exception("A method relies on client/api_kind_version to be set")
1266
1267
 
1267
1268
  self.object_clients: dict[Any, Any] = {}
1268
-
1269
+ self.projects = set()
1269
1270
  self.init_projects = init_projects
1270
1271
  if self.init_projects:
1271
1272
  if self.is_kind_supported("Project"):
1272
1273
  kind = "Project.project.openshift.io"
1273
1274
  else:
1274
1275
  kind = "Namespace"
1275
- self.projects = [p["metadata"]["name"] for p in self.get_all(kind)["items"]]
1276
+ self.projects = {p["metadata"]["name"] for p in self.get_all(kind)["items"]}
1276
1277
 
1277
1278
  def __enter__(self):
1278
1279
  return self
@@ -1370,7 +1371,6 @@ class OCNative(OCCli):
1370
1371
  items = items_list.get("items")
1371
1372
  if items is None:
1372
1373
  raise Exception("Expecting items")
1373
-
1374
1374
  return items
1375
1375
 
1376
1376
  @retry(max_attempts=5, exceptions=(ServerTimeoutError, ForbiddenError))