qontract-reconcile 0.10.1rc481__py3-none-any.whl → 0.10.1rc483__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.1rc481
3
+ Version: 0.10.1rc483
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
@@ -68,7 +68,7 @@ reconcile/openshift_namespaces.py,sha256=DboMc6t0vXD54lL9ZP9P9fQnCRo2g_0z5FWubtW
68
68
  reconcile/openshift_network_policies.py,sha256=_qqv7yj17OM1J8KJPsFmzFZ85gzESJeBocC672z4_WU,4231
69
69
  reconcile/openshift_resourcequotas.py,sha256=yUi56PiOn3inMMfq_x_FEHmaW-reGipzoorjdar372g,2415
70
70
  reconcile/openshift_resources.py,sha256=kwsY5cko7udEKNlhL2oKiKv_5wzEw9wmmwROE016ng8,1400
71
- reconcile/openshift_resources_base.py,sha256=aMrblZnviFMiAPS5SZsYWmGIRA-l8XlHwtxPr_klui0,45728
71
+ reconcile/openshift_resources_base.py,sha256=p0YEHJrRgpFQOVvs5vAGDhLno_OJMHWMxnICEEQHFxk,45669
72
72
  reconcile/openshift_rolebindings.py,sha256=0sEKajdqVuBSzlagyPbLxtNXQdI2vyabmbIRifs0des,6629
73
73
  reconcile/openshift_routes.py,sha256=fXvuPSjcjVw1X3j2EQvUAdbOepmIFdKk-M3qP8QzPiw,1075
74
74
  reconcile/openshift_saas_deploy.py,sha256=MySDWBQN2N3rv_B8ifWzRY5t2Afq3DEVkFECHMpW_Sk,11908
@@ -407,7 +407,7 @@ reconcile/test/test_openshift_saas_deploy.py,sha256=YLJGkc--u5aP0UkQ-b9ZGEFGS2gw
407
407
  reconcile/test/test_openshift_saas_deploy_change_tester.py,sha256=1yVe54Hx9YdVjn6qdnKge5Sa_s732c-8uZqCnuT1gGI,12871
408
408
  reconcile/test/test_openshift_tekton_resources.py,sha256=RtRWsdm51S13OSkENC9nY_rOH0QELSCaO5tjF0XqIDI,11222
409
409
  reconcile/test/test_openshift_upgrade_watcher.py,sha256=na5Q5l88c0ZHMh82gvNpYheoMOAzEZRG0ZvzzDhafYE,7100
410
- reconcile/test/test_prometheus_rules_tester.py,sha256=Qc9J4k0lSVie361lGr_cOy0EaBTD5LDqGZf7CYVFKr8,5677
410
+ reconcile/test/test_prometheus_rules_tester.py,sha256=nj17JNpjArMKwLc1B7Y6Ca-tkO24Y-yXhQXB78Mco0o,5968
411
411
  reconcile/test/test_quay_membership.py,sha256=e29Giz5S9ckFgjpTO8PBo8qVPocIQmy4WqsRhgTFd9A,2643
412
412
  reconcile/test/test_quay_mirror.py,sha256=-oPPFjx2OmzTwZ5oxblrvx2y4zzgUj8SYHdnjcOIqCE,5693
413
413
  reconcile/test/test_quay_mirror_org.py,sha256=eudGIGCUlYul2UHx4Ku6zFvwLeJtRyOIx06XuwFox2U,2630
@@ -567,7 +567,7 @@ reconcile/utils/state.py,sha256=-a3fOnGZnDRcTXw9Hg3QtGdKePGtnmoCkPeCt-5HgbE,1367
567
567
  reconcile/utils/structs.py,sha256=LcbLEg8WxfRqM6nW7NhcWN0YeqF7SQzxOgntmLs1SgY,352
568
568
  reconcile/utils/template.py,sha256=wTvRU4AnAV_o042tD4Mwls2dwWMuk7MKnde3MaCjaYg,331
569
569
  reconcile/utils/terraform_client.py,sha256=V7AMQOEU4tvUOT-LQN2cXLqcphD5L93PMGMfurQQyPY,31753
570
- reconcile/utils/terrascript_aws_client.py,sha256=zGVd9DLUKLucyCiYlNqt5O39kLTwEdgSGwKE86326DE,262689
570
+ reconcile/utils/terrascript_aws_client.py,sha256=V1Gs9aKVqWlnSfA1jyfRQvmrHrJQ7gClbuzmEeSImNA,262908
571
571
  reconcile/utils/three_way_diff_strategy.py,sha256=nyqeQsLCoPI6e16k2CF3b9KNgQLU-rPf5RtfdUfVMwE,4468
