qontract-reconcile 0.10.2.dev63__py3-none-any.whl → 0.10.2.dev65__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.dev63.dist-info → qontract_reconcile-0.10.2.dev65.dist-info}/METADATA +1 -1
- {qontract_reconcile-0.10.2.dev63.dist-info → qontract_reconcile-0.10.2.dev65.dist-info}/RECORD +6 -6
- reconcile/utils/ocm/labels.py +12 -0
- reconcile/utils/terrascript_aws_client.py +47 -4
- {qontract_reconcile-0.10.2.dev63.dist-info → qontract_reconcile-0.10.2.dev65.dist-info}/WHEEL +0 -0
- {qontract_reconcile-0.10.2.dev63.dist-info → qontract_reconcile-0.10.2.dev65.dist-info}/entry_points.txt +0 -0
{qontract_reconcile-0.10.2.dev63.dist-info → qontract_reconcile-0.10.2.dev65.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.dev65
|
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.dev63.dist-info → qontract_reconcile-0.10.2.dev65.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
|
@@ -707,7 +707,7 @@ reconcile/utils/ocm/cluster_groups.py,sha256=F8oqVqN_4QUnGL0K61zZhoYIzJeP57EcmZp
|
|
707
707
|
reconcile/utils/ocm/clusters.py,sha256=VwFucqOtXfHZABZLsMLxvAhBTwVg6h9L7WDDdJUaB1w,7962
|
708
708
|
reconcile/utils/ocm/identity_providers.py,sha256=dKed09N8iWmn39tI_MpwgVe47x23eLsknGbjMUxtwr4,2175
|
709
709
|
reconcile/utils/ocm/label_sources.py,sha256=ES_5VP4X6gsRxMFZ95WgbwE_HqqIUo_JRjHjdGYw6Ss,1846
|
710
|
-
reconcile/utils/ocm/labels.py,sha256=
|
710
|
+
reconcile/utils/ocm/labels.py,sha256=CmAgaOEPiaUb4gLtKab9vNkSDJceuREPd4ApgGcIA1U,6240
|
711
711
|
reconcile/utils/ocm/manifests.py,sha256=Q6kgOeiAwLbJY_vO_BEW2oePvbLDZcMZk20YpJJGpOA,1195
|
712
712
|
reconcile/utils/ocm/ocm.py,sha256=EwhCymt7r8cL8UF2XbwmQ6IiRE016AUuPEiMAtYMepE,36707
|
713
713
|
reconcile/utils/ocm/products.py,sha256=Ki9o0VV4z_FsXQaJtSFzlUnxLvpk1H-RamvJpUwwbuQ,26006
|
@@ -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.dev65.dist-info/METADATA,sha256=Wv30Cf9UuON-ZNSyiNXTocpDNcpFrLTFSdglYgLe_Vg,24665
|
781
|
+
qontract_reconcile-0.10.2.dev65.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
782
|
+
qontract_reconcile-0.10.2.dev65.dist-info/entry_points.txt,sha256=5i9l54La3vQrDLAdwDKQWC0iG4sV9RRfOb1BpvzOWLc,698
|
783
|
+
qontract_reconcile-0.10.2.dev65.dist-info/RECORD,,
|
reconcile/utils/ocm/labels.py
CHANGED
@@ -202,3 +202,15 @@ def get_org_labels(
|
|
202
202
|
|
203
203
|
def build_organization_labels_href(org_id: str) -> str:
|
204
204
|
return f"/api/accounts_mgmt/v1/organizations/{org_id}/labels"
|
205
|
+
|
206
|
+
|
207
|
+
def get_cluster_labels_for_cluster_id(
|
208
|
+
ocm_api: OCMBaseClient,
|
209
|
+
id: str,
|
210
|
+
) -> dict[str, str]:
|
211
|
+
data = ocm_api.get(
|
212
|
+
api_path=f"/api/clusters_mgmt/v1/clusters/{id}/external_configuration/labels"
|
213
|
+
)
|
214
|
+
return {
|
215
|
+
key: d.get("value") for d in data.get("items") or [] if (key := d.get("key"))
|
216
|
+
}
|
@@ -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
|
}
|
{qontract_reconcile-0.10.2.dev63.dist-info → qontract_reconcile-0.10.2.dev65.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|