qontract-reconcile 0.10.1rc752__py3-none-any.whl → 0.10.1rc754__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.1rc752
3
+ Version: 0.10.1rc754
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
@@ -10,7 +10,7 @@ reconcile/aws_iam_password_reset.py,sha256=NwErtrqgBiXr7eGCAHdtGGOx0S7-4JnSc29Ie
10
10
  reconcile/aws_support_cases_sos.py,sha256=Jk6_XjDeJSYxgRGqcEAOcynt9qJF2r5HPIPcSKmoBv8,2974
11
11
  reconcile/blackbox_exporter_endpoint_monitoring.py,sha256=W_VJagnsJR1v5oqjlI3RJJE0_nhtJ0m81RS8zWA5u5c,3538
12
12
  reconcile/checkpoint.py,sha256=R2WFXUXLTB4sWMi4GeA4eegsuf_1-Q4vH8M0Toh3Ij4,5036
13
- reconcile/cli.py,sha256=Vw8P6w0nPOGkMRvxpn4lR75jUeRoXLJ4R-WspWNX6Cg,98702
13
+ reconcile/cli.py,sha256=knLmE8YaI61Vg6tbcl5YW8HXIthq91yQknVtnXygCgY,99475
14
14
  reconcile/closedbox_endpoint_monitoring_base.py,sha256=SMhkcQqprWvThrIJa3U_3uh5w1h-alleW1QnCJFY4Qw,4909
15
15
  reconcile/cluster_deployment_mapper.py,sha256=2Ah-nu-Mdig0pjuiZl_XLrmVAjYzFjORR3dMlCgkmw0,2352
16
16
  reconcile/dashdotdb_base.py,sha256=a5aPLVxyqPSbjdB0Ty-uliOtxwvEbbEljHJKxdK3-Zk,4813
@@ -22,7 +22,7 @@ reconcile/database_access_manager.py,sha256=42dBJyihdwx4WjEBjwi3lUiDzQ1t_2ZFViJr
22
22
  reconcile/deadmanssnitch.py,sha256=n-5W-djUgwzpmdDM4eQIZpkkDmHY0vndt-42LJXI4Y8,7491
23
23
  reconcile/dynatrace_token_provider.py,sha256=P5jvMavremWp64LVknz1kCZI4aagwLrDDfXkmJ9diwY,17212
24
24
  reconcile/email_sender.py,sha256=-5L-Ag_jaEYSzYRoMr52KQBRXz1E8yx9GqLbg2X4XFU,3533
25
- reconcile/gabi_authorized_users.py,sha256=9kpSJGyMe_qYVHIgTFHhYf8E3lKSLO0Ia1WwK9ADNIE,4502
25
+ reconcile/gabi_authorized_users.py,sha256=4jJNtmEwLqg2-keuWZ3sjKV-OMn7C9pfXWWdssVua8Y,4883
26
26
  reconcile/gcr_mirror.py,sha256=PAMnIL7tRTwt8KMZf-wM2k0r_et3LBgyJCEeyuqEM5E,8827
27
27
  reconcile/github_org.py,sha256=0vst4YETf2voTiMHcREngSeuKtG7jOOILfFBQ0AOVQg,13479
28
28
  reconcile/github_owners.py,sha256=s9NDIqTbaqgGE5lj89eh3Sr52B-6SCUWQILzQlzGyxw,2949
@@ -250,6 +250,10 @@ reconcile/gql_definitions/dashdotdb_slo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5J
250
250
  reconcile/gql_definitions/dashdotdb_slo/slo_documents_query.py,sha256=zUa-CmpOwiymVmOV6KwDHH5mMl06p000320FcOas6hU,4315
251
251
  reconcile/gql_definitions/dynatrace_token_provider/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
252
252
  reconcile/gql_definitions/dynatrace_token_provider/dynatrace_bootstrap_tokens.py,sha256=38b9JR7gFTdID3EJO9zeqrCT1adbLrurOLYIGAKPxtA,2045
253
+ reconcile/gql_definitions/external_resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
254
+ reconcile/gql_definitions/external_resources/external_resources_modules.py,sha256=2VIb3hC2MRNhYDZ1al4PvudT2oSfd3fPGpzv4CEJNiw,2341
255
+ reconcile/gql_definitions/external_resources/external_resources_namespaces.py,sha256=UyOAUY1rROenjTz6y-uSEFjrEwhh-lPsIQPbi6EQLFg,40915
256
+ reconcile/gql_definitions/external_resources/external_resources_settings.py,sha256=O6zPVHjQX4RY6lcLx5uNiExfx3nO3aoyucmKxhXsL60,2342
253
257
  reconcile/gql_definitions/fragments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
