qontract-reconcile 0.10.1rc725__py3-none-any.whl → 0.10.1rc727__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.1rc725
3
+ Version: 0.10.1rc727
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,6 +1,6 @@
1
1
  reconcile/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- reconcile/acs_policies.py,sha256=e_kVyP4rGm3fJzq10Anr8scZoPenlmTcoS5REK0d2T0,9144
3
- reconcile/acs_rbac.py,sha256=YoKu5wTRTtb3EGT0PV3r279LDgvw2ECb-0_0j4suScg,23032
2
+ reconcile/acs_policies.py,sha256=1iRYmMdz0YtqyQgA9O0uGQdmMKUCCe-ApRa6LIEAdps,8769
3
+ reconcile/acs_rbac.py,sha256=JEDevU4AdhTjMW-fAnNG3iw6Od5tYxGuYSirmu9KurI,22657
4
4
  reconcile/aws_ami_share.py,sha256=eeu0TI3M5yyUaozyAq_aW3tir-9be4YFguOXvIvKHSo,3757
5
5
  reconcile/aws_ecr_image_pull_secrets.py,sha256=TGEc_0nv8oxV2HqA8VdcM4HHP-B1YqmNOOU6FPwVFTY,2328
6
6
  reconcile/aws_garbage_collector.py,sha256=ddwU8IKTueAJc0TzymcREr7hcoVui9kOGvdH1B2EcuM,450
@@ -9,7 +9,7 @@ reconcile/aws_iam_password_reset.py,sha256=NwErtrqgBiXr7eGCAHdtGGOx0S7-4JnSc29Ie
9
9
  reconcile/aws_support_cases_sos.py,sha256=Jk6_XjDeJSYxgRGqcEAOcynt9qJF2r5HPIPcSKmoBv8,2974
10
10
  reconcile/blackbox_exporter_endpoint_monitoring.py,sha256=W_VJagnsJR1v5oqjlI3RJJE0_nhtJ0m81RS8zWA5u5c,3538
11
11
  reconcile/checkpoint.py,sha256=R2WFXUXLTB4sWMi4GeA4eegsuf_1-Q4vH8M0Toh3Ij4,5036
12
- reconcile/cli.py,sha256=HLfkpQXhNA9YDwNWJUYg8zjm03sCEUIVB6-Ly4FOh48,96572
12
+ reconcile/cli.py,sha256=xAuxjbBPlIeFAnyOhhMYJTthVM_J26Sb6F2WNCb734M,96573
13
13
  reconcile/closedbox_endpoint_monitoring_base.py,sha256=SMhkcQqprWvThrIJa3U_3uh5w1h-alleW1QnCJFY4Qw,4909
14
14
  reconcile/cluster_deployment_mapper.py,sha256=2Ah-nu-Mdig0pjuiZl_XLrmVAjYzFjORR3dMlCgkmw0,2352
15
15
  reconcile/dashdotdb_base.py,sha256=a5aPLVxyqPSbjdB0Ty-uliOtxwvEbbEljHJKxdK3-Zk,4813
@@ -372,7 +372,7 @@ reconcile/oum/models.py,sha256=0ZyCnULRxAbIEXX60BkkPZVg53DCD6ZJ6wnNT2ANROM,1743
372
372
  reconcile/oum/providers.py,sha256=3kEjXvsTPzXc7gzrdO7hWqgzcMmMZMpk2S0X7wQUTWU,1767
373
373
  reconcile/oum/standalone.py,sha256=bzyV8wz3SrERG9zJRFiJCBzSIGwDNj9sNqUytngDw94,7368
374
374
  reconcile/prometheus_rules_tester/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
375
- reconcile/prometheus_rules_tester/integration.py,sha256=glzYgt9WXRoVFGaonmYxsQBJ5RNR3HTrgsmwhIWKhgk,9329
375
+ reconcile/prometheus_rules_tester/integration.py,sha256=AahzQ0wEO8VEWqeT-xtmDmG6NMgMdr54jymlcqehwGM,9366
376
376
  reconcile/rhidp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
377
377
  reconcile/rhidp/common.py,sha256=suTh9T4dPOgrKi-rDALgjzCSL9JHGnkTYALFIIjNCJE,6801
