qontract-reconcile 0.10.2.dev202__py3-none-any.whl → 0.10.2.dev203__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.dev202.dist-info → qontract_reconcile-0.10.2.dev203.dist-info}/METADATA +1 -1
- {qontract_reconcile-0.10.2.dev202.dist-info → qontract_reconcile-0.10.2.dev203.dist-info}/RECORD +6 -6
- reconcile/utils/aws_api.py +34 -10
- reconcile/utils/terrascript_aws_client.py +1 -2
- {qontract_reconcile-0.10.2.dev202.dist-info → qontract_reconcile-0.10.2.dev203.dist-info}/WHEEL +0 -0
- {qontract_reconcile-0.10.2.dev202.dist-info → qontract_reconcile-0.10.2.dev203.dist-info}/entry_points.txt +0 -0
{qontract_reconcile-0.10.2.dev202.dist-info → qontract_reconcile-0.10.2.dev203.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.dev203
|
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.dev202.dist-info → qontract_reconcile-0.10.2.dev203.dist-info}/RECORD
RENAMED
@@ -597,7 +597,7 @@ reconcile/unleash_feature_toggles/integration.py,sha256=nx7BhtzCsTfPbOp60vI5MkNw
|
|
597
597
|
reconcile/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
598
598
|
reconcile/utils/aggregated_list.py,sha256=_9UeaS1TWbJsGIESvXlzzK-omPI2lMMcCsoqc9LBclc,4022
|
599
599
|
reconcile/utils/amtool.py,sha256=Ng5VVNCiPYEK67eDjIwfuuTLs5JsfltCwt6w5UfXbcY,2289
|
600
|
-
reconcile/utils/aws_api.py,sha256=
|
600
|
+
reconcile/utils/aws_api.py,sha256=Xrt4uukct0u5kkQBvl0azquF8JEbrb_aFtlBNEL2G2E,81488
|
601
601
|
reconcile/utils/aws_helper.py,sha256=8PvDR17ntAGX3bBzlTIxDuENl2rkK-RECsNYKm2_DZw,2955
|
602
602
|
reconcile/utils/batches.py,sha256=TtEm64a8lWhFuNbUVpFEmXVdU2Q0sTBrP_I0Cjbgh7g,320
|
603
603
|
reconcile/utils/binary.py,sha256=lSIevhilMeoGMePPHD7A-pxe45LVpBT0LksecYbM-EA,2477
|
@@ -670,7 +670,7 @@ reconcile/utils/state.py,sha256=az4tBmZ0EdbFcAGiBVUxs3cr2-BVWsuDQiNTvjjQq8s,1637
|
|
670
670
|
reconcile/utils/structs.py,sha256=LcbLEg8WxfRqM6nW7NhcWN0YeqF7SQzxOgntmLs1SgY,352
|
671
671
|
reconcile/utils/template.py,sha256=wTvRU4AnAV_o042tD4Mwls2dwWMuk7MKnde3MaCjaYg,331
|
672
672
|
reconcile/utils/terraform_client.py,sha256=IDlrNvGEc2i6ElZIL_fzaJEad1nRC3DkP9_VXhJXmU0,37329
|
673
|
-
reconcile/utils/terrascript_aws_client.py,sha256=
|
673
|
+
reconcile/utils/terrascript_aws_client.py,sha256=RkiYjRietHFNXtfA1-WEZ1lZbJFBA_XCtTOsZUij5VM,292360
|
674
674
|
reconcile/utils/three_way_diff_strategy.py,sha256=oQcHXd9LVhirJfoaOBoHUYuZVGfyL2voKr6KVI34zZE,4833
|
675
675
|
reconcile/utils/throughput.py,sha256=iP4UWAe2LVhDo69mPPmgo9nQ7RxHD6_GS8MZe-aSiuM,344
|
676
676
|
reconcile/utils/vault.py,sha256=aSA8l9cJlPUHpChFGl27nSY-Mpq9FMjBo7Dcgb1BVfM,15036
|
@@ -809,7 +809,7 @@ tools/saas_promotion_state/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
|
|
809
809
|
tools/saas_promotion_state/saas_promotion_state.py,sha256=UfwwRLS5Ya4_Nh1w5n1dvoYtchQvYE9yj1VANt2IKqI,3925
|
810
810
|
tools/sre_checkpoints/__init__.py,sha256=CDaDaywJnmRCLyl_NCcvxi-Zc0hTi_3OdwKiFOyS39I,145
|
811
811
|
tools/sre_checkpoints/util.py,sha256=zEDbGr18ZeHNQwW8pUsr2JRjuXIPz--WAGJxZo9sv_Y,894
|
812
|
-
qontract_reconcile-0.10.2.
|
813
|
-
qontract_reconcile-0.10.2.
|
814
|
-
qontract_reconcile-0.10.2.
|
815
|
-
qontract_reconcile-0.10.2.
|
812
|
+
qontract_reconcile-0.10.2.dev203.dist-info/METADATA,sha256=jLhZJ7x1qlr15Wil2EAOm2Aq2kAZBKMRm6RgIQhGAoM,24555
|
813
|
+
qontract_reconcile-0.10.2.dev203.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
814
|
+
qontract_reconcile-0.10.2.dev203.dist-info/entry_points.txt,sha256=5i9l54La3vQrDLAdwDKQWC0iG4sV9RRfOb1BpvzOWLc,698
|
815
|
+
qontract_reconcile-0.10.2.dev203.dist-info/RECORD,,
|
reconcile/utils/aws_api.py
CHANGED
@@ -42,6 +42,7 @@ if TYPE_CHECKING:
|
|
42
42
|
FilterTypeDef,
|
43
43
|
ImageTypeDef,
|
44
44
|
LaunchPermissionModificationsTypeDef,
|
45
|
+
NetworkInterfaceTypeDef,
|
45
46
|
RouteTableTypeDef,
|
46
47
|
SubnetTypeDef,
|
47
48
|
TagTypeDef,
|
@@ -52,6 +53,10 @@ if TYPE_CHECKING:
|
|
52
53
|
)
|
53
54
|
from mypy_boto3_ecr import ECRClient
|
54
55
|
from mypy_boto3_elb import ElasticLoadBalancingClient
|
56
|
+
from mypy_boto3_elb.type_defs import (
|
57
|
+
LoadBalancerDescriptionTypeDef,
|
58
|
+
TagDescriptionTypeDef,
|
59
|
+
)
|
55
60
|
from mypy_boto3_iam import IAMClient, IAMServiceResource
|
56
61
|
from mypy_boto3_iam.type_defs import AccessKeyMetadataTypeDef
|
57
62
|
from mypy_boto3_logs import CloudWatchLogsClient
|
@@ -92,7 +97,9 @@ else:
|
|
92
97
|
TransitGatewayTypeDef
|
93
98
|
) = TransitGatewayVpcAttachmentTypeDef = UpgradeTargetTypeDef = (
|
94
99
|
VpcEndpointTypeDef
|
95
|
-
) = VpcTypeDef =
|
100
|
+
) = VpcTypeDef = NetworkInterfaceTypeDef = LoadBalancerDescriptionTypeDef = (
|
101
|
+
TagDescriptionTypeDef
|
102
|
+
) = object
|
96
103
|
|
97
104
|
|
98
105
|
class InvalidResourceTypeError(Exception):
|
@@ -194,9 +201,9 @@ class AWSApi:
|
|
194
201
|
self.get_vpc_route_tables = lru_cache()(self.get_vpc_route_tables) # type: ignore[method-assign]
|
195
202
|
self.get_vpc_subnets = lru_cache()(self.get_vpc_subnets) # type: ignore[method-assign]
|
196
203
|
self._get_vpc_endpoints = lru_cache()(self._get_vpc_endpoints) # type: ignore[method-assign]
|
197
|
-
self.
|
198
|
-
|
199
|
-
)
|
204
|
+
self.get_network_interfaces = lru_cache()(self.get_network_interfaces) # type: ignore[method-assign]
|
205
|
+
self.get_load_balancers = lru_cache()(self.get_load_balancers) # type: ignore[method-assign]
|
206
|
+
self.get_load_balancer_tags = lru_cache()(self.get_load_balancer_tags) # type: ignore[method-assign]
|
200
207
|
|
201
208
|
if init_users:
|
202
209
|
self.init_users()
|
@@ -1568,8 +1575,9 @@ class AWSApi:
|
|
1568
1575
|
ec2.create_tags(Resources=[resource_id], Tags=[tag_type_def])
|
1569
1576
|
|
1570
1577
|
def get_alb_network_interface_ips(
|
1571
|
-
self,
|
1578
|
+
self, account: awsh.Account, service_name: str
|
1572
1579
|
) -> set[str]:
|
1580
|
+
assumed_role_data = self._get_account_assume_data(account)
|
1573
1581
|
ec2_client = self._get_assumed_role_client(
|
1574
1582
|
account_name=assumed_role_data[0],
|
1575
1583
|
assume_role=assumed_role_data[1],
|
@@ -1583,14 +1591,14 @@ class AWSApi:
|
|
1583
1591
|
client_type="elb",
|
1584
1592
|
)
|
1585
1593
|
service_tag = {"Key": "kubernetes.io/service-name", "Value": service_name}
|
1586
|
-
nis =
|
1587
|
-
lbs =
|
1594
|
+
nis = self.get_network_interfaces(ec2_client)
|
1595
|
+
lbs = self.get_load_balancers(elb_client)
|
1588
1596
|
result_ips = set()
|
1589
1597
|
for lb in lbs:
|
1590
1598
|
lb_name = lb["LoadBalancerName"]
|
1591
|
-
tag_descriptions =
|
1592
|
-
|
1593
|
-
|
1599
|
+
tag_descriptions = self.get_load_balancer_tags(
|
1600
|
+
elb=elb_client, lb_name=lb_name
|
1601
|
+
)
|
1594
1602
|
for td in tag_descriptions:
|
1595
1603
|
tags = td["Tags"]
|
1596
1604
|
if service_tag not in tags:
|
@@ -1608,6 +1616,22 @@ class AWSApi:
|
|
1608
1616
|
|
1609
1617
|
return result_ips
|
1610
1618
|
|
1619
|
+
@staticmethod
|
1620
|
+
def get_network_interfaces(ec2: EC2Client) -> list[NetworkInterfaceTypeDef]:
|
1621
|
+
return ec2.describe_network_interfaces()["NetworkInterfaces"]
|
1622
|
+
|
1623
|
+
@staticmethod
|
1624
|
+
def get_load_balancers(
|
1625
|
+
elb: ElasticLoadBalancingClient,
|
1626
|
+
) -> list[LoadBalancerDescriptionTypeDef]:
|
1627
|
+
return elb.describe_load_balancers()["LoadBalancerDescriptions"]
|
1628
|
+
|
1629
|
+
@staticmethod
|
1630
|
+
def get_load_balancer_tags(
|
1631
|
+
elb: ElasticLoadBalancingClient, lb_name: str
|
1632
|
+
) -> list[TagDescriptionTypeDef]:
|
1633
|
+
return elb.describe_tags(LoadBalancerNames=[lb_name])["TagDescriptions"]
|
1634
|
+
|
1611
1635
|
@staticmethod
|
1612
1636
|
def get_vpc_default_sg_id(vpc_id: str, ec2: EC2Client) -> str | None:
|
1613
1637
|
vpc_security_groups = ec2.describe_security_groups(
|
@@ -5189,8 +5189,7 @@ class TerrascriptClient: # pylint: disable=too-many-public-methods
|
|
5189
5189
|
with AWSApi(
|
5190
5190
|
1, [account], secret_reader=self.secret_reader, init_users=False
|
5191
5191
|
) as awsapi:
|
5192
|
-
|
5193
|
-
ips = awsapi.get_alb_network_interface_ips(assumed_role_data, service_name)
|
5192
|
+
ips = awsapi.get_alb_network_interface_ips(account, service_name)
|
5194
5193
|
if not ips:
|
5195
5194
|
raise ValueError(
|
5196
5195
|
f"[{account_name}/{identifier}] expected at least one "
|
{qontract_reconcile-0.10.2.dev202.dist-info → qontract_reconcile-0.10.2.dev203.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|