572
572
  reconcile/utils/throughput.py,sha256=iP4UWAe2LVhDo69mPPmgo9nQ7RxHD6_GS8MZe-aSiuM,344
573
573
  reconcile/utils/unleash.py,sha256=1D56CsZfE3ShDtN3IErE1T2eeIwNmxhK-yYbCotJ99E,3601
@@ -650,8 +650,8 @@ tools/test/test_app_interface_metrics_exporter.py,sha256=SX7qL3D1SIRKFo95FoQztvf
650
650
  tools/test/test_qontract_cli.py,sha256=awwTHEc2DWlykuqGIYM0WOBoSL0KRnOraCLk3C7izis,1401
651
651
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
652
652
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
653
- qontract_reconcile-0.10.1rc481.dist-info/METADATA,sha256=jZMsz3VARFTAKwiJcGIRi44sy1t2hVDVdYZ-4tWkqg8,2348
654
- qontract_reconcile-0.10.1rc481.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
655
- qontract_reconcile-0.10.1rc481.dist-info/entry_points.txt,sha256=rTjAv28I_CHLM8ID3OPqMI_suoQ9s7tFbim4aYjn9kk,376
656
- qontract_reconcile-0.10.1rc481.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
657
- qontract_reconcile-0.10.1rc481.dist-info/RECORD,,
653
+ qontract_reconcile-0.10.1rc483.dist-info/METADATA,sha256=B1PHnviRfQ_7JdO4SaqPjqnfPfz4_Rghq9Y78KK2Xq4,2348
654
+ qontract_reconcile-0.10.1rc483.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
655
+ qontract_reconcile-0.10.1rc483.dist-info/entry_points.txt,sha256=rTjAv28I_CHLM8ID3OPqMI_suoQ9s7tFbim4aYjn9kk,376
656
+ qontract_reconcile-0.10.1rc483.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
657
+ qontract_reconcile-0.10.1rc483.dist-info/RECORD,,
@@ -6,55 +6,32 @@ import logging
6
6
  import re
7
7
  import sys
8
8
  from collections import defaultdict
9
- from collections.abc import (
10
- Iterable,
11
- Mapping,
12
- Sequence,
13
- )
9
+ from collections.abc import Iterable, Mapping, Sequence
14
10
  from contextlib import contextmanager
15
11
  from dataclasses import dataclass
16
12
  from functools import cache
17
13
  from textwrap import indent
18
14
  from threading import Lock
19
- from typing import (
20
- Any,
21
- Optional,
22
- Protocol,
23
- Tuple,
24
- )
15
+ from typing import Any, Optional, Protocol, Tuple
25
16
  from urllib import parse
26
17
 
27
18
  import anymarkup
28
19
  import jinja2
29
20
  import jinja2.sandbox
30
21
  from deepdiff import DeepHash
31
- from sretoolbox.utils import (
32
- retry,
33
- threaded,
34
- )
22
+ from sretoolbox.utils import retry, threaded
35
23
 
36
24
  import reconcile.openshift_base as ob
37
25
  from reconcile import queries
38
26
  from reconcile.change_owners.diff import IDENTIFIER_FIELD_NAME
39
27
  from reconcile.checkpoint import url_makes_sense
40
28
  from reconcile.github_users import init_github
41
- from reconcile.utils import (
42
- amtool,
43
- gql,
44
- openssl,
45
- )
29
+ from reconcile.typed_queries.app_interface_repo_url import get_app_interface_repo_url
30
+ from reconcile.utils import amtool, gql, openssl
46
31
  from reconcile.utils.defer import defer
47
32
  from reconcile.utils.exceptions import FetchResourceError
