qontract-reconcile 0.10.2.dev297__py3-none-any.whl → 0.10.2.dev299__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.dev297
3
+ Version: 0.10.2.dev299
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
@@ -66,7 +66,7 @@ reconcile/openshift_prometheus_rules.py,sha256=FVVx1D7KCUnNZh7NwVNbD6t4lXKRSO7ph
66
66
  reconcile/openshift_resourcequotas.py,sha256=0CSuCre3T2ON42Ku1UDhTRugfmUNBx8PILpxIQaAzJU,2882
67
67
  reconcile/openshift_resources.py,sha256=YnhDxCvsp0muxEmULiqWhoar9EzxohTrnbY-U7oS5Hc,1603
68
68
  reconcile/openshift_resources_base.py,sha256=2oOURMtVDsPDG--lPN7c8ar0FPziCm695J2lV3VnVjk,43036
69
- reconcile/openshift_rhcs_certs.py,sha256=RUIEetvirJ-38VV3_Zen6Chi2vPgPaEdRMNXGR1JhSM,10325
69
+ reconcile/openshift_rhcs_certs.py,sha256=tuEz6Wzw5jrHM7fAOSS5d5pDV5SDY0uhjWrlYtCCSYk,10547
70
70
  reconcile/openshift_rolebindings.py,sha256=Mani4fSG6v55cPlAaQ1bmSBza_mFkNtMhdJFjTMGX0o,7250
71
71
  reconcile/openshift_routes.py,sha256=xnA34f32xDdkfV2MXIC1QURFJioQUsXT8AZBiY7iSP0,1298
72
72
  reconcile/openshift_saas_deploy.py,sha256=0_C9OoLGfzoAJ4M2UyCVC9HeHa5w-jP7l0_RxJMRO4k,13131
@@ -213,7 +213,7 @@ reconcile/glitchtip_project_alerts/integration.py,sha256=d3PMy-mQSbSZdIGAVaZCA2U
213
213
  reconcile/glitchtip_project_dsn/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
214
214
  reconcile/glitchtip_project_dsn/integration.py,sha256=3GgcqUM6hWhLpo9Yx5Xr9vrdexF-WNevVCNL9bJ0Upc,8162
215
215
  reconcile/gql_definitions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
216
- reconcile/gql_definitions/introspection.json,sha256=Aak1w7K7K1fhgZoZNN2gQ2TV3Jwh0X2GhqfpqRLwWp4,2359202
216
+ reconcile/gql_definitions/introspection.json,sha256=jJN4kUVnrBkb39pHZ0lwt_0ZuIyrhjyzsL17pQuGwXo,2358826
217
217
  reconcile/gql_definitions/acs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
218
218
  reconcile/gql_definitions/acs/acs_instances.py,sha256=L91WW9LbhJbBSrECqShQpFtjoBOsmNIYLRpMbx1io5o,2181
219
219
  reconcile/gql_definitions/acs/acs_policies.py,sha256=Ygpfl2-VkYLSlJvHgp_dJBfb66K_Rwfdfpsa18w1v1s,4338
@@ -386,7 +386,7 @@ reconcile/gql_definitions/openshift_serviceaccount_tokens/tokens.py,sha256=Ferae
386
386
  reconcile/gql_definitions/quay_membership/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
387
387
  reconcile/gql_definitions/quay_membership/quay_membership.py,sha256=MKBkrE-1YYelaAAxOdpqUwCo45kOVC8q29vXArqK_zM,3075
388
388
  reconcile/gql_definitions/rhcs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
389
- reconcile/gql_definitions/rhcs/certs.py,sha256=8ba9GZVY70ppekuxrMjE4wm6WqcMW2IFawjhWvxHrmI,4677
389
+ reconcile/gql_definitions/rhcs/certs.py,sha256=UXTPcX6A7wJzGOgNMymlJi1KTaBDkelwexCTc0KpJU8,6792
390
390
  reconcile/gql_definitions/rhidp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
391
391
  reconcile/gql_definitions/rhidp/organizations.py,sha256=dW9y3ewFu3E-DFrZAi_SEewHYR0MWYeOB52vwnVcq5E,2580