378
378
  reconcile/rhidp/metrics.py,sha256=Yp0GtpjhieEdru0qkG3osBTJiKUzg6CAjwPoFTQDnCg,417
@@ -425,7 +425,7 @@ reconcile/templating/lib/rendering.py,sha256=_BVQ2gqip8K1AgLYfaTWh8NKJFTW6VjUZ6r
425
425
  reconcile/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
426
426
  reconcile/test/conftest.py,sha256=rQousYrxUz-EwAIbsYO6bIwR1B4CrOz9y_zaUVo2lfI,4466
427
427
  reconcile/test/fixtures.py,sha256=9SDWAUlSd1rCx7z3GhULHcpr-I6FyCsXxaFAZIqYQsQ,591
428
- reconcile/test/test_acs_policies.py,sha256=hMnCX9KdLRKb53gYXK4JUR5yJwhczJRyyUPywDeLeLg,15716
428
+ reconcile/test/test_acs_policies.py,sha256=pffUzH4IHKuXntvGMi-iV0Epg4YsCBF2G2-R9nYIt40,15699
429
429
  reconcile/test/test_acs_rbac.py,sha256=lvNd8GY0-GHzcOdOn13QWdrqbBXXKzNT7EEDHNH7cjM,28272
430
430
  reconcile/test/test_aggregated_list.py,sha256=iiWitQuNYC58aimWaiBoE4NROHjr1NCgQ91MnHEG_Ro,6412
431
431
  reconcile/test/test_amtool.py,sha256=vxRhGieeydMBOb9UI2ziMHjJa8puMeGNsUhGhy-yMnk,1032
@@ -472,7 +472,7 @@ reconcile/test/test_openshift_saas_deploy_change_tester.py,sha256=1yVe54Hx9YdVjn
472
472
  reconcile/test/test_openshift_saas_deploy_trigger_cleaner.py,sha256=cha3bUiXAWPCwrp8XwVC3RNJtJHLcsGTE-F8Zn6XxsU,2852
473
473
  reconcile/test/test_openshift_tekton_resources.py,sha256=RtRWsdm51S13OSkENC9nY_rOH0QELSCaO5tjF0XqIDI,11222
474
474
  reconcile/test/test_openshift_upgrade_watcher.py,sha256=0GDQ_YFHIX8DbkbDYSuLv9uZeeg4NwP1vlOqvSaZvN4,7183
475
- reconcile/test/test_prometheus_rules_tester.py,sha256=Qc9J4k0lSVie361lGr_cOy0EaBTD5LDqGZf7CYVFKr8,5677
475
+ reconcile/test/test_prometheus_rules_tester.py,sha256=cgVkPM3KcAw69bOkJ6iR2Lfog_WgblyoqVRtXv4ly7o,5685
476
476
  reconcile/test/test_quay_membership.py,sha256=e29Giz5S9ckFgjpTO8PBo8qVPocIQmy4WqsRhgTFd9A,2643
477
477
  reconcile/test/test_quay_mirror.py,sha256=UBLQDtet5WkWnh98ev5cI3yAflQl07awg2dXTefqoUk,6311
478
478
  reconcile/test/test_quay_mirror_org.py,sha256=67XwB0WkqO6l9SeR9cSfjODyt-P587Kvqvam7hR8rLQ,3008
@@ -654,7 +654,7 @@ reconcile/utils/vault.py,sha256=S0eHqvZ9N3fya1E8YDaUffEvLk_fdtpzL4rvWn6f828,1499
654
654
  reconcile/utils/vaultsecretref.py,sha256=3Ed2uBy36TzSvL0B-l4FoWQqB2SbBKDKEuUPIO608Bo,931
655
655
  reconcile/utils/vcs.py,sha256=o1r0n_IrU2El75CED_6sjR2GZGM-exuWsj5F7jONaMU,6779
656
656
  reconcile/utils/acs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
657
- reconcile/utils/acs/base.py,sha256=9XvFQVIbo6JOl5NKN4Mx3_jJc2B7pV12hOnTasm_Emw,2434
657
+ reconcile/utils/acs/base.py,sha256=8qZhCYteLCe3xSIeiNj-HXm6J0nBLFGBbZ7b7xXlA6I,2381
658
658
  reconcile/utils/acs/policies.py,sha256=_jAz6cv8KRYtDsXjGoJgNbD8_9PUa5LSwwVlpK4A_cQ,5505
