qontract-reconcile 0.10.2.dev92__py3-none-any.whl → 0.10.2.dev93__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.4
2
2
  Name: qontract-reconcile
3
- Version: 0.10.2.dev92
3
+ Version: 0.10.2.dev93
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
@@ -185,10 +185,10 @@ 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=usNTif2yrzWp7V24QHmMI1bd4QxwObYbxsqfJAYREXc,26576
188
+ reconcile/dynatrace_token_provider/integration.py,sha256=ysPto7wPZW_t3KFXyWOxRNQT140Q4OOe3Eu4BX0p6Uo,26505
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=MwYCZIxW4f-1jzFTxxN__sity6S8O7bbKUdyTFEVO7U,4325
191
+ reconcile/dynatrace_token_provider/ocm.py,sha256=7P0AoyAhAmvH9ffKMEE3HB9sCmWvrwYcSBscsVt5964,4729
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
@@ -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.dev92.dist-info/METADATA,sha256=jLJhRpJR82Z3TVBJRPKXiwDJF_rs9_Vz9L9aaajBipo,24565
790
- qontract_reconcile-0.10.2.dev92.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
791
- qontract_reconcile-0.10.2.dev92.dist-info/entry_points.txt,sha256=5i9l54La3vQrDLAdwDKQWC0iG4sV9RRfOb1BpvzOWLc,698
792
- qontract_reconcile-0.10.2.dev92.dist-info/RECORD,,
789
+ qontract_reconcile-0.10.2.dev93.dist-info/METADATA,sha256=OCfp9-cXH8VsKHhK1x5598Kh2bXedhZ9huHZ0qp59U8,24565
790
+ qontract_reconcile-0.10.2.dev93.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
791
+ qontract_reconcile-0.10.2.dev93.dist-info/entry_points.txt,sha256=5i9l54La3vQrDLAdwDKQWC0iG4sV9RRfOb1BpvzOWLc,698
792
+ qontract_reconcile-0.10.2.dev93.dist-info/RECORD,,
@@ -117,14 +117,14 @@ class DynatraceTokenProviderIntegration(QontractReconcileIntegration[NoParams]):
117
117
  token_spec = token_spec_by_name.get(cluster.token_spec_name)
118
118
  if not token_spec:
119
119
  logging.debug(
120
- f"[{cluster.external_id=}] Skipping cluster. {cluster.token_spec_name=} does not exist."
120
+ f"[{cluster.id=}] Skipping cluster. {cluster.token_spec_name=} does not exist."
121
121
  )
122
122
  continue
123
123
  if cluster.organization_id in token_spec.ocm_org_ids:
124
124
  filtered_clusters.append(cluster)
125
125
  else:
126
126
  logging.debug(
127
- f"[{cluster.external_id=}] Skipping cluster for {token_spec.name=}. {cluster.organization_id=} is not defined in {token_spec.ocm_org_ids=}."
127
+ f"[{cluster.id=}] Skipping cluster for {token_spec.name=}. {cluster.organization_id=} is not defined in {token_spec.ocm_org_ids=}."
128
128
  )
129
129
  return filtered_clusters
130
130
 
@@ -175,7 +175,7 @@ class DynatraceTokenProviderIntegration(QontractReconcileIntegration[NoParams]):
175
175
  error=f"Missing label {DTP_TENANT_LABEL}",
176
176
  )
177
177
  logging.warn(
178
- f"[{cluster.external_id=}] Missing value for label {DTP_TENANT_LABEL}"
178
+ f"[{cluster.id=}] Missing value for label {DTP_TENANT_LABEL}"
179
179
  )
180
180
  continue
181
181
  if (
@@ -188,7 +188,7 @@ class DynatraceTokenProviderIntegration(QontractReconcileIntegration[NoParams]):
188
188
  error=f"Dynatrace tenant {tenant_id} does not exist",
189
189
  )
190
190
  logging.warn(
191
- f"[{cluster.external_id=}] Dynatrace {tenant_id=} does not exist"
191
+ f"[{cluster.id=}] Dynatrace {tenant_id=} does not exist"
192
192
  )
193
193
  continue
194
194
  dt_client = dependencies.dynatrace_client_by_tenant_id[
@@ -205,7 +205,7 @@ class DynatraceTokenProviderIntegration(QontractReconcileIntegration[NoParams]):
205
205
  error=f"Token spec {cluster.token_spec_name} does not exist",
206
206
  )