392
392
  reconcile/gql_definitions/service_dependencies/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -426,7 +426,7 @@ reconcile/gql_definitions/terraform_repo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5
426
426
  reconcile/gql_definitions/terraform_repo/terraform_repo.py,sha256=9cDKdP9ziBh9J_mw2Gi6GUOP4mFxMABY_D62qSeMtJI,3881
427
427
  reconcile/gql_definitions/terraform_resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
428
428
  reconcile/gql_definitions/terraform_resources/database_access_manager.py,sha256=yv0_YC-LmhaKD_gyGG3le1w5BtypBjlsO894-Zgdg4U,4813
429
- reconcile/gql_definitions/terraform_resources/terraform_resources_namespaces.py,sha256=EKqXL8Bx6NXqsVI4nfyQpKq8B_uHQl0L7QWnerBQTy0,44668
429
+ reconcile/gql_definitions/terraform_resources/terraform_resources_namespaces.py,sha256=j1xemQQIjR4O80Ni4RbJhDOWzk9iYcGinO79jZ3kZow,44688
430
430
  reconcile/gql_definitions/terraform_tgw_attachments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
431
431
  reconcile/gql_definitions/terraform_tgw_attachments/aws_accounts.py,sha256=r6RacQX243Rrtm_6wobSLJZlObehqzkV-seyCVCqiv8,2596
432
432
  reconcile/gql_definitions/unleash_feature_toggles/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -658,7 +658,7 @@ reconcile/utils/sqs_gateway.py,sha256=XNIf3PY4UCPNufP2Ul0UJj3fKlt5larBba-VTT-41F
658
658
  reconcile/utils/state.py,sha256=vCHYIfrWLfPyIWEHSaADWlc4OqhwcOiqM3Egqvw-lfo,16372
659
659
  reconcile/utils/structs.py,sha256=LcbLEg8WxfRqM6nW7NhcWN0YeqF7SQzxOgntmLs1SgY,352
660
660
  reconcile/utils/terraform_client.py,sha256=GoLbfs4d4YItNCeV3NZnrth4sD8ziNYgY2IszruRDpg,37303
661
- reconcile/utils/terrascript_aws_client.py,sha256=jVzh5PmphbCAN7Pog_PFYHoHj7lmQGb6Q4FwT_c8pF8,295634
661
+ reconcile/utils/terrascript_aws_client.py,sha256=o5-K61gEbQN48IRfdHVDfgt0sW-sYN9WYho4ZZ7j7io,295917
662
662
  reconcile/utils/three_way_diff_strategy.py,sha256=oQcHXd9LVhirJfoaOBoHUYuZVGfyL2voKr6KVI34zZE,4833
663
663
  reconcile/utils/throughput.py,sha256=iP4UWAe2LVhDo69mPPmgo9nQ7RxHD6_GS8MZe-aSiuM,344
664
664
  reconcile/utils/vault.py,sha256=6V15LByFghp-U3k0N4lum6V7qt2EAlRfcAxjy5e-FAU,15146
@@ -796,7 +796,7 @@ tools/saas_promotion_state/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
796
796
  tools/saas_promotion_state/saas_promotion_state.py,sha256=uQv2QJAmUXP1g2GPIH30WTlvL9soY6m9lefpZEVDM5w,3965
797
797
  tools/sre_checkpoints/__init__.py,sha256=CDaDaywJnmRCLyl_NCcvxi-Zc0hTi_3OdwKiFOyS39I,145
798
798
  tools/sre_checkpoints/util.py,sha256=zEDbGr18ZeHNQwW8pUsr2JRjuXIPz--WAGJxZo9sv_Y,894