659
659
  reconcile/utils/acs/rbac.py,sha256=ugsLM9Pb7FbUbdq85E3VzXGMaB9ZovXob7tdWCxwqZ8,8808
660
660
  reconcile/utils/aws_api_typed/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -764,8 +764,8 @@ tools/test/test_app_interface_metrics_exporter.py,sha256=SX7qL3D1SIRKFo95FoQztvf
764
764
  tools/test/test_qontract_cli.py,sha256=UEwAW7PA_GIrbqzaLxpkCxbuVjEFLNvnVG-6VyoCGIc,4147
765
765
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
766
766
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
767
- qontract_reconcile-0.10.1rc725.dist-info/METADATA,sha256=yALTJNiBAy2sBjcpLDBq3aVaZsZhlUKusvBps3BxlU0,2382
768
- qontract_reconcile-0.10.1rc725.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
769
- qontract_reconcile-0.10.1rc725.dist-info/entry_points.txt,sha256=rIxI5zWtHNlfpDeq1a7pZXAPoqf7HG32KMTN3MeWK_8,429
770
- qontract_reconcile-0.10.1rc725.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
771
- qontract_reconcile-0.10.1rc725.dist-info/RECORD,,
767
+ qontract_reconcile-0.10.1rc727.dist-info/METADATA,sha256=lGusiFpOTOvJIK8nYP813fIHvezdgXL9ojNkgPvpgcU,2382
768
+ qontract_reconcile-0.10.1rc727.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
769
+ qontract_reconcile-0.10.1rc727.dist-info/entry_points.txt,sha256=rIxI5zWtHNlfpDeq1a7pZXAPoqf7HG32KMTN3MeWK_8,429
770
+ qontract_reconcile-0.10.1rc727.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
771
+ qontract_reconcile-0.10.1rc727.dist-info/RECORD,,
reconcile/acs_policies.py CHANGED
@@ -7,9 +7,6 @@ from reconcile.gql_definitions.acs.acs_policies import (
7
7
  AcsPolicyConditionsV1,
8
8
  AcsPolicyV1,
9
9
  )
10
- from reconcile.typed_queries.app_interface_vault_settings import (
11
- get_app_interface_vault_settings,
12
- )
13
10
  from reconcile.utils import gql
14
11
  from reconcile.utils.acs.policies import AcsPolicyApi, Policy, PolicyCondition, Scope
15
12
  from reconcile.utils.differ import diff_iterables
@@ -17,7 +14,6 @@ from reconcile.utils.runtime.integration import (
17
14
  NoParams,
18
15
  QontractReconcileIntegration,
19
16
  )
20
- from reconcile.utils.secret_reader import create_secret_reader
21
17
  from reconcile.utils.semver_helper import make_semver
22
18
 
23
19
  # proceeding constants map schema enum values to corresponding acs api defaults
@@ -225,13 +221,8 @@ class AcsPoliciesIntegration(QontractReconcileIntegration[NoParams]):
225
221
  ) -> None:
226
222
  gqlapi = gql.get_api()
227
223
  instance = AcsPolicyApi.get_acs_instance(gqlapi.query)
228
-
229
- vault_settings = get_app_interface_vault_settings()
230
- secret_reader = create_secret_reader(use_vault=vault_settings.vault)
231
- token = secret_reader.read_all_secret(instance.credentials)
232
-
233
224
  with AcsPolicyApi(
234
- instance={"url": instance.url, "token": token[instance.credentials.field]}
225
+ url=instance.url, token=self.secret_reader.read_secret(instance.credentials)
235
226
  ) as acs_api:
236
227
  notifiers = acs_api.list_notifiers()
237
228
  clusters = acs_api.list_clusters()
reconcile/acs_rbac.py CHANGED
@@ -10,9 +10,6 @@ from pydantic import BaseModel
10
10
 
11
11
  from reconcile.gql_definitions.acs.acs_rbac import OidcPermissionAcsV1