207
207
  logging.warn(
208
- f"[{cluster.external_id=}] Token spec '{cluster.token_spec_name}' does not exist"
208
+ f"[{cluster.id=}] Token spec '{cluster.token_spec_name}' does not exist"
209
209
  )
210
210
  continue
211
211
  if tenant_id not in existing_dtp_tokens:
@@ -232,7 +232,7 @@ class DynatraceTokenProviderIntegration(QontractReconcileIntegration[NoParams]):
232
232
  )
233
233
  except Exception as e:
234
234
  unhandled_exceptions.append(
235
- f"{ocm_env_name}/{cluster.organization_id}/{cluster.external_id}: {e}"
235
+ f"{ocm_env_name}/{cluster.organization_id}/{cluster.id}: {e}"
236
236
  )
237
237
  self._expose_token_metrics()
238
238
 
@@ -289,11 +289,9 @@ class DynatraceTokenProviderIntegration(QontractReconcileIntegration[NoParams]):
289
289
  f"DTP can't create {token_spec.name=} {e.args!s}",
290
290
  )
291
291
  logging.info(
292
- f"{token_spec.name=} created in {dt_api_url} for {cluster.external_id=}."
293
- )
294
- logging.info(
295
- f"{SYNCSET_AND_MANIFEST_ID} created for {cluster.external_id=}."
292
+ f"{token_spec.name=} created in {dt_api_url} for {cluster.id=}."
296
293
  )
294
+ logging.info(f"{SYNCSET_AND_MANIFEST_ID} created for {cluster.id=}.")
297
295
  else:
298
296
  current_k8s_secrets: list[K8sSecret] = []
299
297
  if cluster.is_hcp:
@@ -344,7 +342,7 @@ class DynatraceTokenProviderIntegration(QontractReconcileIntegration[NoParams]):
344
342
  f"DTP can't patch {token_spec.name=} for {SYNCSET_AND_MANIFEST_ID} due to {e.args!s}",
345
343
  )
346
344
  logging.info(
347
- f"Patched {token_spec.name=} for {SYNCSET_AND_MANIFEST_ID} in {cluster.external_id=}."
345
+ f"Patched {token_spec.name=} for {SYNCSET_AND_MANIFEST_ID} in {cluster.id=}."
348
346
  )
349
347
 
350
348
  def scopes_hash(self, scopes: Iterable[str], length: int) -> str:
@@ -425,7 +423,7 @@ class DynatraceTokenProviderIntegration(QontractReconcileIntegration[NoParams]):
425
423
  dt_client, cluster_uuid, desired_token
426
424
  )
427
425
  existing_dtp_tokens[cur_token.id] = cur_token.name
428
- if cur_token:
426
+ if cur_token and cur_token.id in existing_dtp_tokens:
429
427
  self.sync_token_in_dynatrace(
430
428
  token_id=cur_token.id,
431
429
  spec=desired_token,
@@ -38,6 +38,9 @@ DTP_TENANT_LABEL = sre_capability_label_key("dtp", "tenant")
38
38
  DTP_SPEC_LABEL = sre_capability_label_key("dtp", "token-spec")
39
39
  DTP_LABEL_SEARCH = sre_capability_label_key("dtp", "%")
40
40
 
41
+ DTP_TENANT_V2_LABEL = sre_capability_label_key("dtp.v2", "tenant")
42
+ DTP_SPEC_V2_LABEL = sre_capability_label_key("dtp.v2", "token-spec")
43
+
41
44
 
42
45
  class Cluster(BaseModel):
43
46
  id: str
@@ -49,8 +52,14 @@ class Cluster(BaseModel):
49
52
 
50
53
  @staticmethod
51
54
  def from_cluster_details(cluster: ClusterDetails) -> Cluster:
52
- dt_tenant = cluster.labels.get_label_value(DTP_TENANT_LABEL)
53
- token_spec_name = cluster.labels.get_label_value(DTP_SPEC_LABEL)
55
+ dt_tenant = cluster.labels.get_label_value(DTP_TENANT_V2_LABEL)
56
+ token_spec_name = cluster.labels.get_label_value(DTP_SPEC_V2_LABEL)
57
+
58
+ # TODO: remove these fallbacks APPSRE-11584
59
+ if not dt_tenant:
60
+ dt_tenant = cluster.labels.get_label_value(DTP_TENANT_LABEL)
61
+ if not token_spec_name:
62
+ token_spec_name = cluster.labels.get_label_value(DTP_SPEC_LABEL)
54
63
  if not token_spec_name:
55
64
  """
56
65
  We want to stay backwards compatible.