qontract-reconcile 0.10.1rc1184__py3-none-any.whl → 0.10.1rc1185__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.1
2
2
  Name: qontract-reconcile
3
- Version: 0.10.1rc1184
3
+ Version: 0.10.1rc1185
4
4
  Summary: Collection of tools to reconcile services with their desired state as defined in the app-interface DB.
5
5
  Home-page: https://github.com/app-sre/qontract-reconcile
6
6
  Author: Red Hat App-SRE Team
@@ -655,7 +655,7 @@ reconcile/unleash_feature_toggles/integration.py,sha256=nx7BhtzCsTfPbOp60vI5MkNw
655
655
  reconcile/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
656
656
  reconcile/utils/aggregated_list.py,sha256=km0xadW0jO4G_CqZPsXmoBURQ8c90FaTu5x4X1K1cZs,3357
657
657
  reconcile/utils/amtool.py,sha256=ngtBuVPETH6oAy5RnKzvreVbjwQCaATS_PYYwBprzjQ,2288
658
- reconcile/utils/aws_api.py,sha256=Mp5-euZUfKfnVzgMZd3LoWbegm1OrNjzpP1A-n2EiF0,67640
658
+ reconcile/utils/aws_api.py,sha256=8LeEweWeydLJB9t-neYkYSN6EneDJontGwcglg0xmS0,67652
659
659
  reconcile/utils/aws_helper.py,sha256=MDbv5jrNdqqJ5pfBxniGdJXBBO_EYc2_Uf2w9ZzeMNs,2854
660
660
  reconcile/utils/batches.py,sha256=TtEm64a8lWhFuNbUVpFEmXVdU2Q0sTBrP_I0Cjbgh7g,320
661
661
  reconcile/utils/binary.py,sha256=7MaAFBpzuBUTJ_aA6G6-eult_BPMVyiXbBLD0Y6F-DM,2301
@@ -882,8 +882,8 @@ tools/test/test_qontract_cli.py,sha256=iuzKbQ6ahinvjoQmQLBrG4shey0z-1rB6qCgS8T6d
882
882
  tools/test/test_saas_promotion_state.py,sha256=dy4kkSSAQ7bC0Xp2CociETGN-2aABEfL6FU5D9Jl00Y,6056
883
883
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
884
884
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
885
- qontract_reconcile-0.10.1rc1184.dist-info/METADATA,sha256=8DHsuGLxV4LuSR7LPUvgLMjGqffzD8xy5iCyTv2Ltuc,2213
886
- qontract_reconcile-0.10.1rc1184.dist-info/WHEEL,sha256=bFJAMchF8aTQGUgMZzHJyDDMPTO3ToJ7x23SLJa1SVo,92
887
- qontract_reconcile-0.10.1rc1184.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
888
- qontract_reconcile-0.10.1rc1184.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
889
- qontract_reconcile-0.10.1rc1184.dist-info/RECORD,,
885
+ qontract_reconcile-0.10.1rc1185.dist-info/METADATA,sha256=QatFHWfiRw29TrdKQtJhxXlwWCTa6pwrNTKTnxBMJtY,2213
886
+ qontract_reconcile-0.10.1rc1185.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
887
+ qontract_reconcile-0.10.1rc1185.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
888
+ qontract_reconcile-0.10.1rc1185.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
889
+ qontract_reconcile-0.10.1rc1185.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.45.0)
2
+ Generator: bdist_wheel (0.45.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -956,36 +956,43 @@ class AWSApi: # pylint: disable=too-many-public-methods
956
956
  for s in vpc_subnets
957
957
  ]
958
958
  if hcp_vpc_endpoint_sg:
959
- endpoints = AWSApi._get_vpc_endpoints(
960
- [
961
- {"Name": "vpc-id", "Values": [vpc_id]},
962
- {
963
- "Name": "tag:AWSEndpointService",
964
- "Values": ["private-router"],
965
- },
966
- ],
967
- assumed_ec2,
959
+ api_security_group_id = self._get_api_security_group_id(
960
+ assumed_ec2, vpc_id
968
961
  )
969
- if len(endpoints) > 1:
970
- raise ValueError(
971
- f"exactly one VPC endpoint for private API router in VPC {vpc_id} expected but {len(endpoints)} found"
972
- )
973
- vpc_endpoint_id = endpoints[0]["VpcEndpointId"]
974
- # https://github.com/openshift/hypershift/blob/c855f68e84e78924ccc9c2132b75dc7e30c4e1d8/control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller.go#L4243
975
- security_groups = [
976
- sg
977
- for sg in endpoints[0]["Groups"]
978
- if sg["GroupName"].endswith("-default-sg")
979
- ]
980
- if len(security_groups) != 1:
981
- raise ValueError(
982
- f"exactly one VPC endpoint default security group for private API router {vpc_endpoint_id} "
983
- f"in VPC {vpc_id} expected but {len(security_groups)} found"
984
- )
985
- api_security_group_id = security_groups[0]["GroupId"]
986
962
 
987
963
  return vpc_id, route_table_ids, subnets_id_az, api_security_group_id
988
964
 
965
+ def _get_api_security_group_id(self, assumed_ec2, vpc_id):
966
+ endpoints = AWSApi._get_vpc_endpoints(
967
+ [
968
+ {"Name": "vpc-id", "Values": [vpc_id]},
969
+ {
970
+ "Name": "tag:AWSEndpointService",
971
+ "Values": ["private-router"],
972
+ },
973
+ ],
974
+ assumed_ec2,
975
+ )
976
+ if not endpoints:
977
+ return None
978
+ if len(endpoints) > 1:
979
+ raise ValueError(
980
+ f"exactly one VPC endpoint for private API router in VPC {vpc_id} expected but {len(endpoints)} found"
981
+ )
982
+ vpc_endpoint_id = endpoints[0]["VpcEndpointId"]
983
+ # https://github.com/openshift/hypershift/blob/c855f68e84e78924ccc9c2132b75dc7e30c4e1d8/control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller.go#L4243
984
+ security_groups = [
985
+ sg
986
+ for sg in endpoints[0]["Groups"]
987
+ if sg["GroupName"].endswith("-default-sg")
988
+ ]
989
+ if len(security_groups) != 1:
990
+ raise ValueError(
991
+ f"exactly one VPC endpoint default security group for private API router {vpc_endpoint_id} "
992
+ f"in VPC {vpc_id} expected but {len(security_groups)} found"
993
+ )
994
+ return security_groups[0]["GroupId"]
995
+
989
996
  def get_cluster_nat_gateways_egress_ips(self, account: dict[str, Any], vpc_id: str):
990
997
  assumed_role_data = self._get_account_assume_data(account)
991
998
  assumed_ec2 = self._get_assumed_role_client(*assumed_role_data)