12
12
  from reconcile.gql_definitions.acs.acs_rbac import query as acs_rbac_query
13
- from reconcile.typed_queries.app_interface_vault_settings import (
14
- get_app_interface_vault_settings,
15
- )
16
13
  from reconcile.utils import gql
17
14
  from reconcile.utils.acs.rbac import AcsRbacApi, Group, RbacResources
18
15
  from reconcile.utils.differ import (
@@ -23,7 +20,6 @@ from reconcile.utils.runtime.integration import (
23
20
  NoParams,
24
21
  QontractReconcileIntegration,
25
22
  )
26
- from reconcile.utils.secret_reader import create_secret_reader
27
23
  from reconcile.utils.semver_helper import make_semver
28
24
 
29
25
  DEFAULT_ADMIN_SCOPE_NAME = "Unrestricted"
@@ -582,15 +578,10 @@ class AcsRbacIntegration(QontractReconcileIntegration[NoParams]):
582
578
  ) -> None:
583
579
  gqlapi = gql.get_api()
584
580
  instance = AcsRbacApi.get_acs_instance(gqlapi.query)
585
-
586
- vault_settings = get_app_interface_vault_settings()
587
- secret_reader = create_secret_reader(use_vault=vault_settings.vault)
588
- token = secret_reader.read_all_secret(instance.credentials)
589
-
590
581
  desired = self.get_desired_state(gqlapi.query)
591
582
 
592
583
  with AcsRbacApi(
593
- instance={"url": instance.url, "token": token[instance.credentials.field]}
584
+ url=instance.url, token=self.secret_reader.read_secret(instance.credentials)
594
585
  ) as acs_api:
595
586
  rbac_api_resources = acs_api.get_rbac_resources()
596
587
  current = self.get_current_state(
reconcile/cli.py CHANGED
@@ -3019,7 +3019,7 @@ def prometheus_rules_tester(ctx, thread_pool_size, cluster_name):
3019
3019
  reconcile.prometheus_rules_tester.integration,
3020
3020
  ctx.obj,
3021
3021
  thread_pool_size,
3022
- cluster_name=cluster_name,
3022
+ cluster_names=cluster_name,
3023
3023
  )
3024
3024
 
3025
3025
 
