qontract-reconcile 0.10.1rc516__py3-none-any.whl → 0.10.1rc518__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.1rc516
3
+ Version: 0.10.1rc518
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
@@ -114,7 +114,7 @@ reconcile/terraform_repo.py,sha256=c0GZFuY3rCm6VHjHqYbsgOHrEkRWKF_1LrMThsn2XDw,1
114
114
  reconcile/terraform_resources.py,sha256=x5Do4xBBhjJdIVRi0Gy4h-ryCCZ6kU7bT_iB0_mGing,17105
115
115
  reconcile/terraform_tgw_attachments.py,sha256=_g7QSHM03YZzTU7O189S4HYtUn7WmwOBq67G4AieU24,15298
116
116
  reconcile/terraform_users.py,sha256=kXRUxCUchKCP2dbXXOzctynqMii4oyCP6bYZHQTrlTg,10202
117
- reconcile/terraform_vpc_peerings.py,sha256=UoxjkOw_w5esHP2IeIsphxYPuhdvbDAfY97ubfnEH0g,25029
117
+ reconcile/terraform_vpc_peerings.py,sha256=rnDH1u93OyzrBM8Hib0HwSnlxZtx4ScRQaZAcn3mx-k,25402
118
118
  reconcile/vault_replication.py,sha256=b23ZfsQwS470GMvPPv1E6TU8MLBg3HX31_9IvMzE1tk,17280
119
119
  reconcile/vpc_peerings_validator.py,sha256=Kv22HJVlTW9l9GB2eXwjPWqdDbr_VuvQBNPttox6s5o,7177
120
120
  reconcile/aus/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -375,7 +375,7 @@ reconcile/templates/jira-checkpoint-missinginfo.j2,sha256=c_Vvg-lEENsB3tgxm9B6Y9
375
375
  reconcile/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
376
376
  reconcile/test/conftest.py,sha256=rQousYrxUz-EwAIbsYO6bIwR1B4CrOz9y_zaUVo2lfI,4466
377
377
  reconcile/test/fixtures.py,sha256=9SDWAUlSd1rCx7z3GhULHcpr-I6FyCsXxaFAZIqYQsQ,591
378
- reconcile/test/test_acs_policies.py,sha256=52pZXzsLZXsvWoFW7IgP1nGjQw9a2Pd3axjfRHWUUfc,15083
378
+ reconcile/test/test_acs_policies.py,sha256=2hioxQ1AlbtW-jerw9YiQ8aIb0YjFpzDFs1j6pvn-Nc,15133
379
379
  reconcile/test/test_acs_rbac.py,sha256=lvNd8GY0-GHzcOdOn13QWdrqbBXXKzNT7EEDHNH7cjM,28272
380
380
  reconcile/test/test_aggregated_list.py,sha256=iiWitQuNYC58aimWaiBoE4NROHjr1NCgQ91MnHEG_Ro,6412
381
381
  reconcile/test/test_amtool.py,sha256=vxRhGieeydMBOb9UI2ziMHjJa8puMeGNsUhGhy-yMnk,1032
@@ -444,7 +444,7 @@ reconcile/test/test_terraform_resources.py,sha256=1ny_QSFuRjV9jxZY8EeT4NVJ5dMv7c
444
444
  reconcile/test/test_terraform_tgw_attachments.py,sha256=cAq6exc-K-jtLla1CZUZQzVnBkyDnIlL7jybnddhLKc,36861
445
445
  reconcile/test/test_terraform_users.py,sha256=Xn4y6EcxnNQb6XcPoOhz_Ikxmh9Nrsu88OM1scN9hzY,5434
446
446
  reconcile/test/test_terraform_vpc_peerings.py,sha256=ubcsKh0TrUIwuI1-W3ETIgzsFvzAyeoFmEJFC-IK6JY,20538