799
- qontract_reconcile-0.10.2.dev297.dist-info/METADATA,sha256=iGF5qMFr_OjJTe4VrXqoImqpXd6uvpYs0wXPJhdp1q0,24916
800
- qontract_reconcile-0.10.2.dev297.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
801
- qontract_reconcile-0.10.2.dev297.dist-info/entry_points.txt,sha256=5i9l54La3vQrDLAdwDKQWC0iG4sV9RRfOb1BpvzOWLc,698
802
- qontract_reconcile-0.10.2.dev297.dist-info/RECORD,,
799
+ qontract_reconcile-0.10.2.dev299.dist-info/METADATA,sha256=54Nao8mXsCO6eAMPlZPwsMC2JeDlPEBuT1Xgnk40mJk,24916
800
+ qontract_reconcile-0.10.2.dev299.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
801
+ qontract_reconcile-0.10.2.dev299.dist-info/entry_points.txt,sha256=5i9l54La3vQrDLAdwDKQWC0iG4sV9RRfOb1BpvzOWLc,698
802
+ qontract_reconcile-0.10.2.dev299.dist-info/RECORD,,
@@ -47157,13 +47157,9 @@
47157
47157
  "description": null,
47158
47158
  "args": [],
47159
47159
  "type": {
47160
- "kind": "NON_NULL",
47161
- "name": null,
47162
- "ofType": {
47163
- "kind": "SCALAR",
47164
- "name": "String",
47165
- "ofType": null
47166
- }
47160
+ "kind": "SCALAR",
47161
+ "name": "String",
47162
+ "ofType": null
47167
47163
  },
47168
47164
  "isDeprecated": false,
47169
47165
  "deprecationReason": null
@@ -47173,13 +47169,9 @@
47173
47169
  "description": null,
47174
47170
  "args": [],
47175
47171
  "type": {
47176
- "kind": "NON_NULL",
47177
- "name": null,
47178
- "ofType": {
47179
- "kind": "SCALAR",
47180
- "name": "String",
47181
- "ofType": null
47182
- }
47172
+ "kind": "SCALAR",
47173
+ "name": "String",
47174
+ "ofType": null
47183
47175
  },
47184
47176
  "isDeprecated": false,
47185
47177
  "deprecationReason": null
@@ -61,6 +61,24 @@ query RhcsCerts {
61
61
  annotations
62
62
  }
63
63
  }