254
258
  reconcile/gql_definitions/fragments/aus_organization.py,sha256=ARI87YAbC0VjFri9eVGYrRPBc4s0kWsa25RR8FFoq7E,4433
255
259
  reconcile/gql_definitions/fragments/aws_account_common.py,sha256=d_FwpS_dY8o8DCLa3NERs93FVxQLiDUIPm5tGNac-iw,2320
@@ -560,6 +564,7 @@ reconcile/typed_queries/clusters.py,sha256=tptLP2Ov1lNqtDGuPKBOVvpDtREm5CQFDDVyp
560
564
  reconcile/typed_queries/clusters_minimal.py,sha256=flvs4oXVR4b971h-zMTK3C2GL3bjMnvZgrAeI3XgBQQ,517
561
565
  reconcile/typed_queries/clusters_with_dms.py,sha256=hyNPaHBgUIhnAeuOSY5SG46U1zDp9KytUXEobkZdRlQ,551
562
566
  reconcile/typed_queries/clusters_with_peering.py,sha256=lIai7SJJD0bqIJbe7virgrbYRqjLouSL2OpJD0itpAY,330
567
+ reconcile/typed_queries/external_resources.py,sha256=vQEQwedYx_zoo94qdTSI4TMEg-rgmOOVoy19cKBlvN8,1540
563
568
  reconcile/typed_queries/get_state_aws_account.py,sha256=CSJjVPWsUZ2rkGIt8ehoQt7hokFqrUDgG9HFlg2lVD8,492
564
569
  reconcile/typed_queries/github_orgs.py,sha256=UZhoPl8qvA_tcO7CZlN8GuMKckt3ywd47Suu61rgHsc,258
565
570
  reconcile/typed_queries/gitlab_instances.py,sha256=ZVQHy2W9xIp53f5qYkjKLHLHgOVtQpxTfcmM1C2046g,291
@@ -778,8 +783,8 @@ tools/test/test_app_interface_metrics_exporter.py,sha256=SX7qL3D1SIRKFo95FoQztvf
778
783
  tools/test/test_qontract_cli.py,sha256=w2l4BHB09k1d-BGJ1jBUNCqDv7zkqYrMHojQXg-21kQ,4155
779
784
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
780
785
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
781
- qontract_reconcile-0.10.1rc752.dist-info/METADATA,sha256=-pk_8RW3Vy3d6CZqwwtyZx7jMvNTFI0YcXzmgGSuKl4,2382
782
- qontract_reconcile-0.10.1rc752.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
783
- qontract_reconcile-0.10.1rc752.dist-info/entry_points.txt,sha256=rIxI5zWtHNlfpDeq1a7pZXAPoqf7HG32KMTN3MeWK_8,429
784
- qontract_reconcile-0.10.1rc752.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
785
- qontract_reconcile-0.10.1rc752.dist-info/RECORD,,
786
+ qontract_reconcile-0.10.1rc754.dist-info/METADATA,sha256=OD3FoCxX0CTq2h4QAdvIIjPG_kpBIaUZmsRyAbRSduU,2382
787
+ qontract_reconcile-0.10.1rc754.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
788
+ qontract_reconcile-0.10.1rc754.dist-info/entry_points.txt,sha256=rIxI5zWtHNlfpDeq1a7pZXAPoqf7HG32KMTN3MeWK_8,429
789
+ qontract_reconcile-0.10.1rc754.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
790
+ qontract_reconcile-0.10.1rc754.dist-info/RECORD,,
reconcile/cli.py CHANGED
@@ -3512,6 +3512,33 @@ def deadmanssnitch(ctx):
3512
3512
  )
3513
3513
 
3514
3514
 
3515
+ @integration.command(short_help="Manages External Resources")
3516
+ @click.pass_context
3517
+ @threaded(default=5)
3518
+ @click.option("--cluster", help="Cluster where the Jobs will be created", default=None)
3519
+ @click.option(
3520
+ "--namespace", help="Namespace where the Jobs will be created", default=None
3521
+ )
3522
+ @click.option(
3523
+ "--dry-run-job-suffix",
3524
+ help="Suffix jons run in pr_checks. e.g: gitlab merge request id",
3525
+ default="",
3526
+ )
3527
+ def external_resources(
3528
+ ctx, cluster: str, namespace: str, dry_run_job_suffix: str, thread_pool_size: int
3529
+ ):
3530
+ import reconcile.external_resources.integration
3531
+
3532
+ run_integration(
3533
+ reconcile.external_resources.integration,
3534
+ ctx.obj,
3535
+ cluster,
3536
+ namespace,
3537
+ dry_run_job_suffix,
3538
+ thread_pool_size,
3539
+ )
3540
+
3541
+
3515
3542
  def get_integration_cli_meta() -> dict[str, IntegrationMeta]:
3516
3543
  """
3517
3544
  returns all integrations known to cli.py via click introspection
@@ -20,6 +20,7 @@ from reconcile import queries
20
20
  from reconcile.status import ExitCodes
21
21
  from reconcile.utils.aggregated_list import RunnerException
22
22
  from reconcile.utils.defer import defer
23
+ from reconcile.utils.disabled_integrations import integration_is_enabled
23
24
  from reconcile.utils.external_resources import get_external_resource_specs
24
25
  from reconcile.utils.openshift_resource import (
25
26
  OpenshiftResource,
@@ -76,6 +77,14 @@ def fetch_desired_state(
76
77
  namespace = i["namespace"]
77
78
  account = i["account"]
78
79
  identifier = i["identifier"]
80
+ cluster = namespace["cluster"]
81
+ if not integration_is_enabled(QONTRACT_INTEGRATION, cluster):
82
+ logging.debug(
83
+ f"For cluster {cluster['name']} the integration "
84
+ f"{QONTRACT_INTEGRATION} is not enabled. Skipping."
85
+ )
86
+ continue
87
+
79
88
  specs = get_external_resource_specs(namespace)
80
89
  found = False
81
90
  for spec in specs:
@@ -90,10 +99,10 @@ def fetch_desired_state(
90
99
  f'for account {account} in namespace {namespace["name"]}. '
91
100
  "If this is a removed read only instance, consider updating the identifier to the source replica."
92
101
  )
93
- users = get_usernames(g["users"], namespace["cluster"])
102
+ users = get_usernames(g["users"], cluster)
94
103
  resource = construct_gabi_oc_resource(g["name"], expiration_date, users)
95
104
  ri.add_desired(
96
- namespace["cluster"]["name"],
105
+ cluster["name"],
97
106
  namespace["name"],
98
107
  resource.kind,
99
108
  resource.name,
@@ -0,0 +1,72 @@
1
+ """
2
+ Generated by qenerate plugin=pydantic_v1. DO NOT MODIFY MANUALLY!
3
+ """
4
+ from collections.abc import Callable # noqa: F401 # pylint: disable=W0611
5
+ from datetime import datetime # noqa: F401 # pylint: disable=W0611
6
+ from enum import Enum # noqa: F401 # pylint: disable=W0611
7
+ from typing import ( # noqa: F401 # pylint: disable=W0611
8
+ Any,
9
+ Optional,
10
+ Union,
11
+ )
12
+
13
+ from pydantic import ( # noqa: F401 # pylint: disable=W0611
14
+ BaseModel,
15
+ Extra,
16
+ Field,
17
+ Json,
18
+ )
19
+
20
+
21
+ DEFINITION = """
22
+ query ExternalResourcesModules {
23
+ modules: external_resources_modules_v1 {
24
+ provision_provider
25
+ provider
26
+ module_type
27
+ image
28
+ default_version
29
+ reconcile_drift_interval_minutes
30
+ reconcile_timeout_minutes
31
+ }
32
+ }
33
+ """
34
+
35
+
36
+ class ConfiguredBaseModel(BaseModel):
37
+ class Config:
38
+ smart_union=True
39
+ extra=Extra.forbid
40
+
41
+
42
+ class ExternalResourcesModuleV1(ConfiguredBaseModel):
43
+ provision_provider: str = Field(..., alias="provision_provider")
44
+ provider: str = Field(..., alias="provider")
45
+ module_type: str = Field(..., alias="module_type")
46
+ image: str = Field(..., alias="image")
47
+ default_version: str = Field(..., alias="default_version")
48
+ reconcile_drift_interval_minutes: str = Field(..., alias="reconcile_drift_interval_minutes")
49
+ reconcile_timeout_minutes: str = Field(..., alias="reconcile_timeout_minutes")
50
+
51
+
52
+ class ExternalResourcesModulesQueryData(ConfiguredBaseModel):
53
+ modules: Optional[list[ExternalResourcesModuleV1]] = Field(..., alias="modules")
54
+
55
+
56
+ def query(query_func: Callable, **kwargs: Any) -> ExternalResourcesModulesQueryData:
57
+ """
58
+ This is a convenience function which queries and parses the data into
59
+ concrete types. It should be compatible with most GQL clients.
60
+ You do not have to use it to consume the generated data classes.
61
+ Alternatively, you can also mime and alternate the behavior
62
+ of this function in the caller.
63
+
64
+ Parameters:
65
+ query_func (Callable): Function which queries your GQL Server
66
+ kwargs: optional arguments that will be passed to the query function
67
+
68
+ Returns:
69
+ ExternalResourcesModulesQueryData: queried data parsed into generated classes
70
+ """
71
+ raw_data: dict[Any, Any] = query_func(DEFINITION, **kwargs)
72
+ return ExternalResourcesModulesQueryData(**raw_data)