48
- from reconcile.utils.jinja2_ext import (
49
- B64EncodeExtension,
50
- RaiseErrorExtension,
51
- )
52
- from reconcile.utils.oc import (
53
- OC_Map,
54
- OCClient,
55
- OCLogMsg,
56
- StatusCodeError,
57
- )
33
+ from reconcile.utils.jinja2_ext import B64EncodeExtension, RaiseErrorExtension
34
+ from reconcile.utils.oc import OC_Map, OCClient, OCLogMsg, StatusCodeError
58
35
  from reconcile.utils.openshift_resource import (
59
36
  ConstructResourceError,
60
37
  ResourceInventory,
@@ -67,10 +44,7 @@ from reconcile.utils.runtime.integration import DesiredStateShardConfig
67
44
  from reconcile.utils.secret_reader import SecretReader
68
45
  from reconcile.utils.semver_helper import make_semver
69
46
  from reconcile.utils.sharding import is_in_shard
70
- from reconcile.utils.vault import (
71
- SecretVersionIsNone,
72
- SecretVersionNotFound,
73
- )
47
+ from reconcile.utils.vault import SecretVersionIsNone, SecretVersionNotFound
74
48
 
75
49
  # +-----------------------+-------------------------+-------------+
76
50
  # | Current / Desired | Present | Not Present |
@@ -224,7 +198,6 @@ NAMESPACES_QUERY = """
224
198
  QONTRACT_INTEGRATION = "openshift_resources_base"
225
199
  QONTRACT_INTEGRATION_VERSION = make_semver(1, 9, 2)
226
200
  QONTRACT_BASE64_SUFFIX = "_qb64"
227
- APP_INT_BASE_URL = "https://gitlab.cee.redhat.com/service/app-interface"
228
201
  KUBERNETES_SECRET_DATA_KEY_RE = "^[-._a-zA-Z0-9]+$"
229
202
 
230
203
  _log_lock = Lock()
@@ -488,6 +461,8 @@ def fetch_provider_resource(
488
461
  ) -> OR:
489
462
  path = resource["path"]
490
463
  content = resource["content"]
464
+ gqlapi = gql.get_api()
465
+ app_int_base_url = get_app_interface_repo_url(query_func=gqlapi.query)
491
466
  if tfunc:
492
467
  content = tfunc(body=content, vars=tvars, settings=settings)
493
468
 
@@ -544,9 +519,8 @@ def fetch_provider_resource(
544
519
  annotations = rule.get("annotations")
545
520
  if not annotations:
546
521
  continue
547
- # TODO(mafriedm): make this better
548
522
  rule["annotations"]["html_url"] = (
549
- f"{APP_INT_BASE_URL}/blob/master/resources{path}"
523
+ f"{app_int_base_url}/blob/master/resources{path}"
550
524
  )
551
525
  except Exception:
552
526
  logging.warning(
@@ -1,20 +1,17 @@
1
1
  from typing import Any
2
- from unittest.mock import (
3
- create_autospec,
4
- patch,
5
- )
2
+ from unittest.mock import create_autospec, patch
6
3
 
7
4
  import pytest
8
5
 
6
+ from reconcile.gql_definitions.common.app_interface_repo_settings import (
7
+ DEFINITION as SETTINGS_QUERY,
8
+ )
9
9
  from reconcile.gql_definitions.common.app_interface_vault_settings import (
10
10
  AppInterfaceSettingsV1,
11
11
  )
12
12
  from reconcile.openshift_resources_base import NAMESPACES_QUERY
13
13
  from reconcile.prometheus_rules_tester.integration import Test as PTest
14
- from reconcile.prometheus_rules_tester.integration import (
15
- check_rules_and_tests,
16
- run,
17
- )
14
+ from reconcile.prometheus_rules_tester.integration import check_rules_and_tests, run
18
15
  from reconcile.status import ExitCodes
19
16
  from reconcile.utils import gql
20
17
 
@@ -42,6 +39,12 @@ class TestPrometheusRulesTester:
42
39
  """Mock for GqlApi.query using test_data set in setup_method."""
43
40
  if query == NAMESPACES_QUERY:
44
41
  return {"namespaces": self.ns_data}
42
+ if query == SETTINGS_QUERY:
43
+ return {
44
+ "settings": [
45
+ {"repoUrl": "https://gitlab.cee.redhat.com/service/app-interface"}
46
+ ]
47
+ }
45
48
 
46
49
  raise TstUnsupportedGqlQueryError("Unsupported query")
47
50
 
@@ -2620,7 +2620,7 @@ class TerrascriptClient: # pylint: disable=too-many-public-methods
2620
2620
 
2621
2621
  if "subscriptions" in common_values.keys():
2622
2622
  subscriptions = common_values.get("subscriptions")
2623
- for sub in subscriptions:
2623
+ for index, sub in enumerate(subscriptions):
2624
2624
  sub_values = {}
2625
2625
  sub_values["topic_arn"] = "${aws_sns_topic" + "." + identifier + ".arn}"
2626
2626
  protocol = sub["protocol"]
@@ -2630,7 +2630,11 @@ class TerrascriptClient: # pylint: disable=too-many-public-methods
2630
2630
  raise ValueError(msg)
2631
2631
  sub_values["protocol"] = protocol
2632
2632
  sub_values["endpoint"] = endpoint
2633
- sub_identifier = f"{identifier}_{protocol}_aws_sns_topic_subscription"
2633
+ # append suffix only in case there are multiple subscriptions
2634
+ suffix = f"_{index + 1}" if len(subscriptions) > 1 else ""
2635
+ sub_identifier = (
2636
+ f"{identifier}_{protocol}_aws_sns_topic_subscription{suffix}"
2637
+ )
2634
2638
  sub_tf_resource = aws_sns_topic_subscription(
2635
2639
  sub_identifier, **sub_values
2636
2640
  )