qontract-reconcile 0.10.1rc726__py3-none-any.whl → 0.10.1rc728__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.1rc726
3
+ Version: 0.10.1rc728
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
@@ -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=lAZ68_w6IcvXfB6C8D97DtdRlpodqjrCGLLYGvRUkSs,96887
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
@@ -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
@@ -574,7 +574,7 @@ reconcile/typed_queries/terraform_tgw_attachments/__init__.py,sha256=47DEQpj8HBS
574
574
  reconcile/typed_queries/terraform_tgw_attachments/aws_accounts.py,sha256=T5HSeyBcGKP-LzDmIzs-WlBwOtSenYpm0Odw5--xdOg,410
575
575
  reconcile/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
576
576
  reconcile/utils/aggregated_list.py,sha256=pkYoBj7WwmaNgEefETqEOFTnQMcUzHE3mdsVdzGYj60,3372
577
- reconcile/utils/amtool.py,sha256=JV5-to_e_FaIcvJWTKYA9d6L3LwzwijM0MjUWn83eD4,2204
577
+ reconcile/utils/amtool.py,sha256=Rg6_TTvuS7M2QbOkIjy2sRetvf6aNVdv_DA9ugSgMi4,2303
578
578
  reconcile/utils/aws_api.py,sha256=3VLg_MBih9SY9u43ZFbsaFNbDr086CJ7qQdTCfA-Rjo,66258
579
579
  reconcile/utils/aws_helper.py,sha256=MDbv5jrNdqqJ5pfBxniGdJXBBO_EYc2_Uf2w9ZzeMNs,2854
580
580
  reconcile/utils/binary.py,sha256=EsOGg82Y2QJh91SGJE0tYpBKqU0iaaagQVoYONBtQn8,2359
@@ -631,7 +631,7 @@ reconcile/utils/parse_dhms_duration.py,sha256=TONpLnec5gHeF7k815YNJpQyDjXhkxZIcv
631
631
  reconcile/utils/password_validator.py,sha256=XwuWg-8CPlcuG7dl_oQ1G1h2gSVSnfMym_VkuprpWVg,2183
632
632
  reconcile/utils/prometheus.py,sha256=i5aCQ_I4WOg76iEjglVxxO9-OKby2N80ScErAbDtHE8,3848
633
633
  reconcile/utils/promotion_state.py,sha256=avYxHUf4zK3dBhXEdUEry79EOSgJ7gfStvvOpcedZnI,2575
634
- reconcile/utils/promtool.py,sha256=IYNCjj5xDAEdxv6Z0pLdrIcybDfHHtWE9Z6f4LSPcG4,2791
634
+ reconcile/utils/promtool.py,sha256=kT2rFZSBaRqW7SSHAuYzGZzQxM5Dzk8KW1NnEUYZU_s,2896
635
635
  reconcile/utils/quay_api.py,sha256=EuOegpb-7ntEjkKLFwM2Oo4Nw7SyFtmyl3sQ9aXMtrM,8152
636
636
  reconcile/utils/raw_github_api.py,sha256=ZHC-SZuAyRe1zaMoOU7Krt1-zecDxENd9c_NzQYqK9g,2968
637
637
  reconcile/utils/repo_owners.py,sha256=j-pUjc9PuDzq7KpjNLpnhqfU8tUG4nj2WMhFp4ick7g,6629
@@ -746,7 +746,7 @@ tools/app_interface_metrics_exporter.py,sha256=zkwkxdAUAxjdc-pzx2_oJXG25fo0Fnyd5
746
746
  tools/app_interface_reporter.py,sha256=upA-J-n-HXHKVDINRuMR7vTt-iJvQORKUVi9D3leQto,17738
747
747
  tools/glitchtip_access_reporter.py,sha256=oPBnk_YoDuljU3v0FaChzOwwnk4vap1xEE67QEjzdqs,2948
748
748
  tools/glitchtip_access_revalidation.py,sha256=8kbBJk04mkq28kWoRDDkfCGIF3GRg3pJrFAh1sW0dbk,2821
749
- tools/qontract_cli.py,sha256=vm1uti_uMmPKiDE2gP_VXqoURqrq5YmIFZhQU6u3p2U,115670
749
+ tools/qontract_cli.py,sha256=eZONmZCLrSgMQFKHKxElDmw2_4Ld-Ug-FEFR2c8QnXI,116018
750
750
  tools/sd_app_sre_alert_report.py,sha256=e9vAdyenUz2f5c8-z-5WY0wv-SJ9aePKDH2r4IwB6pc,5063
751
751
  tools/template_validation.py,sha256=-U-lTGeLaci8yWPEblCJeev2DOlY1jM9QOOh-O1zts8,3376
752
752
  tools/cli_commands/__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.1rc726.dist-info/METADATA,sha256=maRuGUrFAdwK_5cRbjB9kQKeQ8tguoeeNWVasWTEEUE,2382
768
- qontract_reconcile-0.10.1rc726.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
769
- qontract_reconcile-0.10.1rc726.dist-info/entry_points.txt,sha256=rIxI5zWtHNlfpDeq1a7pZXAPoqf7HG32KMTN3MeWK_8,429
770
- qontract_reconcile-0.10.1rc726.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
771
- qontract_reconcile-0.10.1rc726.dist-info/RECORD,,
767
+ qontract_reconcile-0.10.1rc728.dist-info/METADATA,sha256=_84XLm_9y_XV3Mquz9MRlnb3ILeO-o07s_ZloANJWV0,2382
768
+ qontract_reconcile-0.10.1rc728.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
769
+ qontract_reconcile-0.10.1rc728.dist-info/entry_points.txt,sha256=rIxI5zWtHNlfpDeq1a7pZXAPoqf7HG32KMTN3MeWK_8,429
770
+ qontract_reconcile-0.10.1rc728.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
771
+ qontract_reconcile-0.10.1rc728.dist-info/RECORD,,
reconcile/cli.py CHANGED
@@ -23,6 +23,7 @@ from reconcile.status import (
23
23
  )
