qontract-reconcile 0.10.1rc810__py3-none-any.whl → 0.10.1rc812__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.
- {qontract_reconcile-0.10.1rc810.dist-info → qontract_reconcile-0.10.1rc812.dist-info}/METADATA +1 -1
- {qontract_reconcile-0.10.1rc810.dist-info → qontract_reconcile-0.10.1rc812.dist-info}/RECORD +9 -7
- reconcile/cli.py +4 -4
- reconcile/dynatrace_token_provider/__init__.py +0 -0
- reconcile/{dynatrace_token_provider.py → dynatrace_token_provider/integration.py} +13 -53
- reconcile/dynatrace_token_provider/metrics.py +43 -0
- {qontract_reconcile-0.10.1rc810.dist-info → qontract_reconcile-0.10.1rc812.dist-info}/WHEEL +0 -0
- {qontract_reconcile-0.10.1rc810.dist-info → qontract_reconcile-0.10.1rc812.dist-info}/entry_points.txt +0 -0
- {qontract_reconcile-0.10.1rc810.dist-info → qontract_reconcile-0.10.1rc812.dist-info}/top_level.txt +0 -0
{qontract_reconcile-0.10.1rc810.dist-info → qontract_reconcile-0.10.1rc812.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: qontract-reconcile
|
3
|
-
Version: 0.10.
|
3
|
+
Version: 0.10.1rc812
|
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
|
{qontract_reconcile-0.10.1rc810.dist-info → qontract_reconcile-0.10.1rc812.dist-info}/RECORD
RENAMED
@@ -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=
|
13
|
+
reconcile/cli.py,sha256=laiCfiVjXsDnT5z18q_XGkH6tZdBSxKVva7nF4B0OQw,101452
|
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
|
@@ -20,7 +20,6 @@ reconcile/dashdotdb_dvo.py,sha256=YXqpI6fBQAql-ybGI0grj9gWMzmKiAvPE__pNju6obk,89
|
|
20
20
|
reconcile/dashdotdb_slo.py,sha256=bf1WSh5JP9obHVQsMy0OO71_VTYZgwAopElFZM6DmRo,6714
|
21
21
|
reconcile/database_access_manager.py,sha256=42dBJyihdwx4WjEBjwi3lUiDzQ1t_2ZFViJri2c4_aE,25716
|
22
22
|
reconcile/deadmanssnitch.py,sha256=n-5W-djUgwzpmdDM4eQIZpkkDmHY0vndt-42LJXI4Y8,7491
|
23
|
-
reconcile/dynatrace_token_provider.py,sha256=P5jvMavremWp64LVknz1kCZI4aagwLrDDfXkmJ9diwY,17212
|
24
23
|
reconcile/email_sender.py,sha256=-5L-Ag_jaEYSzYRoMr52KQBRXz1E8yx9GqLbg2X4XFU,3533
|
25
24
|
reconcile/gabi_authorized_users.py,sha256=4jJNtmEwLqg2-keuWZ3sjKV-OMn7C9pfXWWdssVua8Y,4883
|
26
25
|
reconcile/gcr_mirror.py,sha256=PAMnIL7tRTwt8KMZf-wM2k0r_et3LBgyJCEeyuqEM5E,8827
|
@@ -178,6 +177,9 @@ reconcile/cna/assets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
|
|
178
177
|
reconcile/cna/assets/asset.py,sha256=1v51uYSaD1NOc9cI_YxG7h0NOcR1ng-mkmD2UzQ8PXE,866
|
179
178
|
reconcile/cna/assets/asset_factory.py,sha256=7T7X_J6xIsoGETqBRI45_EyIKEdQcnRPt_GAuVuLQcc,785
|
180
179
|
reconcile/cna/assets/null.py,sha256=Fby1Fbn7oNRIGNasdyhRDvXJ0ktpxv-pUAPN0lZWSzk,1684
|
180
|
+
reconcile/dynatrace_token_provider/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
181
|
+
reconcile/dynatrace_token_provider/integration.py,sha256=d13ulyEYD9U32D6s641o_Oibx1g4f6jr1vHQL_KbZts,16257
|
182
|
+
reconcile/dynatrace_token_provider/metrics.py,sha256=F92Vh8CQBFs-bCF3pNpd8ZqsBwqgyK-A6pOCu_eAI1s,1074
|
181
183
|
reconcile/external_resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
182
184
|
reconcile/external_resources/aws.py,sha256=JvjKaABy2Pg8u8Lq82Acv4zMvpE3_qGKes7OG-zlHOM,2956
|
183
185
|
reconcile/external_resources/factories.py,sha256=bLboXX5Dq0xN60mtDGNjCOLC6HlKofXMWQxVbRwMMwo,4485
|
@@ -804,8 +806,8 @@ tools/test/test_app_interface_metrics_exporter.py,sha256=SX7qL3D1SIRKFo95FoQztvf
|
|
804
806
|
tools/test/test_qontract_cli.py,sha256=_D61RFGAN5x44CY1tYbouhlGXXABwYfxKSWSQx3Jrss,4941
|
805
807
|
tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
|
806
808
|
tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
|
807
|
-
qontract_reconcile-0.10.
|
808
|
-
qontract_reconcile-0.10.
|
809
|
-
qontract_reconcile-0.10.
|
810
|
-
qontract_reconcile-0.10.
|
811
|
-
qontract_reconcile-0.10.
|
809
|
+
qontract_reconcile-0.10.1rc812.dist-info/METADATA,sha256=QXU980PcvIHdOFuelv2B6GonzS6eVILVn804A1venVA,2314
|
810
|
+
qontract_reconcile-0.10.1rc812.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
811
|
+
qontract_reconcile-0.10.1rc812.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
|
812
|
+
qontract_reconcile-0.10.1rc812.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
|
813
|
+
qontract_reconcile-0.10.1rc812.dist-info/RECORD,,
|
reconcile/cli.py
CHANGED
@@ -2953,20 +2953,20 @@ def cluster_auth_rhidp(ctx):
|
|
2953
2953
|
)
|
2954
2954
|
@click.option(
|
2955
2955
|
"--ocm-org-ids",
|
2956
|
-
help="A comma seperated list of OCM organization IDs DTP should
|
2956
|
+
help="A comma seperated list of OCM organization IDs DTP should operate on. If none is specified, all organizations are considered.",
|
2957
2957
|
required=False,
|
2958
2958
|
envvar="DTP_OCM_ORG_IDS",
|
2959
2959
|
)
|
2960
2960
|
@click.pass_context
|
2961
2961
|
def dynatrace_token_provider(ctx, ocm_org_ids):
|
2962
|
-
from reconcile import
|
2963
|
-
|
2962
|
+
from reconcile.dynatrace_token_provider.integration import (
|
2963
|
+
DynatraceTokenProviderIntegration,
|
2964
2964
|
DynatraceTokenProviderIntegrationParams,
|
2965
2965
|
)
|
2966
2966
|
|
2967
2967
|
parsed_ocm_org_ids = set(ocm_org_ids.split(",")) if ocm_org_ids else None
|
2968
2968
|
run_class_integration(
|
2969
|
-
integration=
|
2969
|
+
integration=DynatraceTokenProviderIntegration(
|
2970
2970
|
DynatraceTokenProviderIntegrationParams(
|
2971
2971
|
ocm_organization_ids=parsed_ocm_org_ids
|
2972
2972
|
)
|
File without changes
|
@@ -1,18 +1,19 @@
|
|
1
1
|
import base64
|
2
2
|
import logging
|
3
3
|
import sys
|
4
|
+
from collections.abc import Iterable
|
4
5
|
from datetime import timedelta
|
5
6
|
from typing import (
|
6
7
|
Any,
|
7
8
|
Mapping,
|
8
|
-
Optional,
|
9
|
-
Union,
|
10
9
|
)
|
11
10
|
|
12
11
|
from dynatrace import Dynatrace
|
13
12
|
from dynatrace.environment_v2.tokens_api import ApiTokenCreated
|
14
|
-
from pydantic import BaseModel
|
15
13
|
|
14
|
+
from reconcile.dynatrace_token_provider.metrics import (
|
15
|
+
DTPOrganizationErrorRate,
|
16
|
+
)
|
16
17
|
from reconcile.gql_definitions.common.ocm_environments import (
|
17
18
|
query as ocm_environment_query,
|
18
19
|
)
|
@@ -27,10 +28,6 @@ from reconcile.utils import (
|
|
27
28
|
gql,
|
28
29
|
metrics,
|
29
30
|
)
|
30
|
-
from reconcile.utils.metrics import (
|
31
|
-
CounterMetric,
|
32
|
-
ErrorRateMetricSet,
|
33
|
-
)
|
34
31
|
from reconcile.utils.ocm.base import (
|
35
32
|
OCMClusterServiceLogCreateModel,
|
36
33
|
OCMServiceLogSeverity,
|
@@ -66,11 +63,11 @@ DYNATRACE_OPERATOR_TOKEN_NAME = "dynatrace-operator-token"
|
|
66
63
|
|
67
64
|
|
68
65
|
class DynatraceTokenProviderIntegrationParams(PydanticRunParams):
|
69
|
-
ocm_organization_ids:
|
66
|
+
ocm_organization_ids: set[str] | None = None
|
70
67
|
|
71
68
|
|
72
69
|
class ReconcileErrorSummary(Exception):
|
73
|
-
def __init__(self, exceptions:
|
70
|
+
def __init__(self, exceptions: Iterable[str]) -> None:
|
74
71
|
self.exceptions = exceptions
|
75
72
|
|
76
73
|
def __str__(self) -> str:
|
@@ -78,43 +75,6 @@ class ReconcileErrorSummary(Exception):
|
|
78
75
|
return f"Reconcile exceptions:\n{formatted_exceptions}"
|
79
76
|
|
80
77
|
|
81
|
-
class DTPBaseMetric(BaseModel):
|
82
|
-
integration: str
|
83
|
-
ocm_env: str
|
84
|
-
|
85
|
-
|
86
|
-
class DTPOrganizationReconcileCounter(DTPBaseMetric, CounterMetric):
|
87
|
-
org_id: str
|
88
|
-
|
89
|
-
@classmethod
|
90
|
-
def name(cls) -> str:
|
91
|
-
return "dtp_organization_reconciled"
|
92
|
-
|
93
|
-
|
94
|
-
class DTPOrganizationReconcileErrorCounter(DTPBaseMetric, CounterMetric):
|
95
|
-
org_id: str
|
96
|
-
|
97
|
-
@classmethod
|
98
|
-
def name(cls) -> str:
|
99
|
-
return "dtp_organization_reconcile_errors"
|
100
|
-
|
101
|
-
|
102
|
-
class DTPOrganizationErrorRate(ErrorRateMetricSet):
|
103
|
-
def __init__(self, integration: str, org_id: str, ocm_env: str) -> None:
|
104
|
-
super().__init__(
|
105
|
-
counter=DTPOrganizationReconcileCounter(
|
106
|
-
integration=integration,
|
107
|
-
ocm_env=ocm_env,
|
108
|
-
org_id=org_id,
|
109
|
-
),
|
110
|
-
error_counter=DTPOrganizationReconcileErrorCounter(
|
111
|
-
integration=integration,
|
112
|
-
ocm_env=ocm_env,
|
113
|
-
org_id=org_id,
|
114
|
-
),
|
115
|
-
)
|
116
|
-
|
117
|
-
|
118
78
|
class DynatraceTokenProviderIntegration(
|
119
79
|
QontractReconcileIntegration[DynatraceTokenProviderIntegrationParams]
|
120
80
|
):
|
@@ -201,7 +161,7 @@ class DynatraceTokenProviderIntegration(
|
|
201
161
|
|
202
162
|
def get_all_dynatrace_clients(
|
203
163
|
self, secret_reader: SecretReaderBase
|
204
|
-
) ->
|
164
|
+
) -> dict[str, Dynatrace]:
|
205
165
|
dt_tenants = self.get_all_dynatrace_tenants()
|
206
166
|
dynatrace_clients = {}
|
207
167
|
if not dt_tenants.environments:
|
@@ -230,7 +190,7 @@ class DynatraceTokenProviderIntegration(
|
|
230
190
|
cluster: ClusterDetails,
|
231
191
|
dt_client: Dynatrace,
|
232
192
|
ocm_client: OCMBaseClient,
|
233
|
-
existing_dtp_tokens:
|
193
|
+
existing_dtp_tokens: Iterable[str],
|
234
194
|
tenant_id: str,
|
235
195
|
) -> None:
|
236
196
|
existing_syncset = self.get_syncset(ocm_client, cluster)
|
@@ -316,7 +276,7 @@ class DynatraceTokenProviderIntegration(
|
|
316
276
|
|
317
277
|
def get_syncset(
|
318
278
|
self, ocm_client: OCMBaseClient, cluster: ClusterDetails
|
319
|
-
) ->
|
279
|
+
) -> dict[str, Any]:
|
320
280
|
try:
|
321
281
|
syncset = get_syncset(ocm_client, cluster.ocm_cluster.id, SYNCSET_ID)
|
322
282
|
except Exception as e:
|
@@ -326,8 +286,8 @@ class DynatraceTokenProviderIntegration(
|
|
326
286
|
raise e
|
327
287
|
return syncset
|
328
288
|
|
329
|
-
def get_tokens_from_syncset(self, syncset: Mapping) ->
|
330
|
-
tokens = {}
|
289
|
+
def get_tokens_from_syncset(self, syncset: Mapping[str, Any]) -> dict:
|
290
|
+
tokens: dict[str, Any] = {}
|
331
291
|
for resource in syncset["resources"]:
|
332
292
|
if resource["kind"] == "Secret":
|
333
293
|
operator_token_id = self.base64_decode(resource["data"]["apiTokenId"])
|
@@ -424,7 +384,7 @@ class DynatraceTokenProviderIntegration(
|
|
424
384
|
return (ingestion_token, operation_token)
|
425
385
|
|
426
386
|
|
427
|
-
def dtp_label_key(config_atom:
|
387
|
+
def dtp_label_key(config_atom: str | None) -> str:
|
428
388
|
return sre_capability_label_key("dtp", config_atom)
|
429
389
|
|
430
390
|
|
@@ -436,7 +396,7 @@ def _expose_errors_as_service_log(
|
|
436
396
|
service_log=OCMClusterServiceLogCreateModel(
|
437
397
|
cluster_uuid=cluster_uuid,
|
438
398
|
severity=OCMServiceLogSeverity.Warning,
|
439
|
-
summary="
|
399
|
+
summary="Dynatrace Token Provider Errors",
|
440
400
|
description=f"\n {error}",
|
441
401
|
service_name=QONTRACT_INTEGRATION,
|
442
402
|
),
|
@@ -0,0 +1,43 @@
|
|
1
|
+
from pydantic import BaseModel
|
2
|
+
|
3
|
+
from reconcile.utils.metrics import (
|
4
|
+
CounterMetric,
|
5
|
+
ErrorRateMetricSet,
|
6
|
+
)
|
7
|
+
|
8
|
+
|
9
|
+
class DTPBaseMetric(BaseModel):
|
10
|
+
integration: str
|
11
|
+
ocm_env: str
|
12
|
+
|
13
|
+
|
14
|
+
class DTPOrganizationReconcileCounter(DTPBaseMetric, CounterMetric):
|
15
|
+
org_id: str
|
16
|
+
|
17
|
+
@classmethod
|
18
|
+
def name(cls) -> str:
|
19
|
+
return "dtp_organization_reconciled"
|
20
|
+
|
21
|
+
|
22
|
+
class DTPOrganizationReconcileErrorCounter(DTPBaseMetric, CounterMetric):
|
23
|
+
org_id: str
|
24
|
+
|
25
|
+
@classmethod
|
26
|
+
def name(cls) -> str:
|
27
|
+
return "dtp_organization_reconcile_errors"
|
28
|
+
|
29
|
+
|
30
|
+
class DTPOrganizationErrorRate(ErrorRateMetricSet):
|
31
|
+
def __init__(self, integration: str, org_id: str, ocm_env: str) -> None:
|
32
|
+
super().__init__(
|
33
|
+
counter=DTPOrganizationReconcileCounter(
|
34
|
+
integration=integration,
|
35
|
+
ocm_env=ocm_env,
|
36
|
+
org_id=org_id,
|
37
|
+
),
|
38
|
+
error_counter=DTPOrganizationReconcileErrorCounter(
|
39
|
+
integration=integration,
|
40
|
+
ocm_env=ocm_env,
|
41
|
+
org_id=org_id,
|
42
|
+
),
|
43
|
+
)
|
File without changes
|
File without changes
|
{qontract_reconcile-0.10.1rc810.dist-info → qontract_reconcile-0.10.1rc812.dist-info}/top_level.txt
RENAMED
File without changes
|