qontract-reconcile 0.10.2.dev40__py3-none-any.whl → 0.10.2.dev42__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.dev40.dist-info → qontract_reconcile-0.10.2.dev42.dist-info}/METADATA +1 -1
- {qontract_reconcile-0.10.2.dev40.dist-info → qontract_reconcile-0.10.2.dev42.dist-info}/RECORD +12 -14
- reconcile/external_resources/model.py +2 -44
- reconcile/external_resources/reconciler.py +0 -16
- reconcile/external_resources/state.py +1 -74
- reconcile/gql_definitions/external_resources/external_resources_modules.py +0 -17
- reconcile/gql_definitions/external_resources/external_resources_namespaces.py +64 -32
- reconcile/gql_definitions/external_resources/external_resources_settings.py +0 -17
- reconcile/gql_definitions/introspection.json +0 -40
- reconcile/utils/terrascript_aws_client.py +0 -313
- reconcile/gql_definitions/external_resources/fragments/__init__.py +0 -0
- reconcile/gql_definitions/external_resources/fragments/external_resources_module_overrides.py +0 -36
- {qontract_reconcile-0.10.2.dev40.dist-info → qontract_reconcile-0.10.2.dev42.dist-info}/WHEEL +0 -0
- {qontract_reconcile-0.10.2.dev40.dist-info → qontract_reconcile-0.10.2.dev42.dist-info}/entry_points.txt +0 -0
{qontract_reconcile-0.10.2.dev40.dist-info → qontract_reconcile-0.10.2.dev42.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.dev42
|
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.dev40.dist-info → qontract_reconcile-0.10.2.dev42.dist-info}/RECORD
RENAMED
@@ -202,10 +202,10 @@ reconcile/external_resources/integration_secrets_sync.py,sha256=dX09O3r6KURziUYY
|
|
202
202
|
reconcile/external_resources/manager.py,sha256=DtxjWx34WdPjPR5TzqV4mZpN_Gn20LcNTZHBbPxqzuQ,16953
|
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
|
-
reconcile/external_resources/model.py,sha256=
|
206
|
-
reconcile/external_resources/reconciler.py,sha256=
|
205
|
+
reconcile/external_resources/model.py,sha256=EpgIgVRPUsyfHhgjHv_TLUKjzFiIQt0wUd30K0NJJpI,11826
|
206
|
+
reconcile/external_resources/reconciler.py,sha256=K9QvbQCIOCuOHnPIxQE_P_jFtrkF3dGo8d_cCCh08Ys,8973
|
207
207
|
reconcile/external_resources/secrets_sync.py,sha256=50fK4fzgSz-K8uy5_DQQWA_ju_rTDYAC2HRymgfY7TA,16344
|
208
|
-
reconcile/external_resources/state.py,sha256=
|
208
|
+
reconcile/external_resources/state.py,sha256=ye8yjMoCtTHSRhDH7skFLDIHIuYTjisWYCTJrwnmbEw,9565
|
209
209
|
reconcile/glitchtip/README.md,sha256=rfXT6jNP9khJW65jL7I2PgoxvxgcGGuJF8NpbzufEQ4,4335
|
210
210
|
reconcile/glitchtip/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
211
211
|
reconcile/glitchtip/integration.py,sha256=vCyg8W4ZUGxjU8tB1Gkre_auSpzo83n05mmO8_-7al0,8263
|
@@ -215,7 +215,7 @@ reconcile/glitchtip_project_alerts/integration.py,sha256=BgMx-NyV9mTuv7Sotb2OioC
|
|
215
215
|
reconcile/glitchtip_project_dsn/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
216
216
|
reconcile/glitchtip_project_dsn/integration.py,sha256=2iugub-kHYkHNK33n0v9_TeWonuxCPah_VkoTPvaajE,8077
|
217
217
|
reconcile/gql_definitions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
218
|
-
reconcile/gql_definitions/introspection.json,sha256=
|
218
|
+
reconcile/gql_definitions/introspection.json,sha256=ErIjLKDbNw4SLyGXhp9iGmL1RSfT0U7gU1A3tsn1674,2217790
|
219
219
|
reconcile/gql_definitions/acs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
220
220
|
reconcile/gql_definitions/acs/acs_instances.py,sha256=L91WW9LbhJbBSrECqShQpFtjoBOsmNIYLRpMbx1io5o,2181
|
221
221
|
reconcile/gql_definitions/acs/acs_policies.py,sha256=bN5i4mks10Z23KJSj7jqp966Osq2dps4d-sPH9gjxEA,7008
|
@@ -299,11 +299,9 @@ reconcile/gql_definitions/endpoints_discovery/__init__.py,sha256=47DEQpj8HBSa-_T
|
|
299
299
|
reconcile/gql_definitions/endpoints_discovery/apps.py,sha256=aBWRAwDUJQ32ghJS4cPQcR9SNl20Fcwd3pxHDB3YJQY,3172
|
300
300
|
reconcile/gql_definitions/external_resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
301
301
|
reconcile/gql_definitions/external_resources/aws_accounts.py,sha256=XR69j9dpTQ0gv8y-AZN7AJ0dPvO-wbHscyCDgrax6Bk,2046
|
302
|
-
reconcile/gql_definitions/external_resources/external_resources_modules.py,sha256=
|
303
|
-
reconcile/gql_definitions/external_resources/external_resources_namespaces.py,sha256
|
304
|
-
reconcile/gql_definitions/external_resources/external_resources_settings.py,sha256=
|
305
|
-
reconcile/gql_definitions/external_resources/fragments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
306
|
-
reconcile/gql_definitions/external_resources/fragments/external_resources_module_overrides.py,sha256=T_qWCRtzU8F9frebBXG9TkeQdrKGt3R9YinSngPoFqM,1262
|
302
|
+
reconcile/gql_definitions/external_resources/external_resources_modules.py,sha256=cbbvGq1Te9DP8XiFg3bp4Y0q6LxpGYov8ugcROPyPLI,2647
|
303
|
+
reconcile/gql_definitions/external_resources/external_resources_namespaces.py,sha256=dW7RrIA9gAJS7AHQwHggsJXhlSVnX0jV1c4W9e7a7Jc,45393
|
304
|
+
reconcile/gql_definitions/external_resources/external_resources_settings.py,sha256=K8m9EKlfIVGP2KyqTduo7MMSKFjVC3yk5ZfO9hgdA7A,3192
|
307
305
|
reconcile/gql_definitions/fragments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
308
306
|
reconcile/gql_definitions/fragments/aus_organization.py,sha256=uBKbTuBa3CZmTXR5HOcGhRcu2U9kM93KbYmoWTxcpB0,4767
|
309
307
|
reconcile/gql_definitions/fragments/aws_account_common.py,sha256=3-7ZAP6GSff7Z2Syz2VQCLY4IySqBOSVmceaRiVNQpw,2385
|
@@ -635,7 +633,7 @@ reconcile/utils/state.py,sha256=az4tBmZ0EdbFcAGiBVUxs3cr2-BVWsuDQiNTvjjQq8s,1637
|
|
635
633
|
reconcile/utils/structs.py,sha256=LcbLEg8WxfRqM6nW7NhcWN0YeqF7SQzxOgntmLs1SgY,352
|
636
634
|
reconcile/utils/template.py,sha256=wTvRU4AnAV_o042tD4Mwls2dwWMuk7MKnde3MaCjaYg,331
|
637
635
|
reconcile/utils/terraform_client.py,sha256=H8frsS370y8xfivKLNBD1dwlBLHvfuR6JSN_syBL5Qc,36033
|
638
|
-
reconcile/utils/terrascript_aws_client.py,sha256=
|
636
|
+
reconcile/utils/terrascript_aws_client.py,sha256=SNGtsG1n-IDZaI0blKLm3t3AfVNmxW-O8Y8NtX08OOc,270318
|
639
637
|
reconcile/utils/three_way_diff_strategy.py,sha256=oQcHXd9LVhirJfoaOBoHUYuZVGfyL2voKr6KVI34zZE,4833
|
640
638
|
reconcile/utils/throughput.py,sha256=iP4UWAe2LVhDo69mPPmgo9nQ7RxHD6_GS8MZe-aSiuM,344
|
641
639
|
reconcile/utils/vault.py,sha256=aSA8l9cJlPUHpChFGl27nSY-Mpq9FMjBo7Dcgb1BVfM,15036
|
@@ -775,7 +773,7 @@ tools/saas_promotion_state/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
|
|
775
773
|
tools/saas_promotion_state/saas_promotion_state.py,sha256=UfwwRLS5Ya4_Nh1w5n1dvoYtchQvYE9yj1VANt2IKqI,3925
|
776
774
|
tools/sre_checkpoints/__init__.py,sha256=CDaDaywJnmRCLyl_NCcvxi-Zc0hTi_3OdwKiFOyS39I,145
|
777
775
|
tools/sre_checkpoints/util.py,sha256=zEDbGr18ZeHNQwW8pUsr2JRjuXIPz--WAGJxZo9sv_Y,894
|
778
|
-
qontract_reconcile-0.10.2.
|
779
|
-
qontract_reconcile-0.10.2.
|
780
|
-
qontract_reconcile-0.10.2.
|
781
|
-
qontract_reconcile-0.10.2.
|
776
|
+
qontract_reconcile-0.10.2.dev42.dist-info/METADATA,sha256=77Cr8xiwD37_vvev53K72DZy0oVPeSlFtUBb2HOyTzI,24665
|
777
|
+
qontract_reconcile-0.10.2.dev42.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
778
|
+
qontract_reconcile-0.10.2.dev42.dist-info/entry_points.txt,sha256=5i9l54La3vQrDLAdwDKQWC0iG4sV9RRfOb1BpvzOWLc,698
|
779
|
+
qontract_reconcile-0.10.2.dev42.dist-info/RECORD,,
|
@@ -18,6 +18,7 @@ from reconcile.gql_definitions.external_resources.external_resources_modules imp
|
|
18
18
|
ExternalResourcesModuleV1,
|
19
19
|
)
|
20
20
|
from reconcile.gql_definitions.external_resources.external_resources_namespaces import (
|
21
|
+
ExternalResourcesModuleOverridesV1,
|
21
22
|
NamespaceTerraformProviderResourceAWSV1,
|
22
23
|
NamespaceTerraformResourceElastiCacheV1,
|
23
24
|
NamespaceTerraformResourceKMSV1,
|
@@ -28,10 +29,6 @@ from reconcile.gql_definitions.external_resources.external_resources_namespaces
|
|
28
29
|
from reconcile.gql_definitions.external_resources.external_resources_settings import (
|
29
30
|
ExternalResourcesSettingsV1,
|
30
31
|
)
|
31
|
-
from reconcile.gql_definitions.external_resources.fragments.external_resources_module_overrides import (
|
32
|
-
ExternalResourcesModuleOverrides,
|
33
|
-
)
|
34
|
-
from reconcile.gql_definitions.fragments.deplopy_resources import DeployResourcesFields
|
35
32
|
from reconcile.utils.exceptions import FetchResourceError
|
36
33
|
from reconcile.utils.external_resource_spec import (
|
37
34
|
ExternalResourceSpec,
|
@@ -223,38 +220,6 @@ def load_module_inventory(
|
|
223
220
|
})
|
224
221
|
|
225
222
|
|
226
|
-
class ResourcesSpec(BaseModel, frozen=True):
|
227
|
-
cpu: str | None = None
|
228
|
-
memory: str | None = None
|
229
|
-
|
230
|
-
|
231
|
-
class Resources(BaseModel, frozen=True):
|
232
|
-
"""Hashable class to store module resources in reconciliations.
|
233
|
-
Default values are used as a fallback for existent objects that were
|
234
|
-
created without container resources, hence they don't have mem/cpu resources
|
235
|
-
in the ERv2 State. Eventually, all resources will have resources assignments
|
236
|
-
from the module spec, module_overrides, or app-interface settings.
|
237
|
-
"""
|
238
|
-
|
239
|
-
requests: ResourcesSpec = ResourcesSpec()
|
240
|
-
limits: ResourcesSpec = ResourcesSpec()
|
241
|
-
|
242
|
-
@staticmethod
|
243
|
-
def from_deploy_resources_fields(fields: DeployResourcesFields) -> "Resources":
|
244
|
-
"""Create Resource obect from GQL DeployResourcesFields.
|
245
|
-
|
246
|
-
DeployResourceFields can not be used directly as it not hashable."""
|
247
|
-
return Resources(
|
248
|
-
requests=ResourcesSpec(
|
249
|
-
cpu=fields.requests.cpu, memory=fields.requests.memory
|
250
|
-
),
|
251
|
-
limits=ResourcesSpec(
|
252
|
-
cpu=fields.limits.cpu,
|
253
|
-
memory=fields.limits.memory,
|
254
|
-
),
|
255
|
-
)
|
256
|
-
|
257
|
-
|
258
223
|
class ExternalResourceModuleConfiguration(BaseModel, frozen=True):
|
259
224
|
image: str = ""
|
260
225
|
version: str = ""
|
@@ -262,7 +227,6 @@ class ExternalResourceModuleConfiguration(BaseModel, frozen=True):
|
|
262
227
|
reconcile_timeout_minutes: int = -1000
|
263
228
|
outputs_secret_image: str = ""
|
264
229
|
outputs_secret_version: str = ""
|
265
|
-
resources: Resources = Resources()
|
266
230
|
|
267
231
|
@property
|
268
232
|
def image_version(self) -> str:
|
@@ -280,14 +244,13 @@ class ExternalResourceModuleConfiguration(BaseModel, frozen=True):
|
|
280
244
|
) -> "ExternalResourceModuleConfiguration":
|
281
245
|
module_overrides = spec.metadata.get(
|
282
246
|
"module_overrides"
|
283
|
-
) or
|
247
|
+
) or ExternalResourcesModuleOverridesV1(
|
284
248
|
module_type=None,
|
285
249
|
image=None,
|
286
250
|
version=None,
|
287
251
|
reconcile_timeout_minutes=None,
|
288
252
|
outputs_secret_image=None,
|
289
253
|
outputs_secret_version=None,
|
290
|
-
resources=None,
|
291
254
|
)
|
292
255
|
|
293
256
|
return ExternalResourceModuleConfiguration(
|
@@ -302,11 +265,6 @@ class ExternalResourceModuleConfiguration(BaseModel, frozen=True):
|
|
302
265
|
outputs_secret_version=module_overrides.outputs_secret_version
|
303
266
|
or module.outputs_secret_version
|
304
267
|
or settings.outputs_secret_version,
|
305
|
-
resources=Resources.from_deploy_resources_fields(
|
306
|
-
module_overrides.resources
|
307
|
-
or module.resources
|
308
|
-
or settings.module_default_resources
|
309
|
-
),
|
310
268
|
)
|
311
269
|
|
312
270
|
|
@@ -14,7 +14,6 @@ from kubernetes.client import (
|
|
14
14
|
V1ObjectMeta,
|
15
15
|
V1PodSpec,
|
16
16
|
V1PodTemplateSpec,
|
17
|
-
V1ResourceRequirements,
|
18
17
|
V1SecretVolumeSource,
|
19
18
|
V1Volume,
|
20
19
|
V1VolumeMount,
|
@@ -90,19 +89,10 @@ class ReconciliationK8sJob(K8sJob, BaseModel, frozen=True):
|
|
90
89
|
}
|
91
90
|
|
92
91
|
def job_spec(self) -> V1JobSpec:
|
93
|
-
assert self.reconciliation.module_configuration.resources is not None
|
94
92
|
job_container = V1Container(
|
95
93
|
name="job",
|
96
94
|
image=self.reconciliation.module_configuration.image_version,
|
97
95
|
image_pull_policy="Always",
|
98
|
-
resources=V1ResourceRequirements(
|
99
|
-
requests=self.reconciliation.module_configuration.resources.requests.dict(
|
100
|
-
exclude_none=True
|
101
|
-
),
|
102
|
-
limits=self.reconciliation.module_configuration.resources.limits.dict(
|
103
|
-
exclude_none=True
|
104
|
-
),
|
105
|
-
),
|
106
96
|
env=[
|
107
97
|
V1EnvVar(
|
108
98
|
name="DRY_RUN",
|
@@ -112,12 +102,6 @@ class ReconciliationK8sJob(K8sJob, BaseModel, frozen=True):
|
|
112
102
|
name="ACTION",
|
113
103
|
value=self.reconciliation.action.value,
|
114
104
|
),
|
115
|
-
V1EnvVar(
|
116
|
-
name="RECONCILE_TIMEOUT_MINUTES",
|
117
|
-
value=str(
|
118
|
-
self.reconciliation.module_configuration.reconcile_timeout_minutes
|
119
|
-
),
|
120
|
-
),
|
121
105
|
],
|
122
106
|
volume_mounts=[
|
123
107
|
V1VolumeMount(
|
@@ -11,8 +11,6 @@ from reconcile.external_resources.model import (
|
|
11
11
|
ExternalResourceModuleConfiguration,
|
12
12
|
Reconciliation,
|
13
13
|
ReconciliationStatus,
|
14
|
-
Resources,
|
15
|
-
ResourcesSpec,
|
16
14
|
ResourceStatus,
|
17
15
|
)
|
18
16
|
from reconcile.utils.aws_api_typed.api import AWSApi
|
@@ -75,48 +73,10 @@ class DynamoDBStateAdapter:
|
|
75
73
|
MODCONF_VERSION = "version"
|
76
74
|
MODCONF_DRIFT_MINS = "drift_detection_minutes"
|
77
75
|
MODCONF_TIMEOUT_MINS = "timeout_minutes"
|
78
|
-
MODCONF_RESOURCES = "resources"
|
79
|
-
MODCONF_RESOURCES_REQUESTS = "requests"
|
80
|
-
MODCONF_RESOURCES_REQUESTS_CPU = "cpu"
|
81
|
-
MODCONF_RESOURCES_REQUESTS_MEMORY = "memory"
|
82
|
-
MODCONF_RESOURCES_LIMITS = "limits"
|
83
|
-
MODCONF_RESOURCES_LIMITS_CPU = "cpu"
|
84
|
-
MODCONF_RESOURCES_LIMITS_MEMORY = "memory"
|
85
76
|
|
86
77
|
def _get_value(self, item: Mapping[str, Any], key: str, type: str = "S") -> Any:
|
87
|
-
if item[key][type] == "None":
|
88
|
-
return None
|
89
78
|
return item[key][type]
|
90
79
|
|
91
|
-
def _build_resources(self, modconf: Mapping[str, Any]) -> Resources | None:
|
92
|
-
if self.MODCONF_RESOURCES not in modconf:
|
93
|
-
return Resources()
|
94
|
-
mc_resources = self._get_value(modconf, self.MODCONF_RESOURCES, type="M")
|
95
|
-
mc_resources_requests = self._get_value(
|
96
|
-
mc_resources, self.MODCONF_RESOURCES_REQUESTS, type="M"
|
97
|
-
)
|
98
|
-
mc_resources_limits = self._get_value(
|
99
|
-
mc_resources, self.MODCONF_RESOURCES_LIMITS, type="M"
|
100
|
-
)
|
101
|
-
return Resources(
|
102
|
-
requests=ResourcesSpec(
|
103
|
-
cpu=self._get_value(
|
104
|
-
mc_resources_requests, self.MODCONF_RESOURCES_REQUESTS_CPU
|
105
|
-
),
|
106
|
-
memory=self._get_value(
|
107
|
-
mc_resources_requests, self.MODCONF_RESOURCES_REQUESTS_MEMORY
|
108
|
-
),
|
109
|
-
),
|
110
|
-
limits=ResourcesSpec(
|
111
|
-
cpu=self._get_value(
|
112
|
-
mc_resources_limits, self.MODCONF_RESOURCES_LIMITS_CPU
|
113
|
-
),
|
114
|
-
memory=self._get_value(
|
115
|
-
mc_resources_limits, self.MODCONF_RESOURCES_LIMITS_MEMORY
|
116
|
-
),
|
117
|
-
),
|
118
|
-
)
|
119
|
-
|
120
80
|
def deserialize(
|
121
81
|
self,
|
122
82
|
item: Mapping[str, Any],
|
@@ -156,7 +116,6 @@ class DynamoDBStateAdapter:
|
|
156
116
|
reconcile_timeout_minutes=self._get_value(
|
157
117
|
modconf, self.MODCONF_TIMEOUT_MINS, type="N"
|
158
118
|
),
|
159
|
-
resources=self._build_resources(modconf),
|
160
119
|
),
|
161
120
|
)
|
162
121
|
|
@@ -205,39 +164,7 @@ class DynamoDBStateAdapter:
|
|
205
164
|
state.reconciliation.module_configuration.reconcile_timeout_minutes
|
206
165
|
)
|
207
166
|
},
|
208
|
-
|
209
|
-
"M": {
|
210
|
-
self.MODCONF_RESOURCES_REQUESTS: {
|
211
|
-
"M": {
|
212
|
-
self.MODCONF_RESOURCES_REQUESTS_CPU: {
|
213
|
-
"S": str(
|
214
|
-
state.reconciliation.module_configuration.resources.requests.cpu
|
215
|
-
)
|
216
|
-
},
|
217
|
-
self.MODCONF_RESOURCES_REQUESTS_MEMORY: {
|
218
|
-
"S": str(
|
219
|
-
state.reconciliation.module_configuration.resources.requests.memory
|
220
|
-
)
|
221
|
-
},
|
222
|
-
}
|
223
|
-
},
|
224
|
-
self.MODCONF_RESOURCES_LIMITS: {
|
225
|
-
"M": {
|
226
|
-
self.MODCONF_RESOURCES_LIMITS_CPU: {
|
227
|
-
"S": str(
|
228
|
-
state.reconciliation.module_configuration.resources.limits.cpu
|
229
|
-
)
|
230
|
-
},
|
231
|
-
self.MODCONF_RESOURCES_LIMITS_MEMORY: {
|
232
|
-
"S": str(
|
233
|
-
state.reconciliation.module_configuration.resources.limits.memory
|
234
|
-
)
|
235
|
-
},
|
236
|
-
}
|
237
|
-
},
|
238
|
-
}
|
239
|
-
},
|
240
|
-
},
|
167
|
+
}
|
241
168
|
},
|
242
169
|
}
|
243
170
|
},
|
@@ -17,21 +17,8 @@ from pydantic import ( # noqa: F401 # pylint: disable=W0611
|
|
17
17
|
Json,
|
18
18
|
)
|
19
19
|
|
20
|
-
from reconcile.gql_definitions.fragments.deplopy_resources import DeployResourcesFields
|
21
|
-
|
22
20
|
|
23
21
|
DEFINITION = """
|
24
|
-
fragment DeployResourcesFields on DeployResources_v1 {
|
25
|
-
requests {
|
26
|
-
cpu
|
27
|
-
memory
|
28
|
-
}
|
29
|
-
limits {
|
30
|
-
cpu
|
31
|
-
memory
|
32
|
-
}
|
33
|
-
}
|
34
|
-
|
35
22
|
query ExternalResourcesModules {
|
36
23
|
modules: external_resources_modules_v1 {
|
37
24
|
provision_provider
|
@@ -44,9 +31,6 @@ query ExternalResourcesModules {
|
|
44
31
|
outputs_secret_sync
|
45
32
|
outputs_secret_image
|
46
33
|
outputs_secret_version
|
47
|
-
resources {
|
48
|
-
... DeployResourcesFields
|
49
|
-
}
|
50
34
|
}
|
51
35
|
}
|
52
36
|
"""
|
@@ -69,7 +53,6 @@ class ExternalResourcesModuleV1(ConfiguredBaseModel):
|
|
69
53
|
outputs_secret_sync: bool = Field(..., alias="outputs_secret_sync")
|
70
54
|
outputs_secret_image: Optional[str] = Field(..., alias="outputs_secret_image")
|
71
55
|
outputs_secret_version: Optional[str] = Field(..., alias="outputs_secret_version")
|
72
|
-
resources: Optional[DeployResourcesFields] = Field(..., alias="resources")
|
73
56
|
|
74
57
|
|
75
58
|
class ExternalResourcesModulesQueryData(ConfiguredBaseModel):
|
@@ -19,7 +19,6 @@ from pydantic import ( # noqa: F401 # pylint: disable=W0611
|
|
19
19
|
|
20
20
|
from reconcile.gql_definitions.fragments.aws_vpc import AWSVPC
|
21
21
|
from reconcile.gql_definitions.fragments.jumphost_common_fields import CommonJumphostFields
|
22
|
-
from reconcile.gql_definitions.external_resources.fragments.external_resources_module_overrides import ExternalResourcesModuleOverrides
|
23
22
|
from reconcile.gql_definitions.fragments.vault_secret import VaultSecret
|
24
23
|
|
25
24
|
|
@@ -54,29 +53,6 @@ fragment CommonJumphostFields on ClusterJumpHost_v1 {
|
|
54
53
|
}
|
55
54
|
}
|
56
55
|
|
57
|
-
fragment DeployResourcesFields on DeployResources_v1 {
|
58
|
-
requests {
|
59
|
-
cpu
|
60
|
-
memory
|
61
|
-
}
|
62
|
-
limits {
|
63
|
-
cpu
|
64
|
-
memory
|
65
|
-
}
|
66
|
-
}
|
67
|
-
|
68
|
-
fragment ExternalResourcesModuleOverrides on ExternalResourcesModuleOverrides_v1 {
|
69
|
-
module_type
|
70
|
-
image
|
71
|
-
version
|
72
|
-
reconcile_timeout_minutes
|
73
|
-
outputs_secret_image
|
74
|
-
outputs_secret_version
|
75
|
-
resources {
|
76
|
-
... DeployResourcesFields
|
77
|
-
}
|
78
|
-
}
|
79
|
-
|
80
56
|
fragment VaultSecret on VaultSecret_v1 {
|
81
57
|
path
|
82
58
|
field
|
@@ -135,7 +111,12 @@ query ExternalResourcesNamespaces {
|
|
135
111
|
managed_by_erv2
|
136
112
|
delete
|
137
113
|
module_overrides {
|
138
|
-
|
114
|
+
module_type
|
115
|
+
image
|
116
|
+
version
|
117
|
+
reconcile_timeout_minutes
|
118
|
+
outputs_secret_image
|
119
|
+
outputs_secret_version
|
139
120
|
}
|
140
121
|
}
|
141
122
|
... on NamespaceTerraformResourceS3_v1 {
|
@@ -168,7 +149,12 @@ query ExternalResourcesNamespaces {
|
|
168
149
|
managed_by_erv2
|
169
150
|
delete
|
170
151
|
module_overrides {
|
171
|
-
|
152
|
+
module_type
|
153
|
+
image
|
154
|
+
version
|
155
|
+
reconcile_timeout_minutes
|
156
|
+
outputs_secret_image
|
157
|
+
outputs_secret_version
|
172
158
|
}
|
173
159
|
}
|
174
160
|
... on NamespaceTerraformResourceServiceAccount_v1 {
|
@@ -289,7 +275,12 @@ query ExternalResourcesNamespaces {
|
|
289
275
|
managed_by_erv2
|
290
276
|
delete
|
291
277
|
module_overrides {
|
292
|
-
|
278
|
+
module_type
|
279
|
+
image
|
280
|
+
version
|
281
|
+
reconcile_timeout_minutes
|
282
|
+
outputs_secret_image
|
283
|
+
outputs_secret_version
|
293
284
|
}
|
294
285
|
}
|
295
286
|
... on NamespaceTerraformResourceElasticSearch_v1 {
|
@@ -501,7 +492,12 @@ query ExternalResourcesNamespaces {
|
|
501
492
|
managed_by_erv2
|
502
493
|
delete
|
503
494
|
module_overrides {
|
504
|
-
|
495
|
+
module_type
|
496
|
+
image
|
497
|
+
version
|
498
|
+
reconcile_timeout_minutes
|
499
|
+
outputs_secret_image
|
500
|
+
outputs_secret_version
|
505
501
|
}
|
506
502
|
}
|
507
503
|
}
|
@@ -580,6 +576,15 @@ class AWSRDSDataClassificationV1(ConfiguredBaseModel):
|
|
580
576
|
loss_impact: Optional[str] = Field(..., alias="loss_impact")
|
581
577
|
|
582
578
|
|
579
|
+
class ExternalResourcesModuleOverridesV1(ConfiguredBaseModel):
|
580
|
+
module_type: Optional[str] = Field(..., alias="module_type")
|
581
|
+
image: Optional[str] = Field(..., alias="image")
|
582
|
+
version: Optional[str] = Field(..., alias="version")
|
583
|
+
reconcile_timeout_minutes: Optional[int] = Field(..., alias="reconcile_timeout_minutes")
|
584
|
+
outputs_secret_image: Optional[str] = Field(..., alias="outputs_secret_image")
|
585
|
+
outputs_secret_version: Optional[str] = Field(..., alias="outputs_secret_version")
|
586
|
+
|
587
|
+
|
583
588
|
class NamespaceTerraformResourceRDSV1(NamespaceTerraformResourceAWSV1):
|
584
589
|
region: Optional[str] = Field(..., alias="region")
|
585
590
|
identifier: str = Field(..., alias="identifier")
|
@@ -599,7 +604,7 @@ class NamespaceTerraformResourceRDSV1(NamespaceTerraformResourceAWSV1):
|
|
599
604
|
data_classification: Optional[AWSRDSDataClassificationV1] = Field(..., alias="data_classification")
|
600
605
|
managed_by_erv2: Optional[bool] = Field(..., alias="managed_by_erv2")
|
601
606
|
delete: Optional[bool] = Field(..., alias="delete")
|
602
|
-
module_overrides: Optional[
|
607
|
+
module_overrides: Optional[ExternalResourcesModuleOverridesV1] = Field(..., alias="module_overrides")
|
603
608
|
|
604
609
|
|
605
610
|
class AWSS3EventNotificationV1(ConfiguredBaseModel):
|
@@ -624,6 +629,15 @@ class NamespaceTerraformResourceS3V1(NamespaceTerraformResourceAWSV1):
|
|
624
629
|
annotations: Optional[str] = Field(..., alias="annotations")
|
625
630
|
|
626
631
|
|
632
|
+
class NamespaceTerraformResourceElastiCacheV1_ExternalResourcesModuleOverridesV1(ConfiguredBaseModel):
|
633
|
+
module_type: Optional[str] = Field(..., alias="module_type")
|
634
|
+
image: Optional[str] = Field(..., alias="image")
|
635
|
+
version: Optional[str] = Field(..., alias="version")
|
636
|
+
reconcile_timeout_minutes: Optional[int] = Field(..., alias="reconcile_timeout_minutes")
|
637
|
+
outputs_secret_image: Optional[str] = Field(..., alias="outputs_secret_image")
|
638
|
+
outputs_secret_version: Optional[str] = Field(..., alias="outputs_secret_version")
|
639
|
+
|
640
|
+
|
627
641
|
class NamespaceTerraformResourceElastiCacheV1(NamespaceTerraformResourceAWSV1):
|
628
642
|
identifier: str = Field(..., alias="identifier")
|
629
643
|
defaults: str = Field(..., alias="defaults")
|
@@ -634,7 +648,7 @@ class NamespaceTerraformResourceElastiCacheV1(NamespaceTerraformResourceAWSV1):
|
|
634
648
|
annotations: Optional[str] = Field(..., alias="annotations")
|
635
649
|
managed_by_erv2: Optional[bool] = Field(..., alias="managed_by_erv2")
|
636
650
|
delete: Optional[bool] = Field(..., alias="delete")
|
637
|
-
module_overrides: Optional[
|
651
|
+
module_overrides: Optional[NamespaceTerraformResourceElastiCacheV1_ExternalResourcesModuleOverridesV1] = Field(..., alias="module_overrides")
|
638
652
|
|
639
653
|
|
640
654
|
class ClusterV1(ConfiguredBaseModel):
|
@@ -770,6 +784,15 @@ class NamespaceTerraformResourceCloudWatchV1(NamespaceTerraformResourceAWSV1):
|
|
770
784
|
annotations: Optional[str] = Field(..., alias="annotations")
|
771
785
|
|
772
786
|
|
787
|
+
class NamespaceTerraformResourceKMSV1_ExternalResourcesModuleOverridesV1(ConfiguredBaseModel):
|
788
|
+
module_type: Optional[str] = Field(..., alias="module_type")
|
789
|
+
image: Optional[str] = Field(..., alias="image")
|
790
|
+
version: Optional[str] = Field(..., alias="version")
|
791
|
+
reconcile_timeout_minutes: Optional[int] = Field(..., alias="reconcile_timeout_minutes")
|
792
|
+
outputs_secret_image: Optional[str] = Field(..., alias="outputs_secret_image")
|
793
|
+
outputs_secret_version: Optional[str] = Field(..., alias="outputs_secret_version")
|
794
|
+
|
795
|
+
|
773
796
|
class NamespaceTerraformResourceKMSV1(NamespaceTerraformResourceAWSV1):
|
774
797
|
region: Optional[str] = Field(..., alias="region")
|
775
798
|
identifier: str = Field(..., alias="identifier")
|
@@ -779,7 +802,7 @@ class NamespaceTerraformResourceKMSV1(NamespaceTerraformResourceAWSV1):
|
|
779
802
|
annotations: Optional[str] = Field(..., alias="annotations")
|
780
803
|
managed_by_erv2: Optional[bool] = Field(..., alias="managed_by_erv2")
|
781
804
|
delete: Optional[bool] = Field(..., alias="delete")
|
782
|
-
module_overrides: Optional[
|
805
|
+
module_overrides: Optional[NamespaceTerraformResourceKMSV1_ExternalResourcesModuleOverridesV1] = Field(..., alias="module_overrides")
|
783
806
|
|
784
807
|
|
785
808
|
class NamespaceTerraformResourceElasticSearchV1(NamespaceTerraformResourceAWSV1):
|
@@ -1021,6 +1044,15 @@ class MskSecretParametersV1(ConfiguredBaseModel):
|
|
1021
1044
|
secret: VaultSecret = Field(..., alias="secret")
|
1022
1045
|
|
1023
1046
|
|
1047
|
+
class NamespaceTerraformResourceMskV1_ExternalResourcesModuleOverridesV1(ConfiguredBaseModel):
|
1048
|
+
module_type: Optional[str] = Field(..., alias="module_type")
|
1049
|
+
image: Optional[str] = Field(..., alias="image")
|
1050
|
+
version: Optional[str] = Field(..., alias="version")
|
1051
|
+
reconcile_timeout_minutes: Optional[int] = Field(..., alias="reconcile_timeout_minutes")
|
1052
|
+
outputs_secret_image: Optional[str] = Field(..., alias="outputs_secret_image")
|
1053
|
+
outputs_secret_version: Optional[str] = Field(..., alias="outputs_secret_version")
|
1054
|
+
|
1055
|
+
|
1024
1056
|
class NamespaceTerraformResourceMskV1(NamespaceTerraformResourceAWSV1):
|
1025
1057
|
region: Optional[str] = Field(..., alias="region")
|
1026
1058
|
identifier: str = Field(..., alias="identifier")
|
@@ -1030,7 +1062,7 @@ class NamespaceTerraformResourceMskV1(NamespaceTerraformResourceAWSV1):
|
|
1030
1062
|
users: Optional[list[MskSecretParametersV1]] = Field(..., alias="users")
|
1031
1063
|
managed_by_erv2: Optional[bool] = Field(..., alias="managed_by_erv2")
|
1032
1064
|
delete: Optional[bool] = Field(..., alias="delete")
|
1033
|
-
module_overrides: Optional[
|
1065
|
+
module_overrides: Optional[NamespaceTerraformResourceMskV1_ExternalResourcesModuleOverridesV1] = Field(..., alias="module_overrides")
|
1034
1066
|
|
1035
1067
|
|
1036
1068
|
class NamespaceTerraformProviderResourceAWSV1(NamespaceExternalResourceV1):
|
@@ -17,21 +17,8 @@ from pydantic import ( # noqa: F401 # pylint: disable=W0611
|
|
17
17
|
Json,
|
18
18
|
)
|
19
19
|
|
20
|
-
from reconcile.gql_definitions.fragments.deplopy_resources import DeployResourcesFields
|
21
|
-
|
22
20
|
|
23
21
|
DEFINITION = """
|
24
|
-
fragment DeployResourcesFields on DeployResources_v1 {
|
25
|
-
requests {
|
26
|
-
cpu
|
27
|
-
memory
|
28
|
-
}
|
29
|
-
limits {
|
30
|
-
cpu
|
31
|
-
memory
|
32
|
-
}
|
33
|
-
}
|
34
|
-
|
35
22
|
query ExternalResourcesSettings {
|
36
23
|
settings: external_resources_settings_v1 {
|
37
24
|
state_dynamodb_account {
|
@@ -51,9 +38,6 @@ query ExternalResourcesSettings {
|
|
51
38
|
vault_secrets_path
|
52
39
|
outputs_secret_image
|
53
40
|
outputs_secret_version
|
54
|
-
module_default_resources {
|
55
|
-
... DeployResourcesFields
|
56
|
-
}
|
57
41
|
}
|
58
42
|
}
|
59
43
|
"""
|
@@ -89,7 +73,6 @@ class ExternalResourcesSettingsV1(ConfiguredBaseModel):
|
|
89
73
|
vault_secrets_path: str = Field(..., alias="vault_secrets_path")
|
90
74
|
outputs_secret_image: str = Field(..., alias="outputs_secret_image")
|
91
75
|
outputs_secret_version: str = Field(..., alias="outputs_secret_version")
|
92
|
-
module_default_resources: DeployResourcesFields = Field(..., alias="module_default_resources")
|
93
76
|
|
94
77
|
|
95
78
|
class ExternalResourcesSettingsQueryData(ConfiguredBaseModel):
|
@@ -33803,22 +33803,6 @@
|
|
33803
33803
|
},
|
33804
33804
|
"isDeprecated": false,
|
33805
33805
|
"deprecationReason": null
|
33806
|
-
},
|
33807
|
-
{
|
33808
|
-
"name": "module_default_resources",
|
33809
|
-
"description": null,
|
33810
|
-
"args": [],
|
33811
|
-
"type": {
|
33812
|
-
"kind": "NON_NULL",
|
33813
|
-
"name": null,
|
33814
|
-
"ofType": {
|
33815
|
-
"kind": "OBJECT",
|
33816
|
-
"name": "DeployResources_v1",
|
33817
|
-
"ofType": null
|
33818
|
-
}
|
33819
|
-
},
|
33820
|
-
"isDeprecated": false,
|
33821
|
-
"deprecationReason": null
|
33822
33806
|
}
|
33823
33807
|
],
|
33824
33808
|
"inputFields": null,
|
@@ -34020,18 +34004,6 @@
|
|
34020
34004
|
},
|
34021
34005
|
"isDeprecated": false,
|
34022
34006
|
"deprecationReason": null
|
34023
|
-
},
|
34024
|
-
{
|
34025
|
-
"name": "resources",
|
34026
|
-
"description": null,
|
34027
|
-
"args": [],
|
34028
|
-
"type": {
|
34029
|
-
"kind": "OBJECT",
|
34030
|
-
"name": "DeployResources_v1",
|
34031
|
-
"ofType": null
|
34032
|
-
},
|
34033
|
-
"isDeprecated": false,
|
34034
|
-
"deprecationReason": null
|
34035
34007
|
}
|
34036
34008
|
],
|
34037
34009
|
"inputFields": null,
|
@@ -42955,18 +42927,6 @@
|
|
42955
42927
|
},
|
42956
42928
|
"isDeprecated": false,
|
42957
42929
|
"deprecationReason": null
|
42958
|
-
},
|
42959
|
-
{
|
42960
|
-
"name": "resources",
|
42961
|
-
"description": null,
|
42962
|
-
"args": [],
|
42963
|
-
"type": {
|
42964
|
-
"kind": "OBJECT",
|
42965
|
-
"name": "DeployResources_v1",
|
42966
|
-
"ofType": null
|
42967
|
-
},
|
42968
|
-
"isDeprecated": false,
|
42969
|
-
"deprecationReason": null
|
42970
42930
|
}
|
42971
42931
|
],
|
42972
42932
|
"inputFields": null,
|
@@ -77,8 +77,6 @@ from terrascript.resource import (
|
|
77
77
|
aws_ec2_transit_gateway_vpc_attachment,
|
78
78
|
aws_ec2_transit_gateway_vpc_attachment_accepter,
|
79
79
|
aws_ecr_repository,
|
80
|
-
aws_elasticache_parameter_group,
|
81
|
-
aws_elasticache_replication_group,
|
82
80
|
aws_elasticsearch_domain,
|
83
81
|
aws_iam_access_key,
|
84
82
|
aws_iam_group,
|
@@ -106,8 +104,6 @@ from terrascript.resource import (
|
|
106
104
|
aws_lb_listener_rule,
|
107
105
|
aws_lb_target_group,
|
108
106
|
aws_lb_target_group_attachment,
|
109
|
-
aws_msk_cluster,
|
110
|
-
aws_msk_configuration,
|
111
107
|
aws_ram_principal_association,
|
112
108
|
aws_ram_resource_association,
|
113
109
|
aws_ram_resource_share,
|
@@ -1645,8 +1641,6 @@ class TerrascriptClient: # pylint: disable=too-many-public-methods
|
|
1645
1641
|
self.populate_tf_resource_rds(spec)
|
1646
1642
|
elif provider == "s3":
|
1647
1643
|
self.populate_tf_resource_s3(spec)
|
1648
|
-
elif provider == "elasticache":
|
1649
|
-
self.populate_tf_resource_elasticache(spec)
|
1650
1644
|
elif provider == "aws-iam-service-account":
|
1651
1645
|
self.populate_tf_resource_service_account(spec, ocm_map=ocm_map)
|
1652
1646
|
elif provider == "secrets-manager-service-account":
|
@@ -1689,8 +1683,6 @@ class TerrascriptClient: # pylint: disable=too-many-public-methods
|
|
1689
1683
|
self.populate_tf_resource_rosa_authenticator(spec)
|
1690
1684
|
elif provider == "rosa-authenticator-vpce":
|
1691
1685
|
self.populate_tf_resource_rosa_authenticator_vpce(spec)
|
1692
|
-
elif provider == "msk":
|
1693
|
-
self.populate_tf_resource_msk(spec)
|
1694
1686
|
else:
|
1695
1687
|
raise UnknownProviderError(provider)
|
1696
1688
|
|
@@ -2491,94 +2483,6 @@ class TerrascriptClient: # pylint: disable=too-many-public-methods
|
|
2491
2483
|
|
2492
2484
|
return bucket_tf_resource
|
2493
2485
|
|
2494
|
-
def populate_tf_resource_elasticache(self, spec):
|
2495
|
-
account = spec.provisioner_name
|
2496
|
-
identifier = spec.identifier
|
2497
|
-
values = self.init_values(spec)
|
2498
|
-
output_prefix = spec.output_prefix
|
2499
|
-
values.setdefault("replication_group_id", values["identifier"])
|
2500
|
-
values.pop("identifier", None)
|
2501
|
-
|
2502
|
-
tf_resources = []
|
2503
|
-
self.init_common_outputs(tf_resources, spec)
|
2504
|
-
|
2505
|
-
default_region = self.default_regions.get(account)
|
2506
|
-
desired_region = values.pop("region", default_region)
|
2507
|
-
|
2508
|
-
provider = ""
|
2509
|
-
if desired_region is not None and self._multiregion_account(account):
|
2510
|
-
provider = "aws." + desired_region
|
2511
|
-
values["provider"] = provider
|
2512
|
-
|
2513
|
-
if not values.get("apply_immediately"):
|
2514
|
-
values["apply_immediately"] = False
|
2515
|
-
|
2516
|
-
parameter_group = values.get("parameter_group")
|
2517
|
-
# Assume that cluster enabled is false if parameter group unset
|
2518
|
-
pg_cluster_enabled = False
|
2519
|
-
|
2520
|
-
if parameter_group:
|
2521
|
-
pg_values = self.get_values(parameter_group)
|
2522
|
-
pg_name = pg_values["name"]
|
2523
|
-
pg_identifier = pg_name
|
2524
|
-
|
2525
|
-
# If the desired region is not the same as the default region
|
2526
|
-
# we append the region to the identifier to make it unique
|
2527
|
-
# in the terraform config
|
2528
|
-
if desired_region is not None and desired_region != default_region:
|
2529
|
-
pg_identifier = f"{pg_name}-{desired_region}"
|
2530
|
-
|
2531
|
-
pg_values["parameter"] = pg_values.pop("parameters")
|
2532
|
-
for param in pg_values["parameter"]:
|
2533
|
-
if param["name"] == "cluster-enabled" and param["value"] == "yes":
|
2534
|
-
pg_cluster_enabled = True
|
2535
|
-
|
2536
|
-
if self._multiregion_account(account) and len(provider) > 0:
|
2537
|
-
pg_values["provider"] = provider
|
2538
|
-
pg_tf_resource = aws_elasticache_parameter_group(pg_identifier, **pg_values)
|
2539
|
-
tf_resources.append(pg_tf_resource)
|
2540
|
-
values["depends_on"] = [
|
2541
|
-
f"aws_elasticache_parameter_group.{pg_identifier}",
|
2542
|
-
]
|
2543
|
-
values["parameter_group_name"] = pg_name
|
2544
|
-
values.pop("parameter_group", None)
|
2545
|
-
|
2546
|
-
auth_token = spec.get_secret_field("db.auth_token")
|
2547
|
-
if not auth_token:
|
2548
|
-
auth_token = self.generate_random_password()
|
2549
|
-
|
2550
|
-
if values.get("transit_encryption_enabled", False):
|
2551
|
-
values["auth_token"] = auth_token
|
2552
|
-
|
2553
|
-
# elasticache replication group
|
2554
|
-
# Ref: https://www.terraform.io/docs/providers/aws/r/
|
2555
|
-
# elasticache_replication_group.html
|
2556
|
-
tf_resource = aws_elasticache_replication_group(identifier, **values)
|
2557
|
-
tf_resources.append(tf_resource)
|
2558
|
-
# elasticache outputs
|
2559
|
-
# we want the outputs to be formed into an OpenShift Secret
|
2560
|
-
# with the following fields
|
2561
|
-
# db.endpoint
|
2562
|
-
output_name = output_prefix + "__db_endpoint"
|
2563
|
-
# https://docs.aws.amazon.com/AmazonElastiCache/
|
2564
|
-
# latest/red-ug/Endpoints.html
|
2565
|
-
if pg_cluster_enabled:
|
2566
|
-
output_value = "${" + tf_resource.configuration_endpoint_address + "}"
|
2567
|
-
else:
|
2568
|
-
output_value = "${" + tf_resource.primary_endpoint_address + "}"
|
2569
|
-
tf_resources.append(Output(output_name, value=output_value))
|
2570
|
-
# db.port
|
2571
|
-
output_name = output_prefix + "__db_port"
|
2572
|
-
output_value = "${" + str(tf_resource.port) + "}"
|
2573
|
-
tf_resources.append(Output(output_name, value=output_value))
|
2574
|
-
# db.auth_token
|
2575
|
-
if values.get("transit_encryption_enabled", False):
|
2576
|
-
output_name = output_prefix + "__db_auth_token"
|
2577
|
-
output_value = values["auth_token"]
|
2578
|
-
tf_resources.append(Output(output_name, value=output_value, sensitive=True))
|
2579
|
-
|
2580
|
-
self.add_resources(account, tf_resources)
|
2581
|
-
|
2582
2486
|
def populate_tf_resource_service_account(self, spec, ocm_map=None):
|
2583
2487
|
account = spec.provisioner_name
|
2584
2488
|
identifier = spec.identifier
|
@@ -4287,24 +4191,6 @@ class TerrascriptClient: # pylint: disable=too-many-public-methods
|
|
4287
4191
|
values["db_name"] = db_name
|
4288
4192
|
if values.get("replica_source"):
|
4289
4193
|
values.pop("db_name", None)
|
4290
|
-
elif spec.provider == "elasticache":
|
4291
|
-
if description := values.pop("replication_group_description", None):
|
4292
|
-
values["description"] = description
|
4293
|
-
if num_cache_clusters := values.pop("number_cache_clusters", None):
|
4294
|
-
values["num_cache_clusters"] = num_cache_clusters
|
4295
|
-
if cluster_mode := values.pop("cluster_mode", {}):
|
4296
|
-
for k, v in cluster_mode.items():
|
4297
|
-
values[k] = v
|
4298
|
-
values.pop("availability_zones", None)
|
4299
|
-
elif spec.provider == "msk":
|
4300
|
-
if ebs_volume_size := values.get("broker_node_group_info", {}).pop(
|
4301
|
-
"ebs_volume_size", None
|
4302
|
-
):
|
4303
|
-
values["broker_node_group_info"].setdefault(
|
4304
|
-
"storage_info", {}
|
4305
|
-
).setdefault("ebs_storage_info", {})[
|
4306
|
-
"volume_size"
|
4307
|
-
] = ebs_volume_size
|
4308
4194
|
|
4309
4195
|
return values
|
4310
4196
|
|
@@ -6656,205 +6542,6 @@ class TerrascriptClient: # pylint: disable=too-many-public-methods
|
|
6656
6542
|
|
6657
6543
|
self.add_resources(account, tf_resources)
|
6658
6544
|
|
6659
|
-
def populate_tf_resource_msk(self, spec):
|
6660
|
-
account = spec.provisioner_name
|
6661
|
-
values = self.init_values(spec)
|
6662
|
-
output_prefix = spec.output_prefix
|
6663
|
-
tf_resources = []
|
6664
|
-
resource_id = spec.identifier
|
6665
|
-
|
6666
|
-
del values["identifier"]
|
6667
|
-
values.setdefault("cluster_name", spec.identifier)
|
6668
|
-
|
6669
|
-
# common
|
6670
|
-
self.init_common_outputs(tf_resources, spec)
|
6671
|
-
|
6672
|
-
# validations
|
6673
|
-
if (
|
6674
|
-
values["number_of_broker_nodes"]
|
6675
|
-
% len(values["broker_node_group_info"]["client_subnets"])
|
6676
|
-
!= 0
|
6677
|
-
):
|
6678
|
-
raise ValueError(
|
6679
|
-
"number_of_broker_nodes must be a multiple of the number of specified client subnets."
|
6680
|
-
)
|
6681
|
-
|
6682
|
-
scram_enabled = (
|
6683
|
-
values.get("client_authentication", {}).get("sasl", {}).get("scram", False)
|
6684
|
-
)
|
6685
|
-
scram_users = {}
|
6686
|
-
if scram_enabled:
|
6687
|
-
if not spec.resource.get("users", []):
|
6688
|
-
raise ValueError(
|
6689
|
-
"users attribute must be given when client_authentication.sasl.scram is enabled."
|
6690
|
-
)
|
6691
|
-
scram_users = {
|
6692
|
-
user["name"]: self.secret_reader.read_all(user["secret"])
|
6693
|
-
for user in spec.resource["users"]
|
6694
|
-
}
|
6695
|
-
# validate user objects
|
6696
|
-
for user, secret in scram_users.items():
|
6697
|
-
if secret.keys() != {"password", "username"}:
|
6698
|
-
raise ValueError(
|
6699
|
-
f"MSK user '{user}' secret must contain only 'username' and 'password' keys!"
|
6700
|
-
)
|
6701
|
-
|
6702
|
-
# resource - msk config
|
6703
|
-
# unique msk config resource name enables "create_before_destroy" lifecycle
|
6704
|
-
# which is required when changing version which requires a resource replacement
|
6705
|
-
msk_version_str = values["kafka_version"].replace(".", "-")
|
6706
|
-
msk_config_name = f"{resource_id}-{msk_version_str}"
|
6707
|
-
msk_config = aws_msk_configuration(
|
6708
|
-
msk_config_name,
|
6709
|
-
name=msk_config_name,
|
6710
|
-
kafka_versions=[values["kafka_version"]],
|
6711
|
-
server_properties=values["server_properties"],
|
6712
|
-
# lifecycle create_before_destroy is required to ensure that the config is created
|
6713
|
-
# before it is assigned to the cluster
|
6714
|
-
lifecycle={
|
6715
|
-
"create_before_destroy": True,
|
6716
|
-
},
|
6717
|
-
)
|
6718
|
-
tf_resources.append(msk_config)
|
6719
|
-
values.pop("server_properties", None)
|
6720
|
-
|
6721
|
-
# resource - cluster
|
6722
|
-
values["configuration_info"] = {
|
6723
|
-
"arn": "${" + msk_config.arn + "}",
|
6724
|
-
"revision": "${" + msk_config.latest_revision + "}",
|
6725
|
-
}
|
6726
|
-
msk_cluster = aws_msk_cluster(resource_id, **values)
|
6727
|
-
tf_resources.append(msk_cluster)
|
6728
|
-
|
6729
|
-
# resource - cloudwatch
|
6730
|
-
if (
|
6731
|
-
values.get("logging_info", {})
|
6732
|
-
.get("broker_logs", {})
|
6733
|
-
.get("cloudwatch_logs", {})
|
6734
|
-
.get("enabled", False)
|
6735
|
-
):
|
6736
|
-
log_group_values = {
|
6737
|
-
"name": f"{resource_id}-msk-broker-logs",
|
6738
|
-
"tags": values["tags"],
|
6739
|
-
"retention_in_days": values["logging_info"]["broker_logs"][
|
6740
|
-
"cloudwatch_logs"
|
6741
|
-
]["retention_in_days"],
|
6742
|
-
}
|
6743
|
-
log_group_tf_resource = aws_cloudwatch_log_group(
|
6744
|
-
resource_id, **log_group_values
|
6745
|
-
)
|
6746
|
-
tf_resources.append(log_group_tf_resource)
|
6747
|
-
del values["logging_info"]["broker_logs"]["cloudwatch_logs"][
|
6748
|
-
"retention_in_days"
|
6749
|
-
]
|
6750
|
-
values["logging_info"]["broker_logs"]["cloudwatch_logs"]["log_group"] = (
|
6751
|
-
log_group_tf_resource.name
|
6752
|
-
)
|
6753
|
-
|
6754
|
-
# resource - secret manager for SCRAM client credentials
|
6755
|
-
if scram_enabled and scram_users:
|
6756
|
-
scram_secrets: list[
|
6757
|
-
tuple[aws_secretsmanager_secret, aws_secretsmanager_secret_version]
|
6758
|
-
] = []
|
6759
|
-
|
6760
|
-
# kms
|
6761
|
-
kms_values = {
|
6762
|
-
"description": "KMS key for MSK SCRAM credentials",
|
6763
|
-
"tags": values["tags"],
|
6764
|
-
}
|
6765
|
-
kms_key = aws_kms_key(resource_id, **kms_values)
|
6766
|
-
tf_resources.append(kms_key)
|
6767
|
-
|
6768
|
-
kms_key_alias = aws_kms_alias(
|
6769
|
-
resource_id,
|
6770
|
-
name=f"alias/{resource_id}-msk-scram",
|
6771
|
-
target_key_id="${" + kms_key.arn + "}",
|
6772
|
-
)
|
6773
|
-
tf_resources.append(kms_key_alias)
|
6774
|
-
|
6775
|
-
for user, secret in scram_users.items():
|
6776
|
-
secret_identifier = f"AmazonMSK_{resource_id}-{user}"
|
6777
|
-
|
6778
|
-
secret_values = {
|
6779
|
-
"name": secret_identifier,
|
6780
|
-
"tags": values["tags"],
|
6781
|
-
"kms_key_id": "${" + kms_key.arn + "}",
|
6782
|
-
}
|
6783
|
-
secret_resource = aws_secretsmanager_secret(
|
6784
|
-
secret_identifier, **secret_values
|
6785
|
-
)
|
6786
|
-
tf_resources.append(secret_resource)
|
6787
|
-
|
6788
|
-
version_values = {
|
6789
|
-
"secret_id": "${" + secret_resource.arn + "}",
|
6790
|
-
"secret_string": json.dumps(secret, sort_keys=True),
|
6791
|
-
}
|
6792
|
-
version_resource = aws_secretsmanager_secret_version(
|
6793
|
-
secret_identifier, **version_values
|
6794
|
-
)
|
6795
|
-
tf_resources.append(version_resource)
|
6796
|
-
|
6797
|
-
secret_policy_values = {
|
6798
|
-
"secret_arn": "${" + secret_resource.arn + "}",
|
6799
|
-
"policy": json.dumps({
|
6800
|
-
"Version": "2012-10-17",
|
6801
|
-
"Statement": [
|
6802
|
-
{
|
6803
|
-
"Sid": "AWSKafkaResourcePolicy",
|
6804
|
-
"Effect": "Allow",
|
6805
|
-
"Principal": {"Service": "kafka.amazonaws.com"},
|
6806
|
-
"Action": "secretsmanager:getSecretValue",
|
6807
|
-
"Resource": "${" + secret_resource.arn + "}",
|
6808
|
-
}
|
6809
|
-
],
|
6810
|
-
}),
|
6811
|
-
}
|
6812
|
-
secret_policy = aws_secretsmanager_secret_policy(
|
6813
|
-
secret_identifier, **secret_policy_values
|
6814
|
-
)
|
6815
|
-
tf_resources.append(secret_policy)
|
6816
|
-
scram_secrets.append((secret_resource, version_resource))
|
6817
|
-
|
6818
|
-
# create ONE scram secret association for each secret created above
|
6819
|
-
scram_secret_association_values = {
|
6820
|
-
"cluster_arn": "${" + msk_cluster.arn + "}",
|
6821
|
-
"secret_arn_list": ["${" + s.arn + "}" for s, _ in scram_secrets],
|
6822
|
-
"depends_on": self.get_dependencies([v for _, v in scram_secrets]),
|
6823
|
-
}
|
6824
|
-
scram_secret_association = aws_msk_scram_secret_association(
|
6825
|
-
resource_id, **scram_secret_association_values
|
6826
|
-
)
|
6827
|
-
tf_resources.append(scram_secret_association)
|
6828
|
-
|
6829
|
-
# outputs
|
6830
|
-
tf_resources += [
|
6831
|
-
Output(
|
6832
|
-
output_prefix + "__zookeeper_connect_string",
|
6833
|
-
value="${" + msk_cluster.zookeeper_connect_string + "}",
|
6834
|
-
),
|
6835
|
-
Output(
|
6836
|
-
output_prefix + "__zookeeper_connect_string_tls",
|
6837
|
-
value="${" + msk_cluster.zookeeper_connect_string_tls + "}",
|
6838
|
-
),
|
6839
|
-
Output(
|
6840
|
-
output_prefix + "__bootstrap_brokers",
|
6841
|
-
value="${" + msk_cluster.bootstrap_brokers + "}",
|
6842
|
-
),
|
6843
|
-
Output(
|
6844
|
-
output_prefix + "__bootstrap_brokers_tls",
|
6845
|
-
value="${" + msk_cluster.bootstrap_brokers_tls + "}",
|
6846
|
-
),
|
6847
|
-
Output(
|
6848
|
-
output_prefix + "__bootstrap_brokers_sasl_iam",
|
6849
|
-
value="${" + msk_cluster.bootstrap_brokers_sasl_iam + "}",
|
6850
|
-
),
|
6851
|
-
Output(
|
6852
|
-
output_prefix + "__bootstrap_brokers_sasl_scram",
|
6853
|
-
value="${" + msk_cluster.bootstrap_brokers_sasl_scram + "}",
|
6854
|
-
),
|
6855
|
-
]
|
6856
|
-
self.add_resources(account, tf_resources)
|
6857
|
-
|
6858
6545
|
def populate_saml_idp(self, account_name: str, name: str, metadata: str) -> None:
|
6859
6546
|
saml_idp = aws_iam_saml_provider(
|
6860
6547
|
f"{account_name}-{name}", name=name, saml_metadata_document=metadata
|
File without changes
|
reconcile/gql_definitions/external_resources/fragments/external_resources_module_overrides.py
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
Generated by qenerate plugin=pydantic_v1. DO NOT MODIFY MANUALLY!
|
3
|
-
"""
|
4
|
-
from collections.abc import Callable # noqa: F401 # pylint: disable=W0611
|
5
|
-
from datetime import datetime # noqa: F401 # pylint: disable=W0611
|
6
|
-
from enum import Enum # noqa: F401 # pylint: disable=W0611
|
7
|
-
from typing import ( # noqa: F401 # pylint: disable=W0611
|
8
|
-
Any,
|
9
|
-
Optional,
|
10
|
-
Union,
|
11
|
-
)
|
12
|
-
|
13
|
-
from pydantic import ( # noqa: F401 # pylint: disable=W0611
|
14
|
-
BaseModel,
|
15
|
-
Extra,
|
16
|
-
Field,
|
17
|
-
Json,
|
18
|
-
)
|
19
|
-
|
20
|
-
from reconcile.gql_definitions.fragments.deplopy_resources import DeployResourcesFields
|
21
|
-
|
22
|
-
|
23
|
-
class ConfiguredBaseModel(BaseModel):
|
24
|
-
class Config:
|
25
|
-
smart_union=True
|
26
|
-
extra=Extra.forbid
|
27
|
-
|
28
|
-
|
29
|
-
class ExternalResourcesModuleOverrides(ConfiguredBaseModel):
|
30
|
-
module_type: Optional[str] = Field(..., alias="module_type")
|
31
|
-
image: Optional[str] = Field(..., alias="image")
|
32
|
-
version: Optional[str] = Field(..., alias="version")
|
33
|
-
reconcile_timeout_minutes: Optional[int] = Field(..., alias="reconcile_timeout_minutes")
|
34
|
-
outputs_secret_image: Optional[str] = Field(..., alias="outputs_secret_image")
|
35
|
-
outputs_secret_version: Optional[str] = Field(..., alias="outputs_secret_version")
|
36
|
-
resources: Optional[DeployResourcesFields] = Field(..., alias="resources")
|
{qontract_reconcile-0.10.2.dev40.dist-info → qontract_reconcile-0.10.2.dev42.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|