24
24
  from reconcile.utils import gql
25
25
  from reconcile.utils.aggregated_list import RunnerException
26
+ from reconcile.utils.amtool import AMTOOL_VERSION, AMTOOL_VERSION_REGEX
26
27
  from reconcile.utils.binary import (
27
28
  binary,
28
29
  binary_version,
@@ -30,6 +31,7 @@ from reconcile.utils.binary import (
30
31
  from reconcile.utils.exceptions import PrintToFileInGitRepositoryError
31
32
  from reconcile.utils.git import is_file_in_git_repo
32
33
  from reconcile.utils.gql import GqlApiSingleton
34
+ from reconcile.utils.promtool import PROMTOOL_VERSION, PROMTOOL_VERSION_REGEX
33
35
  from reconcile.utils.runtime.environment import init_env
34
36
  from reconcile.utils.runtime.integration import (
35
37
  ModuleArgsKwargsRunParams,
@@ -1278,6 +1280,7 @@ def aws_support_cases_sos(ctx, gitlab_project_id, thread_pool_size):
1278
1280
  @threaded()
1279
1281
  @binary(["oc", "ssh", "amtool"])
1280
1282
  @binary_version("oc", ["version", "--client"], OC_VERSION_REGEX, OC_VERSIONS)
1283
+ @binary_version("amtool", ["--version"], AMTOOL_VERSION_REGEX, AMTOOL_VERSION)
1281
1284
  @internal()
1282
1285
  @use_jump_host()
1283
1286
  @cluster_name
@@ -3010,6 +3013,7 @@ def dashdotdb_dora(ctx, gitlab_project_id, thread_pool_size):
3010
3013
  @integration.command(short_help="Tests prometheus rules using promtool.")
3011
3014
  @threaded(default=5)
3012
3015
  @binary(["promtool"])
3016
+ @binary_version("promtool", ["--version"], PROMTOOL_VERSION_REGEX, PROMTOOL_VERSION)
3013
3017
  @cluster_name
3014
3018
  @click.pass_context
3015
3019
  def prometheus_rules_tester(ctx, thread_pool_size, cluster_name):
@@ -3019,7 +3023,7 @@ def prometheus_rules_tester(ctx, thread_pool_size, cluster_name):
3019
3023
  reconcile.prometheus_rules_tester.integration,
3020
3024
  ctx.obj,
3021
3025
  thread_pool_size,
3022
- cluster_name=cluster_name,
3026
+ cluster_names=cluster_name,
3023
3027
  )
3024
3028
 
3025
3029
 
@@ -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,
@@ -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
reconcile/utils/amtool.py CHANGED
@@ -7,6 +7,9 @@ from subprocess import (
7
7
  run,
8
8
  )
9
9
 
10
+ AMTOOL_VERSION = ["0.24.0"]
11
+ AMTOOL_VERSION_REGEX = r"^amtool,\sversion\s([\d]+\.[\d]+\.[\d]+).+$"
12
+
10
13
 
11
14
  class AmtoolResult:
12
15
  """This class represents a amtool command execution result"""
@@ -13,6 +13,9 @@ import yaml
13
13
  from reconcile.utils.defer import defer
14
14
  from reconcile.utils.structs import CommandExecutionResult
15
15
 
16
+ PROMTOOL_VERSION = ["2.33.3"]
17
+ PROMTOOL_VERSION_REGEX = r"^promtool,\sversion\s([\d]+\.[\d]+\.[\d]+).+$"
18
+
16
19
 
17
20
  def check_rule(yaml_spec: Mapping) -> CommandExecutionResult:
18
21
  """Run promtool check rules on the given yaml spec given as dict"""
tools/qontract_cli.py CHANGED
@@ -83,8 +83,13 @@ from reconcile.utils import (
83
83
  config,
84
84
  dnsutils,
85
85
  gql,
86
+ promtool,
86
87
  )
87
88
  from reconcile.utils.aws_api import AWSApi
89
+ from reconcile.utils.binary import (
90
+ binary,
91
+ binary_version,
92
+ )
88
93
  from reconcile.utils.early_exit_cache import (
89
94
  CacheKey,
90
95
  CacheKeyWithDigest,
@@ -3051,6 +3056,13 @@ def template(ctx, cluster, namespace, kind, name, path, secret_reader):
3051
3056
 
3052
3057
 
3053
3058
  @root.command()
3059
+ @binary(["promtool"])
3060
+ @binary_version(
3061
+ "promtool",
3062
+ ["--version"],
3063
+ promtool.PROMTOOL_VERSION_REGEX,
3064
+ promtool.PROMTOOL_VERSION,
3065
+ )
3054
3066
  @click.argument("path")
3055
3067
  @click.argument("cluster")
3056
3068
  @click.option(
@@ -3106,6 +3118,10 @@ def run_prometheus_test(ctx, path, cluster, namespace, secret_reader):
3106
3118
 
3107
3119
 
3108
3120
  @root.command()
3121
+ @binary(["amtool"])
3122
+ @binary_version(
3123
+ "amtool", ["--version"], amtool.AMTOOL_VERSION_REGEX, amtool.AMTOOL_VERSION
3124
+ )
3109
3125
  @click.argument("cluster")
3110
3126
  @click.argument("namespace")
3111
3127
  @click.argument("rules_path")