qontract-reconcile 0.10.2.dev96__py3-none-any.whl → 0.10.2.dev98__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.2.dev96.dist-info → qontract_reconcile-0.10.2.dev98.dist-info}/METADATA +1 -1
- {qontract_reconcile-0.10.2.dev96.dist-info → qontract_reconcile-0.10.2.dev98.dist-info}/RECORD +8 -8
- reconcile/dynatrace_token_provider/integration.py +3 -3
- reconcile/dynatrace_token_provider/ocm.py +10 -21
- reconcile/external_resources/aws.py +14 -0
- reconcile/external_resources/reconciler.py +1 -1
- {qontract_reconcile-0.10.2.dev96.dist-info → qontract_reconcile-0.10.2.dev98.dist-info}/WHEEL +0 -0
- {qontract_reconcile-0.10.2.dev96.dist-info → qontract_reconcile-0.10.2.dev98.dist-info}/entry_points.txt +0 -0
{qontract_reconcile-0.10.2.dev96.dist-info → qontract_reconcile-0.10.2.dev98.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: qontract-reconcile
|
3
|
-
Version: 0.10.2.
|
3
|
+
Version: 0.10.2.dev98
|
4
4
|
Summary: Collection of tools to reconcile services with their desired state as defined in the app-interface DB.
|
5
5
|
Project-URL: homepage, https://github.com/app-sre/qontract-reconcile
|
6
6
|
Project-URL: repository, https://github.com/app-sre/qontract-reconcile
|
{qontract_reconcile-0.10.2.dev96.dist-info → qontract_reconcile-0.10.2.dev98.dist-info}/RECORD
RENAMED
@@ -185,17 +185,17 @@ reconcile/cna/assets/asset_factory.py,sha256=7T7X_J6xIsoGETqBRI45_EyIKEdQcnRPt_G
|
|
185
185
|
reconcile/cna/assets/null.py,sha256=85mVh97atCoC0aLuX47poTZiyOthmziJeBsUw0c924w,1658
|
186
186
|
reconcile/dynatrace_token_provider/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
187
187
|
reconcile/dynatrace_token_provider/dependencies.py,sha256=FuRUnK18EyJIIgFwQBZSskIG08mN2VQAcAcaJFTf8zc,2812
|
188
|
-
reconcile/dynatrace_token_provider/integration.py,sha256=
|
188
|
+
reconcile/dynatrace_token_provider/integration.py,sha256=RmptOa5CYrKNMZqCQhmP_AsC3L-BCKhjmM8otj6a7OY,26514
|
189
189
|
reconcile/dynatrace_token_provider/metrics.py,sha256=oP-6NTZENFdvWiS0krnmX6tq3xyOzQ8e6vS0CZWYUuw,1496
|
190
190
|
reconcile/dynatrace_token_provider/model.py,sha256=gkpqo5rRRueBXnIMjp4EEHqBUBuU65TRI8zpdb8GJ0A,241
|
191
|
-
reconcile/dynatrace_token_provider/ocm.py,sha256=
|
191
|
+
reconcile/dynatrace_token_provider/ocm.py,sha256=bryaK7xs7ygttUyZuSD9Up4laUhP6OUTr2VBbFiclpA,4298
|
192
192
|
reconcile/dynatrace_token_provider/validate.py,sha256=40_9QmHoB3-KBc0k_0D4QO00PpNNPS-gU9Z6cIcWga8,1920
|
193
193
|
reconcile/endpoints_discovery/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
194
194
|
reconcile/endpoints_discovery/integration.py,sha256=ecjIZK_h6JO2wUhUmJlZ9pjOh60nS5aenEWGDj6YJdw,14790
|
195
195
|
reconcile/endpoints_discovery/merge_request.py,sha256=_yLb4tnvoZMCko8rta2C_CvOInJa9pa3HzSmHNtjgGU,2978
|
196
196
|
reconcile/endpoints_discovery/merge_request_manager.py,sha256=a8zTIQIpRrUwXexZClwpQnnkEoS6XNZLJziI9x7ly0s,6389
|
197
197
|
reconcile/external_resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
198
|
-
reconcile/external_resources/aws.py,sha256=
|
198
|
+
reconcile/external_resources/aws.py,sha256=q9ub1vI4meG8YzM6A88Q422XkTu6Y3ja12GuMjCwISs,11631
|
199
199
|
reconcile/external_resources/factories.py,sha256=C0QHT0soEv6z99-ELAAE19S5MaMHhV0t1fSiQn0Coc4,5970
|
200
200
|
reconcile/external_resources/integration.py,sha256=JF38M7R0Z4ADUTx57TZqSZH9k_xpPlbAxQAcGyIISuM,6925
|
201
201
|
reconcile/external_resources/integration_secrets_sync.py,sha256=CImwt_tyS3MMGpkjI_0gZqYt4XgqIw4BtdJiDH2xrCk,1700
|
@@ -203,7 +203,7 @@ reconcile/external_resources/manager.py,sha256=mvFfcXPzvNqDWDgKTK8eiSe6C_FUvBtbe
|
|
203
203
|
reconcile/external_resources/meta.py,sha256=noaytFzmShpzLA_ebGh7wuP45mOfHIOnnoUxivjDa1I,672
|
204
204
|
reconcile/external_resources/metrics.py,sha256=KiBjMUaN_z0cSkF_7Ar_a8RiuiwVqjyMcVdISlxhzXE,3898
|
205
205
|
reconcile/external_resources/model.py,sha256=HrSkmAjOqw0aT3CsZKXKMLyocM__8XO5qHb-dXcoagw,13747
|
206
|
-
reconcile/external_resources/reconciler.py,sha256
|
206
|
+
reconcile/external_resources/reconciler.py,sha256=wB8cB5pmqDJ1_t5_Aly4mrULGnI3OQaKqUZCB_Z9RWw,9573
|
207
207
|
reconcile/external_resources/secrets_sync.py,sha256=ZDxzGZ6wC4zxLhA7-L39xDRH6rzUM285gytuzmRQdlw,16208
|
208
208
|
reconcile/external_resources/state.py,sha256=gF3ACdl7YiUlbQ4uEGrD6i_Txxqr6mT9f8IFlTQ-8dY,13176
|
209
209
|
reconcile/fleet_labeler/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -786,7 +786,7 @@ tools/saas_promotion_state/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
|
|
786
786
|
tools/saas_promotion_state/saas_promotion_state.py,sha256=UfwwRLS5Ya4_Nh1w5n1dvoYtchQvYE9yj1VANt2IKqI,3925
|
787
787
|
tools/sre_checkpoints/__init__.py,sha256=CDaDaywJnmRCLyl_NCcvxi-Zc0hTi_3OdwKiFOyS39I,145
|
788
788
|
tools/sre_checkpoints/util.py,sha256=zEDbGr18ZeHNQwW8pUsr2JRjuXIPz--WAGJxZo9sv_Y,894
|
789
|
-
qontract_reconcile-0.10.2.
|
790
|
-
qontract_reconcile-0.10.2.
|
791
|
-
qontract_reconcile-0.10.2.
|
792
|
-
qontract_reconcile-0.10.2.
|
789
|
+
qontract_reconcile-0.10.2.dev98.dist-info/METADATA,sha256=MejCD_NtyQK68CSmDQ5laTsLKIDzMVDVp_YkPtbRvMs,24565
|
790
|
+
qontract_reconcile-0.10.2.dev98.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
791
|
+
qontract_reconcile-0.10.2.dev98.dist-info/entry_points.txt,sha256=5i9l54La3vQrDLAdwDKQWC0iG4sV9RRfOb1BpvzOWLc,698
|
792
|
+
qontract_reconcile-0.10.2.dev98.dist-info/RECORD,,
|
@@ -16,7 +16,7 @@ from reconcile.dynatrace_token_provider.metrics import (
|
|
16
16
|
from reconcile.dynatrace_token_provider.model import DynatraceAPIToken, K8sSecret
|
17
17
|
from reconcile.dynatrace_token_provider.ocm import (
|
18
18
|
DTP_LABEL_SEARCH,
|
19
|
-
|
19
|
+
DTP_TENANT_V2_LABEL,
|
20
20
|
Cluster,
|
21
21
|
OCMClient,
|
22
22
|
)
|
@@ -172,10 +172,10 @@ class DynatraceTokenProviderIntegration(QontractReconcileIntegration[NoParams]):
|
|
172
172
|
_expose_errors_as_service_log(
|
173
173
|
ocm_client,
|
174
174
|
cluster_uuid=cluster.external_id,
|
175
|
-
error=f"Missing label {
|
175
|
+
error=f"Missing label {DTP_TENANT_V2_LABEL}",
|
176
176
|
)
|
177
177
|
logging.warn(
|
178
|
-
f"[{cluster.id=}] Missing value for label {
|
178
|
+
f"[{cluster.id=}] Missing value for label {DTP_TENANT_V2_LABEL}"
|
179
179
|
)
|
180
180
|
continue
|
181
181
|
if (
|
@@ -1,5 +1,6 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
|
+
import logging
|
3
4
|
from collections.abc import Mapping
|
4
5
|
from datetime import timedelta
|
5
6
|
from typing import Any
|
@@ -34,10 +35,7 @@ from reconcile.utils.ocm_base_client import (
|
|
34
35
|
Thin abstractions of reconcile.ocm module to reduce coupling.
|
35
36
|
"""
|
36
37
|
|
37
|
-
DTP_TENANT_LABEL = sre_capability_label_key("dtp", "tenant")
|
38
|
-
DTP_SPEC_LABEL = sre_capability_label_key("dtp", "token-spec")
|
39
38
|
DTP_LABEL_SEARCH = sre_capability_label_key("dtp", "%")
|
40
|
-
|
41
39
|
DTP_TENANT_V2_LABEL = sre_capability_label_key("dtp.v2", "tenant")
|
42
40
|
DTP_SPEC_V2_LABEL = sre_capability_label_key("dtp.v2", "token-spec")
|
43
41
|
|
@@ -51,24 +49,14 @@ class Cluster(BaseModel):
|
|
51
49
|
is_hcp: bool
|
52
50
|
|
53
51
|
@staticmethod
|
54
|
-
def from_cluster_details(cluster: ClusterDetails) -> Cluster:
|
52
|
+
def from_cluster_details(cluster: ClusterDetails) -> Cluster | None:
|
55
53
|
dt_tenant = cluster.labels.get_label_value(DTP_TENANT_V2_LABEL)
|
56
54
|
token_spec_name = cluster.labels.get_label_value(DTP_SPEC_V2_LABEL)
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
token_spec_name = cluster.labels.get_label_value(DTP_SPEC_LABEL)
|
63
|
-
if not token_spec_name:
|
64
|
-
"""
|
65
|
-
We want to stay backwards compatible.
|
66
|
-
Earlier version of DTP did not set a value for the label.
|
67
|
-
We fall back to a default token in that case.
|
68
|
-
|
69
|
-
Long-term, we want to remove this behavior.
|
70
|
-
"""
|
71
|
-
token_spec_name = "hypershift-management-cluster-v1"
|
55
|
+
if not dt_tenant or not token_spec_name:
|
56
|
+
logging.warning(
|
57
|
+
f"[Missing DTP labels] {cluster.ocm_cluster.id=} {cluster.ocm_cluster.subscription.id=} {dt_tenant=} {token_spec_name=}"
|
58
|
+
)
|
59
|
+
return None
|
72
60
|
return Cluster(
|
73
61
|
id=cluster.ocm_cluster.id,
|
74
62
|
external_id=cluster.ocm_cluster.external_id,
|
@@ -131,10 +119,11 @@ class OCMClient:
|
|
131
119
|
|
132
120
|
def discover_clusters_by_labels(self, label_filter: Filter) -> list[Cluster]:
|
133
121
|
return [
|
134
|
-
|
135
|
-
for
|
122
|
+
cluster
|
123
|
+
for ocm_cluster in discover_clusters_by_labels(
|
136
124
|
ocm_api=self._ocm_client, label_filter=label_filter
|
137
125
|
)
|
126
|
+
if (cluster := Cluster.from_cluster_details(ocm_cluster))
|
138
127
|
]
|
139
128
|
|
140
129
|
def create_service_log(
|
@@ -139,6 +139,17 @@ class AWSRdsFactory(AWSDefaultResourceFactory):
|
|
139
139
|
"aws", provisioner, "kms", identifier
|
140
140
|
)
|
141
141
|
|
142
|
+
def _get_region_from_az(self, az: str) -> str:
|
143
|
+
if not az or len(az) < 2:
|
144
|
+
raise ValueError(
|
145
|
+
f"Invalid availability zone: '{az}'. Availability zone must have at least 2 characters."
|
146
|
+
)
|
147
|
+
if not az[-1].isalpha():
|
148
|
+
raise ValueError(
|
149
|
+
f"Invalid availability zone: '{az}'. The AZ should end with a letter (e.g., 'us-east-1a')."
|
150
|
+
)
|
151
|
+
return az[:-1]
|
152
|
+
|
142
153
|
def resolve(
|
143
154
|
self,
|
144
155
|
spec: ExternalResourceSpec,
|
@@ -168,6 +179,9 @@ class AWSRdsFactory(AWSDefaultResourceFactory):
|
|
168
179
|
"identifier": sourcedb["identifier"],
|
169
180
|
"region": sourcedb_region,
|
170
181
|
}
|
182
|
+
# If AZ is set, but not the region, the region is got from the AZ
|
183
|
+
if "availability_zone" in data and "region" not in data:
|
184
|
+
data["region"] = self._get_region_from_az(data["availability_zone"])
|
171
185
|
|
172
186
|
kms_key_id: str = data.get("kms_key_id", None)
|
173
187
|
if kms_key_id and not kms_key_id.startswith("arn:"):
|
@@ -85,7 +85,7 @@ class ReconciliationK8sJob(K8sJob, BaseModel, frozen=True):
|
|
85
85
|
return {
|
86
86
|
"provision_provider": self.reconciliation.key.provision_provider,
|
87
87
|
"provisioner": self.reconciliation.key.provisioner_name,
|
88
|
-
"provider": self.reconciliation.key.
|
88
|
+
"provider": self.reconciliation.key.provider,
|
89
89
|
"identifier": self.reconciliation.key.identifier,
|
90
90
|
}
|
91
91
|
|
{qontract_reconcile-0.10.2.dev96.dist-info → qontract_reconcile-0.10.2.dev98.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|