@@ -122,12 +122,12 @@ def fetch_rule_and_tests(
122
122
  def get_rules_and_tests(
123
123
  vault_settings: AppInterfaceSettingsV1,
124
124
  thread_pool_size: int,
125
- cluster_name: Optional[str] = None,
125
+ cluster_names: Optional[Iterable[str]] = None,
126
126
  ) -> list[Test]:
127
127
  """Iterates through all namespaces and returns a list of tests to run"""
128
128
  namespace_with_prom_rules, _ = orb.get_namespaces(
129
129
  PROVIDERS,
130
- cluster_names=[cluster_name] if cluster_name else [],
130
+ cluster_names=cluster_names if cluster_names else [],
131
131
  namespace_name=NAMESPACE_NAME,
132
132
  )
133
133
 
@@ -225,14 +225,14 @@ def check_rules_and_tests(
225
225
  vault_settings: AppInterfaceSettingsV1,
226
226
  alerting_services: Iterable[str],
227
227
  thread_pool_size: int,
228
- cluster_name: Optional[str] = None,
228
+ cluster_names: Optional[Iterable[str]] = None,
229
229
  ) -> list[Test]:
230
230
  """Fetch rules and associated tests, run checks on rules and tests if they exist
231
231
  and return a list of failed checks/tests"""
232
232
  tests = get_rules_and_tests(
233
233
  vault_settings=vault_settings,
234
234
  thread_pool_size=thread_pool_size,
235
- cluster_name=cluster_name,
235
+ cluster_names=cluster_names,
236
236
  )
237
237
  threaded.run(
238
238
  func=run_test,
@@ -247,14 +247,14 @@ def check_rules_and_tests(
247
247
 
248
248
 
249
249
  def run(
250
- dry_run: bool, thread_pool_size: int, cluster_name: Optional[str] = None
250
+ dry_run: bool, thread_pool_size: int, cluster_names: Optional[Iterable[str]] = None
251
251
  ) -> None:
252
252
  """Check prometheus rules syntax and run the tests associated to them"""
253
253
  orb.QONTRACT_INTEGRATION = QONTRACT_INTEGRATION
254
254
  orb.QONTRACT_INTEGRATION_VERSION = QONTRACT_INTEGRATION_VERSION
255
255
 
256
256
  failed_tests = check_rules_and_tests(
257
- cluster_name=cluster_name,
257
+ cluster_names=cluster_names,
258
258
  vault_settings=get_app_interface_vault_settings(),
259
259
  alerting_services=get_alerting_services(),
260
260
  thread_pool_size=thread_pool_size,
@@ -311,7 +311,7 @@ def test_get_current_state(
311
311
  specific_custom_policy_2,
312
312
  ],
313
313
  )
314
- with AcsPolicyApi(instance={"url": "foo", "token": "bar"}) as acs:
314
+ with AcsPolicyApi(url="foo", token="bar") as acs:
315
315
  assert sorted(acs.get_custom_policies(), key=lambda p: p.name) == sorted(
316
316
  modeled_acs_policies, key=lambda p: p.name
317
317
  )
@@ -69,7 +69,7 @@ class TestPrometheusRulesTester:
69
69
  vault_settings=self.vault_settings,
70
70
  alerting_services=self.alerting_services,
71
71
  thread_pool_size=THREAD_POOL_SIZE,
72
- cluster_name=cluster_name,
72
+ cluster_names=cluster_name,
73
73
  )
74
74
 
75
75
  def test_ok_non_templated(self) -> None:
@@ -136,16 +136,16 @@ class TestPrometheusRulesTester:
136
136
  self.ns_data = self.fxt.get_anymarkup("ns-bad-test.yaml")
137
137
  mocker_alerting_services.return_value = {"yak-shaver"}
138
138
  mocker_vault_settings.return_value = AppInterfaceSettingsV1(vault=False)
139
- cluster_name = "appint-ex-01"
139
+ cluster_name = ("appint-ex-01",)
140
140
 
141
141
  with pytest.raises(SystemExit) as exc:
142
- run(False, THREAD_POOL_SIZE, cluster_name=cluster_name)
142
+ run(False, THREAD_POOL_SIZE, cluster_names=cluster_name)
143
143
 
144
144
  assert exc.value.code == ExitCodes.ERROR
145
145
 
146
146
  error_msg = (
147
147
  "Error checking rule bad-test.prometheusrules.yaml "
148
148
  "from namespace openshift-customer-monitoring in "
149
- f"cluster {cluster_name}: Error running promtool command"
149
+ f"cluster {cluster_name[0]}: Error running promtool command"
150
150
  )
151
151
  assert error_msg in caplog.text
@@ -7,22 +7,21 @@ from typing import (
7
7
  )
8
8
 
9
9
  import requests
10
+ from pydantic import BaseModel
10
11
 
11
12
  from reconcile.gql_definitions.acs.acs_instances import AcsInstanceV1
12
13
  from reconcile.gql_definitions.acs.acs_instances import query as acs_instances_query
13
14
  from reconcile.utils.exceptions import AppInterfaceSettingsError
14
15
 
15
16
 
16
- class AcsBaseApi:
17
- def __init__(
18
- self,
19
- instance: Any,
20
- timeout: int = 30,
21
- ) -> None:
22
- self.base_url = instance["url"]
23
- self.token = instance["token"]
24
- self.timeout = timeout
25
- self.session = requests.Session()
17
+ class AcsBaseApi(BaseModel):
18
+ url: str
19
+ token: str
20
+ timeout: int = 30
21
+ session: requests.Session = requests.Session()
22
+
23
+ class Config:
24
+ arbitrary_types_allowed = True
26
25
 
27
26
  def __enter__(self) -> Self:
28
27
  return self
@@ -58,7 +57,7 @@ class AcsBaseApi:
58
57
  def generic_request(
59
58
  self, path: str, verb: str, json: Optional[Any] = None
60
59
  ) -> requests.Response:
61
- url = f"{self.base_url}{path}"
60
+ url = f"{self.url}{path}"
62
61
  headers = {
63
62
  "Authorization": f"Bearer {self.token}",
64
63
  }