qontract-reconcile 0.10.1rc416__py3-none-any.whl → 0.10.1rc418__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.1rc416
3
+ Version: 0.10.1rc418
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
@@ -1,5 +1,5 @@
1
1
  reconcile/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- reconcile/acs_rbac.py,sha256=OggKBiNGOGQJBsE3jJXwt0NT7zsTebdgDNKllE8cQMs,23537
2
+ reconcile/acs_rbac.py,sha256=Jr9qIR1VjH16xpADZqjkigqsDW7iDnMD9nn7GxU4z0Y,23828
3
3
  reconcile/aws_ami_share.py,sha256=yLNSjtepxk4UL5f4Ix9oRp17jy9OXza0MIr71mhuqEA,3665
4
4
  reconcile/aws_ecr_image_pull_secrets.py,sha256=TGEc_0nv8oxV2HqA8VdcM4HHP-B1YqmNOOU6FPwVFTY,2328
5
5
  reconcile/aws_garbage_collector.py,sha256=ddwU8IKTueAJc0TzymcREr7hcoVui9kOGvdH1B2EcuM,450
@@ -53,7 +53,7 @@ reconcile/ocm_addons.py,sha256=qqAyqRBRbdZQvAcjb-QlSVyRAyQBZk6iVlgnI4jyi7s,3353
53
53
  reconcile/ocm_addons_upgrade_tests_trigger.py,sha256=oATZneNJSLkUAcba1sCHJr8qJztbsi1SAeEraoRUWq4,4057
54
54
  reconcile/ocm_aws_infrastructure_access.py,sha256=sz2ybcuj76nxpDJYvvLWVjPA6wprjbegbnenIljo9cU,7044
55
55
  reconcile/ocm_clusters.py,sha256=0NBZ5_6ikf_yEMpHjznXucXTtCC5tNFwLxIMGUaz7r0,13447
56
- reconcile/ocm_external_configuration_labels.py,sha256=sgotkG0SdQeTkc3rQgZEgKonG490T2RVw2ypnyJj47U,3269
56
+ reconcile/ocm_external_configuration_labels.py,sha256=imEpDv1RBpCSj8tHDv0R76hmNCFtcUzVNgS1yOVl8vs,3870
57
57
  reconcile/ocm_github_idp.py,sha256=IlSpoUlUhYOahqWee6azJiN-N5EZNxNAWh-lrPXTfEc,3946
58
58
  reconcile/ocm_groups.py,sha256=_kiMUndKc6as6cbbvXxVnq8V_Lj7X5lxMJVCuRWuUFE,2888
59
59
  reconcile/ocm_machine_pools.py,sha256=YGIokK6cWhakPB4pj3h4F6w9Rn12kqsXf4TT4mdj1w8,15218
@@ -90,7 +90,7 @@ reconcile/quay_mirror.py,sha256=l2-RwdJrny3lqoIzc40uQhGAdTO0PYBwFfGC_K1s_I0,1423
90
90
  reconcile/quay_mirror_org.py,sha256=E1OdRe-ppxTkNCwu20iVRhEdG1fPDBroLY02NgiMN7c,10381
91
91
  reconcile/quay_permissions.py,sha256=_3PCWjNWoU7VHlYgHzUevvL_jJmEMsWfXV_nzjeiyhU,4099
92
92
  reconcile/quay_repos.py,sha256=7609RBVQihis96FNOOe-i9tCTYwcTVy4WpKAL6HpnkU,7031
93
- reconcile/queries.py,sha256=F91Nx33NQU0OB6zj74XyYI7oUlNUzHDw3jTDoJr_Bak,49165
93
+ reconcile/queries.py,sha256=FfDCztWcbrw6kDMIFGwOS7q67tWEQPJuVfyXyBKn_9o,49206
94
94
  reconcile/query_validator.py,sha256=oLEZIAsQCzxmmZ7b9dSw-OKuEjpI1dbVu4XfCfjpmi8,1503
95
95
  reconcile/requests_sender.py,sha256=914iluuF4UVgG3VyxxtnHOu4yf6YKS2fIy6PViSsFTQ,3875
96
96
  reconcile/resource_scraper.py,sha256=vo1N9vLJCYWvXlTwFRIpEuWjx_39ZV9zxJlpoPq4g3U,2330
@@ -636,8 +636,8 @@ tools/test/test_app_interface_metrics_exporter.py,sha256=dmEcNwZltP1rd_4DbxIYakO
636
636
  tools/test/test_qontract_cli.py,sha256=awwTHEc2DWlykuqGIYM0WOBoSL0KRnOraCLk3C7izis,1401