447
- reconcile/test/test_terraform_vpc_peerings_build_desired_state.py,sha256=Pyw8Jbp8lX5Tsk1yWZ0-4NJmwxqdwK1NnVYk6peLIQc,47440
447
+ reconcile/test/test_terraform_vpc_peerings_build_desired_state.py,sha256=DAfpb12I0PlqnuVUHK2vh4LH4d1OylT3H2GE_3TGZZI,47852
448
448
  reconcile/test/test_three_way_diff_strategy.py,sha256=2fjEqE2w4pIzKq18PRcADTSe01aGwsZfMGloU8xfNaE,3346
449
449
  reconcile/test/test_unleash.py,sha256=c1s_FRAZrAzzd3FbZrzHYjJzHELhoxPHBZnEzqsfMQg,6416
450
450
  reconcile/test/test_vault_replication.py,sha256=wlc4jm9f8P641UvvxIFFFc5_unJysNkOVrKJscjhQr0,16867
@@ -590,7 +590,7 @@ reconcile/utils/vaultsecretref.py,sha256=3Ed2uBy36TzSvL0B-l4FoWQqB2SbBKDKEuUPIO6
590
590
  reconcile/utils/vcs.py,sha256=o1r0n_IrU2El75CED_6sjR2GZGM-exuWsj5F7jONaMU,6779
591
591
  reconcile/utils/acs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
592
592
  reconcile/utils/acs/base.py,sha256=Qih-xZ3RBJZEE291iHHlv7lUY6ShcAvSj1PA3_aTTnM,2276
593
- reconcile/utils/acs/policies.py,sha256=ucmvWhcu9I5uumOyFIr5POb64TqHNNJ8LutZWo2Jw7k,5099
593
+ reconcile/utils/acs/policies.py,sha256=utDmFKb6pbBN3W6JFxRrlr9yFwL3aQurGDywaFGM6w0,5196
594
594
  reconcile/utils/acs/rbac.py,sha256=ugsLM9Pb7FbUbdq85E3VzXGMaB9ZovXob7tdWCxwqZ8,8808
595
595
  reconcile/utils/cloud_resource_best_practice/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
596
596
  reconcile/utils/cloud_resource_best_practice/aws_rds.py,sha256=EvE6XKLsrZ531MJptKqPht2lOETrOjySTHXk6CzMgo0,2279
@@ -668,8 +668,8 @@ tools/test/test_app_interface_metrics_exporter.py,sha256=SX7qL3D1SIRKFo95FoQztvf
668
668
  tools/test/test_qontract_cli.py,sha256=d18KrdhtUGqoC7_kWZU128U0-VJEj-0rjFkLVufcI6I,2755
669
669
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
670
670
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
671
- qontract_reconcile-0.10.1rc516.dist-info/METADATA,sha256=9Z_YOmiM3ChqwRNLidMapCItgS0rD5W6yekyzJehljo,2349
672
- qontract_reconcile-0.10.1rc516.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
673
- qontract_reconcile-0.10.1rc516.dist-info/entry_points.txt,sha256=rTjAv28I_CHLM8ID3OPqMI_suoQ9s7tFbim4aYjn9kk,376
674
- qontract_reconcile-0.10.1rc516.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
675
- qontract_reconcile-0.10.1rc516.dist-info/RECORD,,
671
+ qontract_reconcile-0.10.1rc518.dist-info/METADATA,sha256=ZHIKdYpB_uP2Zw1T7VGzb55Zemh_NrefQFPc8opTj4Q,2349
672
+ qontract_reconcile-0.10.1rc518.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
673
+ qontract_reconcile-0.10.1rc518.dist-info/entry_points.txt,sha256=rTjAv28I_CHLM8ID3OPqMI_suoQ9s7tFbim4aYjn9kk,376
674
+ qontract_reconcile-0.10.1rc518.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
675
+ qontract_reconcile-0.10.1rc518.dist-info/RECORD,,
@@ -210,9 +210,11 @@ def build_desired_state_single_cluster(
210
210
  )
211
211
  )
212
212
  if requester_vpc_id is None:
213
- raise BadTerraformPeeringState(
214
- f"[{cluster_name}] could not find VPC ID for cluster"
213
+ logging.warning(
214
+ f"[{cluster_name}] could not find VPC ID for cluster. "
215
+ f"Skipping {peer_connection_provider} connection {peer_connection['name']}"
215
216
  )
217
+ continue
216
218
 
217
219
  requester = {
218
220
  "cidr_block": cluster_info["network"]["vpc"],
@@ -234,9 +236,11 @@ def build_desired_state_single_cluster(
234
236
  hcp_vpc_endpoint_sg=_private_hosted_control_plane(peer_cluster),
235
237
  )
236
238
  if accepter_vpc_id is None:
237
- raise BadTerraformPeeringState(
238
- f"[{peer_cluster_name}] could not find VPC ID for cluster"
239
+ logging.warning(
240
+ f"[{peer_cluster_name}] could not find VPC ID for cluster. "
241
+ f"Skipping {peer_info['provider']} connection {peer_info['name']}"
239
242
  )
243
+ continue
240
244
 
241
245
  requester["peer_owner_id"] = acc_aws["uid"]
242
246
  if acc_aws.get("assume_role"):
@@ -340,10 +344,11 @@ def build_desired_state_vpc_mesh_single_cluster(
340
344
  )
341
345
 
342
346
  if requester_vpc_id is None:
343
- raise BadTerraformPeeringState(
344
- f"{cluster} could not find VPC ID for cluster and "
345
- f"peer account {account}"
347
+ logging.warning(
348
+ f"[{cluster}] could not find VPC ID for cluster and peer account {account}. "
349
+ f"Skipping {peer_connection_provider} connection {peer_connection['name']}"
346
350
  )
351
+ continue
347
352
 
348
353
  requester["vpc_id"] = requester_vpc_id
349
354
  requester["route_table_ids"] = requester_route_table_ids
@@ -478,9 +483,11 @@ def build_desired_state_vpc_single_cluster(
478
483
  )
479
484
 
480
485
  if requester_vpc_id is None:
481
- raise BadTerraformPeeringState(
482
- f"[{cluster}] could not find VPC ID for cluster"
486
+ logging.warning(
487
+ f"[{cluster}] could not find VPC ID for cluster. "
488
+ f"Skipping {peer_connection_provider} connection {peer_connection['name']}"
483
489
  )
490
+ continue
484
491
 
485
492
  requester["vpc_id"] = requester_vpc_id
486
493
  requester["route_table_ids"] = requester_route_table_ids
@@ -129,7 +129,7 @@ def api_response_policies_summary() -> Any:
129
129
  "severity": "HIGH_SEVERITY",
130
130
  "notifiers": [JIRA_NOTIFIER_ID],
131
131
  "disabled": False,
132
- "lifecycleStages": ["BUILD"],
132
+ "lifecycleStages": ["BUILD", "DEPLOY"],
133
133
  "lastUpdated": None,
134
134
  "eventSource": "NOT_APPLICABLE",
135
135
  "isDefault": False,
@@ -140,7 +140,7 @@ def api_response_policies_summary() -> Any:
140
140
  "description": "image security policy violations of critical severity within app-sre namespaces",
141
141
  "severity": "CRITICAL_SEVERITY",
142
142
  "disabled": False,
143
- "lifecycleStages": ["BUILD"],
143
+ "lifecycleStages": ["BUILD", "DEPLOY"],
144
144
  "notifiers": [],
145
145
  "lastUpdated": None,
146
146
  "eventSource": "NOT_APPLICABLE",
@@ -152,7 +152,7 @@ def api_response_policies_summary() -> Any:
152
152
  "description": "default policy that should not be included in reconcile",
153
153
  "severity": "CRITICAL_SEVERITY",
154
154
  "disabled": False,
155
- "lifecycleStages": ["BUILD"],
155
+ "lifecycleStages": ["BUILD", "DEPLOY"],
156
156
  "notifiers": [],
157
157
  "lastUpdated": None,
158
158
  "eventSource": "NOT_APPLICABLE",
@@ -171,7 +171,7 @@ def api_response_policies_specific() -> list[Any]:
171
171
  "description": "CVEs within app-sre clusters with CVSS score gte to 7 and fixable",
172
172
  "disabled": False,
173
173
  "categories": ["Vulnerability Management"],
174
- "lifecycleStages": ["BUILD"],
174
+ "lifecycleStages": ["BUILD", "DEPLOY"],
175
175
  "eventSource": "NOT_APPLICABLE",
176
176
  "exclusions": [],
177
177
  "scope": [
@@ -211,7 +211,7 @@ def api_response_policies_specific() -> list[Any]:
211
211
  "description": "image security policy violations of critical severity within app-sre namespaces",
212
212
  "disabled": False,
213
213
  "categories": ["Vulnerability Management", "DevOps Best Practices"],
214
- "lifecycleStages": ["BUILD"],
214
+ "lifecycleStages": ["BUILD", "DEPLOY"],
215
215
  "eventSource": "NOT_APPLICABLE",
216
216
  "exclusions": [],
217
217
  "scope": [
@@ -466,11 +466,10 @@ def test_c2c_no_vpc_in_aws(mocker):
466
466
 
467
467
  awsapi = MockAWSAPI()
468
468
 
469
- with pytest.raises(sut.BadTerraformPeeringState) as ex:
470
- sut.build_desired_state_single_cluster(
471
- requester_cluster, ocm, awsapi, account_filter=None
472
- )
473
- assert str(ex.value).endswith("could not find VPC ID for cluster")
469
+ desired_state = sut.build_desired_state_single_cluster(
470
+ requester_cluster, ocm, awsapi, account_filter=None
471
+ )
472
+ assert desired_state == []
474
473
 
475
474
 
476
475
  def test_c2c_no_peer_account(mocker):
@@ -936,10 +935,10 @@ class TestBuildDesiredStateVpcMeshSingleCluster(testslide.TestCase):
936
935
  None,
937
936
  )).and_assert_called_once()
938
937
 
939
- with self.assertRaises(sut.BadTerraformPeeringState):
940
- sut.build_desired_state_vpc_mesh_single_cluster(
941
- self.cluster, self.ocm, self.awsapi, None
942
- )
938
+ desired_state = sut.build_desired_state_vpc_mesh_single_cluster(
939
+ self.cluster, self.ocm, self.awsapi, None
940
+ )
941
+ assert desired_state == []
943
942
 
944
943
 
945
944
  class TestBuildDesiredStateVpc(testslide.TestCase):
@@ -1341,7 +1340,22 @@ class TestBuildDesiredStateVpcSingleCluster(testslide.TestCase):
1341
1340
  self.ocm, "get_aws_infrastructure_access_terraform_assume_role"
1342
1341
  ).to_return_value("a:role:that:you:will:like").and_assert_called_once()
1343
1342
 
1344
- with self.assertRaises(sut.BadTerraformPeeringState):
1343
+ desired_state = sut.build_desired_state_vpc_single_cluster(
1344
+ self.cluster, self.ocm, self.awsapi, None
1345
+ )
1346
+ assert desired_state == []
1347
+
1348
+ def test_aws_exception(self):
1349
+ exc_txt = "AWS Problem!"
1350
+ self.mock_callable(self.awsapi, "get_cluster_vpc_details").to_raise(
1351
+ Exception(exc_txt)
1352
+ )
1353
+
1354
+ self.mock_callable(
1355
+ self.ocm, "get_aws_infrastructure_access_terraform_assume_role"
1356
+ ).to_return_value("a:role:that:you:will:like").and_assert_called_once()
1357
+
1358
+ with pytest.raises(Exception, match=exc_txt):
1345
1359
  sut.build_desired_state_vpc_single_cluster(
1346
1360
  self.cluster, self.ocm, self.awsapi, None
1347
1361
  )
@@ -116,8 +116,10 @@ class AcsPolicyApi(AcsBaseApi):
116
116
  {"cluster": s.cluster, "namespace": s.namespace} for s in desired.scope
117
117
  ],
118
118
  "lifecycleStages": [
119
- "BUILD"
120
- ], # all currently supported policy criteria are classified as 'build' stage
119
+ "BUILD",
120
+ "DEPLOY",
121
+ ], # all currently supported policy criteria are classified as 'build' or 'deploy'
122
+ # and created policies are evaluated at both stages
121
123
  "policySections": [
122
124
  {
123
125
  "sectionName": "primary",