qontract-reconcile 0.10.2.dev64__py3-none-any.whl → 0.10.2.dev66__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.dev64.dist-info → qontract_reconcile-0.10.2.dev66.dist-info}/METADATA +1 -1
- {qontract_reconcile-0.10.2.dev64.dist-info → qontract_reconcile-0.10.2.dev66.dist-info}/RECORD +6 -6
- reconcile/utils/terrascript_aws_client.py +47 -4
- tools/qontract_cli.py +32 -15
- {qontract_reconcile-0.10.2.dev64.dist-info → qontract_reconcile-0.10.2.dev66.dist-info}/WHEEL +0 -0
- {qontract_reconcile-0.10.2.dev64.dist-info → qontract_reconcile-0.10.2.dev66.dist-info}/entry_points.txt +0 -0
{qontract_reconcile-0.10.2.dev64.dist-info → qontract_reconcile-0.10.2.dev66.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.dev66
|
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.dev64.dist-info → qontract_reconcile-0.10.2.dev66.dist-info}/RECORD
RENAMED
@@ -637,7 +637,7 @@ reconcile/utils/state.py,sha256=az4tBmZ0EdbFcAGiBVUxs3cr2-BVWsuDQiNTvjjQq8s,1637
|
|
637
637
|
reconcile/utils/structs.py,sha256=LcbLEg8WxfRqM6nW7NhcWN0YeqF7SQzxOgntmLs1SgY,352
|
638
638
|
reconcile/utils/template.py,sha256=wTvRU4AnAV_o042tD4Mwls2dwWMuk7MKnde3MaCjaYg,331
|
639
639
|
reconcile/utils/terraform_client.py,sha256=H8frsS370y8xfivKLNBD1dwlBLHvfuR6JSN_syBL5Qc,36033
|
640
|
-
reconcile/utils/terrascript_aws_client.py,sha256=
|
640
|
+
reconcile/utils/terrascript_aws_client.py,sha256=hPfWduAsMpVUcYgw1cx7tiAyVmsJ1BdTCqPzyYPTThE,286260
|
641
641
|
reconcile/utils/three_way_diff_strategy.py,sha256=oQcHXd9LVhirJfoaOBoHUYuZVGfyL2voKr6KVI34zZE,4833
|
642
642
|
reconcile/utils/throughput.py,sha256=iP4UWAe2LVhDo69mPPmgo9nQ7RxHD6_GS8MZe-aSiuM,344
|
643
643
|
reconcile/utils/vault.py,sha256=aSA8l9cJlPUHpChFGl27nSY-Mpq9FMjBo7Dcgb1BVfM,15036
|
@@ -750,7 +750,7 @@ tools/app_sre_tekton_access_reporter.py,sha256=o9prLUgQpwO3msRWc2as1xT1y9OB3znkp
|
|
750
750
|
tools/app_sre_tekton_access_revalidation.py,sha256=66nHEaY-bIqxIhpcmwN8AvQZu6ZXenfkg4Fut0pVZRM,2726
|
751
751
|
tools/glitchtip_access_reporter.py,sha256=o01A6b88t3Wie6tj_tJWWVo2J01LxQ_a9giGm4UzEaU,2901
|
752
752
|
tools/glitchtip_access_revalidation.py,sha256=8kbBJk04mkq28kWoRDDkfCGIF3GRg3pJrFAh1sW0dbk,2821
|
753
|
-
tools/qontract_cli.py,sha256=
|
753
|
+
tools/qontract_cli.py,sha256=dmCg4SF286H9xgepCe36noYj3hvQPDNFpZNw6jG_AQ0,152870
|
754
754
|
tools/sd_app_sre_alert_report.py,sha256=jQpJdXVID68bSNtJNOGDh0-ei1CfEUS4Itr4MAaBNFA,5062
|
755
755
|
tools/template_validation.py,sha256=qpKYaTgk0GOPGa2Ct5_5sKdwIHtCAKIBGzsMPuJU5fw,3371
|
756
756
|
tools/cli_commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -777,7 +777,7 @@ tools/saas_promotion_state/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
|
|
777
777
|
tools/saas_promotion_state/saas_promotion_state.py,sha256=UfwwRLS5Ya4_Nh1w5n1dvoYtchQvYE9yj1VANt2IKqI,3925
|
778
778
|
tools/sre_checkpoints/__init__.py,sha256=CDaDaywJnmRCLyl_NCcvxi-Zc0hTi_3OdwKiFOyS39I,145
|
779
779
|
tools/sre_checkpoints/util.py,sha256=zEDbGr18ZeHNQwW8pUsr2JRjuXIPz--WAGJxZo9sv_Y,894
|
780
|
-
qontract_reconcile-0.10.2.
|
781
|
-
qontract_reconcile-0.10.2.
|
782
|
-
qontract_reconcile-0.10.2.
|
783
|
-
qontract_reconcile-0.10.2.
|
780
|
+
qontract_reconcile-0.10.2.dev66.dist-info/METADATA,sha256=WNn27yZZJD-FxtNtcntxwfwNLSB84rYwJiNuv_YS-Aw,24665
|
781
|
+
qontract_reconcile-0.10.2.dev66.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
782
|
+
qontract_reconcile-0.10.2.dev66.dist-info/entry_points.txt,sha256=5i9l54La3vQrDLAdwDKQWC0iG4sV9RRfOb1BpvzOWLc,698
|
783
|
+
qontract_reconcile-0.10.2.dev66.dist-info/RECORD,,
|
@@ -270,6 +270,36 @@ DEFAULT_TAGS = {
|
|
270
270
|
},
|
271
271
|
}
|
272
272
|
|
273
|
+
AWS_ELB_ACCOUNT_IDS = {
|
274
|
+
"us-east-1": "127311923021",
|
275
|
+
"us-east-2": "033677994240",
|
276
|
+
"us-west-1": "027434742980",
|
277
|
+
"us-west-2": "797873946194",
|
278
|
+
"af-south-1": "098369216593",
|
279
|
+
"ap-east-1": "754344448648",
|
280
|
+
"ap-southeast-3": "589379963580",
|
281
|
+
"ap-south-1": "718504428378",
|
282
|
+
"ap-northeast-3": "383597477331",
|
283
|
+
"ap-northeast-2": "600734575887",
|
284
|
+
"ap-southeast-1": "114774131450",
|
285
|
+
"ap-southeast-2": "783225319266",
|
286
|
+
"ap-northeast-1": "582318560864",
|
287
|
+
"ca-central-1": "985666609251",
|
288
|
+
"eu-central-1": "054676820928",
|
289
|
+
"eu-west-1": "156460612806",
|
290
|
+
"eu-west-2": "652711504416",
|
291
|
+
"eu-south-1": "635631232127",
|
292
|
+
"eu-west-3": "009996457667",
|
293
|
+
"eu-north-1": "897822967062",
|
294
|
+
"me-south-1": "076674570225",
|
295
|
+
"sa-east-1": "507241528517",
|
296
|
+
}
|
297
|
+
|
298
|
+
AWS_US_GOV_ELB_ACCOUNT_IDS = {
|
299
|
+
"us-gov-west-1": "048591011584",
|
300
|
+
"us-gov-east-1": "190560391635",
|
301
|
+
}
|
302
|
+
|
273
303
|
|
274
304
|
class OutputResourceNameNotUniqueException(Exception):
|
275
305
|
def __init__(self, namespace, duplicates):
|
@@ -5148,6 +5178,16 @@ class TerrascriptClient: # pylint: disable=too-many-public-methods
|
|
5148
5178
|
raise KeyError(f"unknown alb rule condition type {condition_type}")
|
5149
5179
|
return {condition_type_key: {"values": condition[condition_type_key]}}
|
5150
5180
|
|
5181
|
+
@staticmethod
|
5182
|
+
def _get_principal_for_s3_bucket_policy(
|
5183
|
+
region: str, elb_account_id: str | None
|
5184
|
+
) -> Mapping[str, str]:
|
5185
|
+
if region in AWS_ELB_ACCOUNT_IDS:
|
5186
|
+
return {"AWS": f"arn:aws:iam::{elb_account_id}:root"}
|
5187
|
+
if region in AWS_US_GOV_ELB_ACCOUNT_IDS:
|
5188
|
+
return {"AWS": f"arn:aws-us-gov:iam::{elb_account_id}:root"}
|
5189
|
+
return {"Service": "logdelivery.elasticloadbalancing.amazonaws.com"}
|
5190
|
+
|
5151
5191
|
def populate_tf_resource_alb(self, spec, ocm_map=None):
|
5152
5192
|
account = spec.provisioner_name
|
5153
5193
|
identifier = spec.identifier
|
@@ -5262,15 +5302,18 @@ class TerrascriptClient: # pylint: disable=too-many-public-methods
|
|
5262
5302
|
tf_resources.append(lb_access_logs_s3_bucket_tf_resource)
|
5263
5303
|
|
5264
5304
|
policy_identifier = f"{identifier}-s3-bucket-policy"
|
5265
|
-
|
5305
|
+
region = str(
|
5306
|
+
common_values.get("region") or self.default_regions.get(account)
|
5307
|
+
)
|
5308
|
+
elb_account_id = self._get_elb_account_id(region)
|
5309
|
+
principal = self._get_principal_for_s3_bucket_policy(region, elb_account_id)
|
5310
|
+
|
5266
5311
|
policy = {
|
5267
5312
|
"Version": "2012-10-17",
|
5268
5313
|
"Statement": [
|
5269
5314
|
{
|
5270
5315
|
"Effect": "Allow",
|
5271
|
-
"Principal":
|
5272
|
-
"AWS": f"arn:aws:iam::{self.accounts[account]['uid']}:root"
|
5273
|
-
},
|
5316
|
+
"Principal": principal,
|
5274
5317
|
"Action": "s3:PutObject",
|
5275
5318
|
"Resource": f"${{{lb_access_logs_s3_bucket_tf_resource.arn}}}/*",
|
5276
5319
|
}
|
tools/qontract_cli.py
CHANGED
@@ -4271,6 +4271,29 @@ def get_input(ctx: click.Context) -> None:
|
|
4271
4271
|
print(erv2cli.input_data)
|
4272
4272
|
|
4273
4273
|
|
4274
|
+
def _get_external_resources_credentials(
|
4275
|
+
secret_reader: SecretReader,
|
4276
|
+
provisioner: str,
|
4277
|
+
) -> str:
|
4278
|
+
return secret_reader.read_with_parameters(
|
4279
|
+
path=f"app-sre/external-resources/{provisioner}",
|
4280
|
+
field="credentials",
|
4281
|
+
format=None,
|
4282
|
+
version=None,
|
4283
|
+
)
|
4284
|
+
|
4285
|
+
|
4286
|
+
@external_resources.command()
|
4287
|
+
@click.pass_context
|
4288
|
+
def get_credentials(ctx: click.Context) -> None:
|
4289
|
+
"""Gets credentials file used in external-resources as AWS_SHARED_CREDENTIALS_FILE"""
|
4290
|
+
credentials = _get_external_resources_credentials(
|
4291
|
+
secret_reader=ctx.obj["secret_reader"],
|
4292
|
+
provisioner=ctx.obj["provisioner"],
|
4293
|
+
)
|
4294
|
+
print(credentials)
|
4295
|
+
|
4296
|
+
|
4274
4297
|
@external_resources.command()
|
4275
4298
|
@click.pass_context
|
4276
4299
|
def request_reconciliation(ctx: click.Context) -> None:
|
@@ -4333,11 +4356,9 @@ def migrate(ctx: click.Context, dry_run: bool, skip_build: bool) -> None:
|
|
4333
4356
|
# prepare AWS credentials for CDKTF and local terraform
|
4334
4357
|
credentials_file = tempdir / "credentials"
|
4335
4358
|
credentials_file.write_text(
|
4336
|
-
|
4337
|
-
|
4338
|
-
|
4339
|
-
format=None,
|
4340
|
-
version=None,
|
4359
|
+
_get_external_resources_credentials(
|
4360
|
+
secret_reader=ctx.obj["secret_reader"],
|
4361
|
+
provisioner=ctx.obj["provisioner"],
|
4341
4362
|
)
|
4342
4363
|
)
|
4343
4364
|
os.environ["AWS_SHARED_CREDENTIALS_FILE"] = str(credentials_file)
|
@@ -4415,11 +4436,9 @@ def debug_shell(ctx: click.Context) -> None:
|
|
4415
4436
|
with task(progress, "Preparing environment ..."):
|
4416
4437
|
credentials_file = tempdir / "credentials"
|
4417
4438
|
credentials_file.write_text(
|
4418
|
-
|
4419
|
-
|
4420
|
-
|
4421
|
-
format=None,
|
4422
|
-
version=None,
|
4439
|
+
_get_external_resources_credentials(
|
4440
|
+
secret_reader=ctx.obj["secret_reader"],
|
4441
|
+
provisioner=ctx.obj["provisioner"],
|
4423
4442
|
)
|
4424
4443
|
)
|
4425
4444
|
os.environ["AWS_SHARED_CREDENTIALS_FILE"] = str(credentials_file)
|
@@ -4456,11 +4475,9 @@ def force_unlock(ctx: click.Context, lock_id: str) -> None:
|
|
4456
4475
|
with task(progress, "Preparing environment ..."):
|
4457
4476
|
credentials_file = tempdir / "credentials"
|
4458
4477
|
credentials_file.write_text(
|
4459
|
-
|
4460
|
-
|
4461
|
-
|
4462
|
-
format=None,
|
4463
|
-
version=None,
|
4478
|
+
_get_external_resources_credentials(
|
4479
|
+
secret_reader=ctx.obj["secret_reader"],
|
4480
|
+
provisioner=ctx.obj["provisioner"],
|
4464
4481
|
)
|
4465
4482
|
)
|
4466
4483
|
os.environ["AWS_SHARED_CREDENTIALS_FILE"] = str(credentials_file)
|
{qontract_reconcile-0.10.2.dev64.dist-info → qontract_reconcile-0.10.2.dev66.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|