637
637
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
638
638
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
639
- qontract_reconcile-0.10.1rc416.dist-info/METADATA,sha256=sP59I2h_LN6XLUyHK5C5UqzPQh1WqPsj6zA_thA0Lhk,2347
640
- qontract_reconcile-0.10.1rc416.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
641
- qontract_reconcile-0.10.1rc416.dist-info/entry_points.txt,sha256=rTjAv28I_CHLM8ID3OPqMI_suoQ9s7tFbim4aYjn9kk,376
642
- qontract_reconcile-0.10.1rc416.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
643
- qontract_reconcile-0.10.1rc416.dist-info/RECORD,,
639
+ qontract_reconcile-0.10.1rc418.dist-info/METADATA,sha256=bYR73yjW15cE_wXs6HuU9pT1haQ-xRZBBOnXU4whpII,2347
640
+ qontract_reconcile-0.10.1rc418.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
641
+ qontract_reconcile-0.10.1rc418.dist-info/entry_points.txt,sha256=rTjAv28I_CHLM8ID3OPqMI_suoQ9s7tFbim4aYjn9kk,376
642
+ qontract_reconcile-0.10.1rc418.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
643
+ qontract_reconcile-0.10.1rc418.dist-info/RECORD,,
reconcile/acs_rbac.py CHANGED
@@ -353,6 +353,7 @@ class AcsRbacIntegration(QontractReconcileIntegration[NoParams]):
353
353
  role: AcsRole,
354
354
  acs: AcsApi,
355
355
  access_scope_id: str,
356
+ admin_access_scope_id: str,
356
357
  groups: list[Group],
357
358
  dry_run: bool,
358
359
  ) -> None:
@@ -383,9 +384,11 @@ class AcsRbacIntegration(QontractReconcileIntegration[NoParams]):
383
384
  acs.delete_role(role.name)
384
385
  logging.info("Deleted role: %s", role.name)
385
386
 
386
- if not dry_run:
387
- acs.delete_access_scope(access_scope_id)
388
- logging.info("Deleted access scope: %s", role.access_scope.name)
387
+ # do not attempt deletion of system default 'Unrestricted' scope referenced by a custom role
388
+ if access_scope_id != admin_access_scope_id:
389
+ if not dry_run:
390
+ acs.delete_access_scope(access_scope_id)
391
+ logging.info("Deleted access scope: %s", role.access_scope.name)
389
392
 
390
393
  def delete_rbac(
391
394
  self,
@@ -416,6 +419,7 @@ class AcsRbacIntegration(QontractReconcileIntegration[NoParams]):
416
419
  role=role,
417
420
  acs=acs,
418
421
  access_scope_id=access_scope_id_map[role.access_scope.name],
422
+ admin_access_scope_id=access_scope_id_map[DEFAULT_ADMIN_SCOPE_NAME],
419
423
  groups=role_group_mappings[role.name],
420
424
  dry_run=dry_run,
421
425
  )
@@ -12,6 +12,13 @@ from reconcile.utils.ocm import OCMMap
12
12
  QONTRACT_INTEGRATION = "ocm-external-configuration-labels"
13
13
 
14
14
 
15
+ def get_allowed_labels_for_cluster(cluster: dict[str, Any]) -> set[str]:
16
+ allowed_labels = cluster.get("ocm", {}).get(
17
+ "allowedClusterExternalConfigLabels", []
18
+ )
19
+ return set(allowed_labels)
20
+
21
+
15
22
  def fetch_current_state(clusters):
16
23
  settings = queries.get_app_interface_settings()
17
24
  ocm_map = OCMMap(
@@ -21,9 +28,12 @@ def fetch_current_state(clusters):
21
28
  current_state = []
22
29
  for cluster in clusters:
23
30
  cluster_name = cluster["name"]
31
+ allowed_labels = get_allowed_labels_for_cluster(cluster)
24
32
  ocm = ocm_map.get(cluster_name)
25
33
  labels = ocm.get_external_configuration_labels(cluster_name)
26
34
  for key, value in labels.items():
35
+ if key not in allowed_labels:
36
+ continue
27
37
  item = {"label": {"key": key, "value": value}, "cluster": cluster_name}
28
38
  current_state.append(item)
29
39
 
@@ -34,8 +44,13 @@ def fetch_desired_state(clusters):
34
44
  desired_state = []
35
45
  for cluster in clusters:
36
46
  cluster_name = cluster["name"]
47
+ allowed_labels = get_allowed_labels_for_cluster(cluster)
37
48
  labels = json.loads(cluster["externalConfiguration"]["labels"])
38
49
  for key, value in labels.items():
50
+ if key not in allowed_labels:
51
+ raise ValueError(
52
+ f"Unsupported external configuration label '{key}' in cluster '{cluster_name}'"
53
+ )
39
54
  item = {"label": {"key": key, "value": value}, "cluster": cluster_name}
40
55
  desired_state.append(item)
41
56
 
reconcile/queries.py CHANGED
@@ -697,6 +697,7 @@ CLUSTERS_QUERY = """
697
697
  format
698
698
  version
699
699
  }
700
+ allowedClusterExternalConfigLabels
700
701
  blockedVersions
701
702
  inheritVersionData {
702
703
  name