qontract-reconcile 0.10.2.dev297__py3-none-any.whl → 0.10.2.dev298__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.dev298
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
@@ -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
@@ -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.dev298.dist-info/METADATA,sha256=gruuhkwrqSh_2pDHyY0JBlIRMju96xZrOUm2bP1qoVA,24916
800
+ qontract_reconcile-0.10.2.dev298.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
801
+ qontract_reconcile-0.10.2.dev298.dist-info/entry_points.txt,sha256=5i9l54La3vQrDLAdwDKQWC0iG4sV9RRfOb1BpvzOWLc,698
802
+ qontract_reconcile-0.10.2.dev298.dist-info/RECORD,,
@@ -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
 
@@ -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
  ),