64
+ sharedResources {
65
+ openshiftResources {
66
+ provider
67
+ ... on NamespaceOpenshiftResourceRhcsCert_v1 {
68
+ secret_name
69
+ service_account_name
70
+ service_account_password {
71
+ ... on VaultSecret_v1 {
72
+ path
73
+ field
74
+ version
75
+ }
76
+ }
77
+ auto_renew_threshold_days
78
+ annotations
79
+ }
80
+ }
81
+ }
64
82
  cluster {
65
83
  name
66
84
  serverUrl
@@ -112,6 +130,32 @@ class NamespaceOpenshiftResourceRhcsCertV1(NamespaceOpenshiftResourceV1):
112
130
  annotations: Optional[Json] = Field(..., alias="annotations")
113
131
 
114
132
 
133
+ class SharedResourcesV1_NamespaceOpenshiftResourceV1(ConfiguredBaseModel):
134
+ provider: str = Field(..., alias="provider")
135
+
136
+
137
+ class SharedResourcesV1_NamespaceOpenshiftResourceV1_NamespaceOpenshiftResourceRhcsCertV1_VaultSecretV1(ConfiguredBaseModel):
138
+ ...
139
+
140
+
141
+ class SharedResourcesV1_NamespaceOpenshiftResourceV1_NamespaceOpenshiftResourceRhcsCertV1_VaultSecretV1_VaultSecretV1(SharedResourcesV1_NamespaceOpenshiftResourceV1_NamespaceOpenshiftResourceRhcsCertV1_VaultSecretV1):
142
+ path: str = Field(..., alias="path")
143
+ field: str = Field(..., alias="field")
144
+ version: Optional[int] = Field(..., alias="version")
145
+
146
+
147
+ class SharedResourcesV1_NamespaceOpenshiftResourceV1_NamespaceOpenshiftResourceRhcsCertV1(SharedResourcesV1_NamespaceOpenshiftResourceV1):
148
+ secret_name: str = Field(..., alias="secret_name")
149
+ service_account_name: str = Field(..., alias="service_account_name")
150
+ service_account_password: Union[SharedResourcesV1_NamespaceOpenshiftResourceV1_NamespaceOpenshiftResourceRhcsCertV1_VaultSecretV1_VaultSecretV1, SharedResourcesV1_NamespaceOpenshiftResourceV1_NamespaceOpenshiftResourceRhcsCertV1_VaultSecretV1] = Field(..., alias="service_account_password")
151
+ auto_renew_threshold_days: Optional[int] = Field(..., alias="auto_renew_threshold_days")
152
+ annotations: Optional[Json] = Field(..., alias="annotations")
153
+
154
+
155
+ class SharedResourcesV1(ConfiguredBaseModel):
156
+ openshift_resources: list[Union[SharedResourcesV1_NamespaceOpenshiftResourceV1_NamespaceOpenshiftResourceRhcsCertV1, SharedResourcesV1_NamespaceOpenshiftResourceV1]] = Field(..., alias="openshiftResources")
157
+
158
+
115
159
  class DisableClusterAutomationsV1(ConfiguredBaseModel):
116
160
  integrations: Optional[list[str]] = Field(..., alias="integrations")
117
161
 
@@ -132,6 +176,7 @@ class NamespaceV1(ConfiguredBaseModel):
132
176
  delete: Optional[bool] = Field(..., alias="delete")
133
177
  cluster_admin: Optional[bool] = Field(..., alias="clusterAdmin")
134
178
  openshift_resources: Optional[list[Union[NamespaceOpenshiftResourceRhcsCertV1, NamespaceOpenshiftResourceV1]]] = Field(..., alias="openshiftResources")
179
+ shared_resources: Optional[list[SharedResourcesV1]] = Field(..., alias="sharedResources")
135
180
  cluster: ClusterV1 = Field(..., alias="cluster")
136
181
 
137
182
 
@@ -817,8 +817,8 @@ class NamespaceTerraformResourceS3CloudFrontPublicKeyV1(NamespaceTerraformResour
817
817
 
818
818
  class NamespaceTerraformResourceALBMutualAuthenticationV1(ConfiguredBaseModel):
819
819
  mode: str = Field(..., alias="mode")
820
- ca_cert_bundle_s3_bucket_name: str = Field(..., alias="ca_cert_bundle_s3_bucket_name")
821
- ca_cert_bundle_s3_bucket_key: str = Field(..., alias="ca_cert_bundle_s3_bucket_key")
820
+ ca_cert_bundle_s3_bucket_name: Optional[str] = Field(..., alias="ca_cert_bundle_s3_bucket_name")
821
+ ca_cert_bundle_s3_bucket_key: Optional[str] = Field(..., alias="ca_cert_bundle_s3_bucket_key")
822
822
 
823
823
 
824
824
  class NamespaceTerraformResourceALBTargetHealthcheckV1(ConfiguredBaseModel):
@@ -2,7 +2,7 @@ import logging
2
2
  import sys
3
3
  import time
4
4
  from collections.abc import Callable, Iterable, Mapping
5
- from typing import Any
5
+ from typing import Any, cast
6
6
 
7
7
  import reconcile.openshift_base as ob
8
8
  import reconcile.openshift_resources_base as orb
@@ -67,20 +67,25 @@ class OpenshiftRhcsCertExpiration(GaugeMetric):
67
67
  return "qontract_reconcile_rhcs_cert_expiration_timestamp"
68
68
 
69
69
 
70
+ def _is_rhcs_cert(obj: Any) -> bool:
71
+ return getattr(obj, "provider", None) == "rhcs-cert"
72
+
73
+
70
74
  def get_namespaces_with_rhcs_certs(
71
- query_func: Callable, cluster_name: Iterable[str] | None = None
75
+ query_func: Callable,
76
+ cluster_name: Iterable[str] | None = None,
72
77
  ) -> list[NamespaceV1]:
73
- return [
74
- ns
75
- for ns in rhcs_certs_query(query_func=query_func).namespaces or []
76
- if integration_is_enabled(QONTRACT_INTEGRATION, ns.cluster)
77
- and not bool(ns.delete)
78
- and (not cluster_name or ns.cluster.name in cluster_name)
79
- and any(
80
- isinstance(r, NamespaceOpenshiftResourceRhcsCertV1)
81
- for r in ns.openshift_resources or []
82
- )
83
- ]
78
+ result: list[NamespaceV1] = []
79
+ for ns in rhcs_certs_query(query_func=query_func).namespaces or []:
80
+ ob.aggregate_shared_resources_typed(cast("Any", ns)) # mypy: ignore[arg-type]
81
+ if (
82
+ integration_is_enabled(QONTRACT_INTEGRATION, ns.cluster)
83
+ and not bool(ns.delete)
84
+ and (not cluster_name or ns.cluster.name in cluster_name)
85
+ and any(_is_rhcs_cert(r) for r in ns.openshift_resources or [])
86
+ ):
87
+ result.append(ns)
88
+ return result
84
89
 
85
90
 
86
91
  def construct_rhcs_cert_oc_secret(
@@ -224,17 +229,16 @@ def fetch_desired_state(
224
229
  ) -> None:
225
230
  vault = VaultClient()
226
231
  cert_provider = get_rhcs_provider_settings(query_func=query_func)
227
-
228
232
  for ns in namespaces:
229
233
  for cert_resource in ns.openshift_resources or []:
230
- if isinstance(cert_resource, NamespaceOpenshiftResourceRhcsCertV1):
234
+ if _is_rhcs_cert(cert_resource):
231
235
  ri.add_desired_resource(
232
236
  cluster=ns.cluster.name,
233
237
  namespace=ns.name,
234
238
  resource=fetch_openshift_resource_for_cert_resource(
235
239
  dry_run,
236
240
  ns,
237
- cert_resource,
241
+ cast("NamespaceOpenshiftResourceRhcsCertV1", cert_resource),
238
242
  vault,
239
243
  cert_provider,
240
244
  ),
@@ -5563,22 +5563,27 @@ class TerrascriptClient:
5563
5563
 
5564
5564
  # mutual authentication section
5565
5565
  if mutual_authentication := resource.get("mutual_authentication"):
5566
- trust_store_values = {
5567
- "ca_certificates_bundle_s3_bucket": mutual_authentication[
5568
- "ca_cert_bundle_s3_bucket_name"
5569
- ],
5570
- "ca_certificates_bundle_s3_key": mutual_authentication[
5571
- "ca_cert_bundle_s3_bucket_key"
5572
- ],
5573
- }
5574
- trust_store = aws_lb_trust_store(
5575
- f"{identifier}-trust-store", **trust_store_values
5576
- )
5577
- tf_resources.append(trust_store)
5578
- values["mutual_authentication"] = {
5579
- "mode": mutual_authentication["mode"],
5580
- "trust_store_arn": f"${{{trust_store.arn}}}",
5581
- }
5566
+ if mutual_authentication["mode"] in {"off", "passthrough"}:
5567
+ values["mutual_authentication"] = {
5568
+ "mode": mutual_authentication["mode"],
5569
+ }
5570
+ else:
5571
+ trust_store_values = {
5572
+ "ca_certificates_bundle_s3_bucket": mutual_authentication[
5573
+ "ca_cert_bundle_s3_bucket_name"
5574
+ ],
5575
+ "ca_certificates_bundle_s3_key": mutual_authentication[
5576
+ "ca_cert_bundle_s3_bucket_key"
5577
+ ],
5578
+ }
5579
+ trust_store = aws_lb_trust_store(
5580
+ f"{identifier}-trust-store", **trust_store_values
5581
+ )
5582
+ tf_resources.append(trust_store)
5583
+ values["mutual_authentication"] = {
5584
+ "mode": mutual_authentication["mode"],
5585
+ "trust_store_arn": f"${{{trust_store.arn}}}",
5586
+ }
5582
5587
 
5583
5588
  forward_identifier = f"{identifier}-forward"
5584
5589
  forward_lbl_tf_resource = aws_lb_listener(forward_identifier, **values)