qontract-reconcile 0.10.1rc122__py3-none-any.whl → 0.10.1rc124__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.1rc122.dist-info → qontract_reconcile-0.10.1rc124.dist-info}/METADATA +1 -1
- {qontract_reconcile-0.10.1rc122.dist-info → qontract_reconcile-0.10.1rc124.dist-info}/RECORD +10 -10
- reconcile/terraform_tgw_attachments.py +6 -0
- reconcile/test/test_terraform_tgw_attachments.py +60 -8
- reconcile/test/test_utils_aws_helper.py +2 -2
- reconcile/utils/aws_helper.py +2 -2
- reconcile/utils/terrascript_aws_client.py +3 -2
- {qontract_reconcile-0.10.1rc122.dist-info → qontract_reconcile-0.10.1rc124.dist-info}/WHEEL +0 -0
- {qontract_reconcile-0.10.1rc122.dist-info → qontract_reconcile-0.10.1rc124.dist-info}/entry_points.txt +0 -0
- {qontract_reconcile-0.10.1rc122.dist-info → qontract_reconcile-0.10.1rc124.dist-info}/top_level.txt +0 -0
{qontract_reconcile-0.10.1rc122.dist-info → qontract_reconcile-0.10.1rc124.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: qontract-reconcile
|
3
|
-
Version: 0.10.
|
3
|
+
Version: 0.10.1rc124
|
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
|
{qontract_reconcile-0.10.1rc122.dist-info → qontract_reconcile-0.10.1rc124.dist-info}/RECORD
RENAMED
@@ -105,7 +105,7 @@ reconcile/terraform_cloudflare_resources.py,sha256=BQg12mHm1iaxf086FFPZutPbWKUMa
|
|
105
105
|
reconcile/terraform_cloudflare_users.py,sha256=Bv0f9lOO_wTM7st8iltb8FR8gu4KpKu3qavMzAYcoMc,13965
|
106
106
|
reconcile/terraform_repo.py,sha256=0TNwHyc3P4hlkSQdQ-ST6QLmAiG6Rb9r1G5tzJu-tPE,11816
|
107
107
|
reconcile/terraform_resources.py,sha256=gQ-LT0TGwf9OR4RF5EWDmNHUnKWnbhrIMtyIdUgP4D4,16782
|
108
|
-
reconcile/terraform_tgw_attachments.py,sha256=
|
108
|
+
reconcile/terraform_tgw_attachments.py,sha256=6PVhBYeIvNnz2PwBdPF0I222_83EzOWX6VKJnqz7UPo,13915
|
109
109
|
reconcile/terraform_users.py,sha256=AzDvEQCdLpsXoS3nLbIQRraQvJHa8JmL40lZFv8YXMk,9321
|
110
110
|
reconcile/terraform_vpc_peerings.py,sha256=fI76pTN6LjoPPSBxjyOhKbhzDfsJfg2ymXQTrk0J6uM,21422
|
111
111
|
reconcile/vault_replication.py,sha256=xobxnsOfUcwvdQ-RZ7JH_sZCDh8rpEY7MJ36nkvfFqE,17262
|
@@ -361,13 +361,13 @@ reconcile/test/test_terraform_cloudflare_resources.py,sha256=cWNE2UIhz19rLSWdpJG
|
|
361
361
|
reconcile/test/test_terraform_cloudflare_users.py,sha256=8iAFjz-zbUW4xLS10Lk1XvYSk4B_W__YT9rgrBuigcQ,27482
|
362
362
|
reconcile/test/test_terraform_repo.py,sha256=RrRzlc9ThVYbEJq4k99sSRN2xGZP0zIqzGkaxTwgcm8,7014
|
363
363
|
reconcile/test/test_terraform_resources.py,sha256=dEpJwaTzE_FzkRjCozDtGzE4egBrb-VrwSoWr2Benv4,7955
|
364
|
-
reconcile/test/test_terraform_tgw_attachments.py,sha256=
|
364
|
+
reconcile/test/test_terraform_tgw_attachments.py,sha256=GgDA8hlQ1ujh5g8PtzbYQbJGpNScEgZ8PvDbMFbn68g,35493
|
365
365
|
reconcile/test/test_terraform_users.py,sha256=Yt4iN5FMtn7cfVlVqBJ1MMH94Z0DGchyByhpfNUJFxM,1570
|
366
366
|
reconcile/test/test_terraform_vpc_peerings.py,sha256=fRDgoyM9wyOdzIwjCno-vzhIA4vy0dRNnE7j3ytWyEg,18948
|
367
367
|
reconcile/test/test_terraform_vpc_peerings_build_desired_state.py,sha256=43EIGnrm5xAdtuSL6tKDh-nepk4WOKkONMNUOU1BN_Y,37236
|
368
368
|
reconcile/test/test_unleash.py,sha256=a4jT0Hzlje6AEkwhMmeDUkzo6rsD_WGSZicwFg47mmM,4192
|
369
369
|
reconcile/test/test_utils_aws_api.py,sha256=GwUByT-ZXjVHlHBzoomyWjngNVp5uYA3-UcgDjzxWko,8997
|
370
|
-
reconcile/test/test_utils_aws_helper.py,sha256=
|
370
|
+
reconcile/test/test_utils_aws_helper.py,sha256=kqmj1QPOJjjHGlWvaKWZUkEXo0K0qVeZBW3slwBUtVY,2297
|
371
371
|
reconcile/test/test_utils_aws_rds.py,sha256=gr2S_s5YBz-jGlcZMbvU9DSJ2co0CAJ3K7opxdAdf7w,1062
|
372
372
|
reconcile/test/test_utils_cluster_version_data.py,sha256=ua2zivisH5PsZtZxjuQ3QXFVzF2SRUIVbxHdbmn-clc,6019
|
373
373
|
reconcile/test/test_utils_data_structures.py,sha256=ZDa-15vxe7v6TG4pLDF_R9rGFbBDEYG9rUDDf2Dyjjk,342
|
@@ -467,7 +467,7 @@ reconcile/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
467
467
|
reconcile/utils/aggregated_list.py,sha256=svF8qu2U8iAIUPrGbKiMzuzz2RffI0GOJzWDxBDgSIQ,3332
|
468
468
|
reconcile/utils/amtool.py,sha256=9p9FYkv4RYPnkDICuN1apcqJyZ5n8WbHF6vC0FIiQIw,2166
|
469
469
|
reconcile/utils/aws_api.py,sha256=bbNisd1Y7mjqaKhDdr5ocSjERhItHNs8aAvCYENMSZ4,59770
|
470
|
-
reconcile/utils/aws_helper.py,sha256=
|
470
|
+
reconcile/utils/aws_helper.py,sha256=E8NHkStoHRmvLVjRll2f5kGtU3i3f7ekp5V6nrn7B_M,1691
|
471
471
|
reconcile/utils/binary.py,sha256=3IBnwjKakHM367skPPvG6yVSQYjKt5muQlFNdoa63DU,2352
|
472
472
|
reconcile/utils/cluster_version_data.py,sha256=HPBPDosEdoGrMgBQMJvsicL5oPxVjqKHlhpFokUlsio,6680
|
473
473
|
reconcile/utils/config.py,sha256=ZhYy3ZKI0vB_QvrYr14JPxu0EAVM5gS8cKRbM8ECRSE,992
|
@@ -531,7 +531,7 @@ reconcile/utils/state.py,sha256=_SmE7fOEReET3iy9jRQ1pyuaJebg5962Zs9Iy1dzTJk,9530
|
|
531
531
|
reconcile/utils/structs.py,sha256=LcbLEg8WxfRqM6nW7NhcWN0YeqF7SQzxOgntmLs1SgY,352
|
532
532
|
reconcile/utils/template.py,sha256=wTvRU4AnAV_o042tD4Mwls2dwWMuk7MKnde3MaCjaYg,331
|
533
533
|
reconcile/utils/terraform_client.py,sha256=fR5HscDYZblw27tb_lqhJM-CSshcPDyfNORdYJMzNOE,30509
|
534
|
-
reconcile/utils/terrascript_aws_client.py,sha256=
|
534
|
+
reconcile/utils/terrascript_aws_client.py,sha256=1nF_oiKJHiQp0U_GbWXT8nEg6Nqp4CqYchN7ESjAqGI,261977
|
535
535
|
reconcile/utils/throughput.py,sha256=iP4UWAe2LVhDo69mPPmgo9nQ7RxHD6_GS8MZe-aSiuM,344
|
536
536
|
reconcile/utils/unleash.py,sha256=QGANGA8BHG7oC_bt39c2M7uRa2ycjzmahN8_m7Zovos,3094
|
537
537
|
reconcile/utils/vault.py,sha256=CnhNu0pZfqS14kD1dQmBldITvTcSJHaHfk-KPNNDC7k,14471
|
@@ -597,8 +597,8 @@ tools/sre_checkpoints/util.py,sha256=zEDbGr18ZeHNQwW8pUsr2JRjuXIPz--WAGJxZo9sv_Y
|
|
597
597
|
tools/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
598
598
|
tools/test/test_qontract_cli.py,sha256=awwTHEc2DWlykuqGIYM0WOBoSL0KRnOraCLk3C7izis,1401
|
599
599
|
tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
|
600
|
-
qontract_reconcile-0.10.
|
601
|
-
qontract_reconcile-0.10.
|
602
|
-
qontract_reconcile-0.10.
|
603
|
-
qontract_reconcile-0.10.
|
604
|
-
qontract_reconcile-0.10.
|
600
|
+
qontract_reconcile-0.10.1rc124.dist-info/METADATA,sha256=8vXlksnwd7GI4vBp37d_iwA7IqQwMCaXlMTKaSMo_eo,2291
|
601
|
+
qontract_reconcile-0.10.1rc124.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
602
|
+
qontract_reconcile-0.10.1rc124.dist-info/entry_points.txt,sha256=Af70EWPJxsTiCNF6gA-pWdw1A0Heqn-PZF-oBc5NmiU,302
|
603
|
+
qontract_reconcile-0.10.1rc124.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
|
604
|
+
qontract_reconcile-0.10.1rc124.dist-info/RECORD,,
|
@@ -369,6 +369,12 @@ def run(
|
|
369
369
|
desired_state_data_source = _fetch_desired_state_data_source(account_name)
|
370
370
|
accounts = [a.dict(by_alias=True) for a in desired_state_data_source.accounts]
|
371
371
|
|
372
|
+
if not accounts:
|
373
|
+
logging.warning(
|
374
|
+
f"No participating AWS accounts found, consider disabling this integration, account name: {account_name}"
|
375
|
+
)
|
376
|
+
return
|
377
|
+
|
372
378
|
vault_settings = get_app_interface_vault_settings()
|
373
379
|
secret_reader = create_secret_reader(vault_settings.vault)
|
374
380
|
aws_api = AWSApi(1, accounts, secret_reader=secret_reader, init_users=False)
|
@@ -561,6 +561,9 @@ def _setup_mocks(
|
|
561
561
|
).return_value
|
562
562
|
mocked_tf.plan.return_value = (False, False)
|
563
563
|
mocked_tf.apply.return_value = False
|
564
|
+
|
565
|
+
mocked_logging = mocker.patch("reconcile.terraform_tgw_attachments.logging")
|
566
|
+
|
564
567
|
return {
|
565
568
|
"tf": mocked_tf,
|
566
569
|
"ts": mocked_ts,
|
@@ -571,16 +574,48 @@ def _setup_mocks(
|
|
571
574
|
"ocm": mocked_ocm,
|
572
575
|
"aws_api": mocked_aws_api,
|
573
576
|
"gql_api": mocked_gql_api,
|
577
|
+
"logging": mocked_logging,
|
574
578
|
}
|
575
579
|
|
576
580
|
|
581
|
+
def test_empty_run(
|
582
|
+
mocker: MockerFixture,
|
583
|
+
app_interface_vault_settings: AppInterfaceSettingsV1,
|
584
|
+
) -> None:
|
585
|
+
mocks = _setup_mocks(
|
586
|
+
mocker,
|
587
|
+
vault_settings=app_interface_vault_settings,
|
588
|
+
)
|
589
|
+
|
590
|
+
integ.run(False, enable_deletion=False)
|
591
|
+
|
592
|
+
mocks["logging"].warning.assert_called_once_with(
|
593
|
+
"No participating AWS accounts found, consider disabling this integration, account name: None"
|
594
|
+
)
|
595
|
+
mocks["get_clusters_with_peering"].assert_called_once_with(mocks["gql_api"])
|
596
|
+
mocks["get_aws_accounts"].assert_called_once_with(mocks["gql_api"], name=None)
|
597
|
+
mocks["get_app_interface_vault_settings"].assert_not_called()
|
598
|
+
mocks["tf"].plan.assert_not_called()
|
599
|
+
mocks["tf"].apply.assert_not_called()
|
600
|
+
|
601
|
+
|
577
602
|
def test_dry_run(
|
578
603
|
mocker: MockerFixture,
|
579
604
|
app_interface_vault_settings: AppInterfaceSettingsV1,
|
605
|
+
cluster_with_tgw_connection: ClusterV1,
|
606
|
+
tgw_account: AWSAccountV1,
|
607
|
+
tgw: Mapping,
|
608
|
+
vpc_details: Mapping,
|
609
|
+
assume_role: str,
|
580
610
|
) -> None:
|
581
611
|
mocks = _setup_mocks(
|
582
612
|
mocker,
|
583
613
|
vault_settings=app_interface_vault_settings,
|
614
|
+
clusters=[cluster_with_tgw_connection],
|
615
|
+
accounts=[tgw_account],
|
616
|
+
vpc_details=vpc_details,
|
617
|
+
tgws=[tgw],
|
618
|
+
assume_role=assume_role,
|
584
619
|
)
|
585
620
|
|
586
621
|
integ.run(True, enable_deletion=False)
|
@@ -595,10 +630,20 @@ def test_dry_run(
|
|
595
630
|
def test_non_dry_run(
|
596
631
|
mocker: MockerFixture,
|
597
632
|
app_interface_vault_settings: AppInterfaceSettingsV1,
|
633
|
+
cluster_with_tgw_connection: ClusterV1,
|
634
|
+
tgw_account: AWSAccountV1,
|
635
|
+
tgw: Mapping,
|
636
|
+
vpc_details: Mapping,
|
637
|
+
assume_role: str,
|
598
638
|
) -> None:
|
599
639
|
mocks = _setup_mocks(
|
600
640
|
mocker,
|
601
641
|
vault_settings=app_interface_vault_settings,
|
642
|
+
clusters=[cluster_with_tgw_connection],
|
643
|
+
accounts=[tgw_account],
|
644
|
+
vpc_details=vpc_details,
|
645
|
+
tgws=[tgw],
|
646
|
+
assume_role=assume_role,
|
602
647
|
)
|
603
648
|
|
604
649
|
integ.run(False, enable_deletion=False)
|
@@ -734,15 +779,12 @@ def test_run_when_cluster_with_vpc_connection_only(
|
|
734
779
|
|
735
780
|
integ.run(True)
|
736
781
|
|
737
|
-
mocks["aws_api"].
|
738
|
-
1,
|
739
|
-
[],
|
740
|
-
secret_reader=mocks["secret_reader"],
|
741
|
-
init_users=False,
|
742
|
-
)
|
782
|
+
mocks["aws_api"].assert_not_called()
|
743
783
|
mocks["ocm"].assert_not_called()
|
744
|
-
mocks["ts"].populate_additional_providers.
|
745
|
-
mocks["ts"].populate_tgw_attachments.
|
784
|
+
mocks["ts"].populate_additional_providers.assert_not_called()
|
785
|
+
mocks["ts"].populate_tgw_attachments.assert_not_called()
|
786
|
+
mocks["tf"].plan.assert_not_called()
|
787
|
+
mocks["tf"].apply.assert_not_called()
|
746
788
|
|
747
789
|
|
748
790
|
def test_run_with_multiple_clusters(
|
@@ -921,6 +963,7 @@ def test_duplicate_tgw_connection_names(
|
|
921
963
|
mocker: MockerFixture,
|
922
964
|
app_interface_vault_settings: AppInterfaceSettingsV1,
|
923
965
|
cluster_with_duplicate_tgw_connections: ClusterV1,
|
966
|
+
tgw_account: AWSAccountV1,
|
924
967
|
tgw: AWSAccountV1,
|
925
968
|
vpc_details: Mapping,
|
926
969
|
assume_role: str,
|
@@ -929,6 +972,7 @@ def test_duplicate_tgw_connection_names(
|
|
929
972
|
mocker,
|
930
973
|
vault_settings=app_interface_vault_settings,
|
931
974
|
clusters=[cluster_with_duplicate_tgw_connections],
|
975
|
+
accounts=[tgw_account],
|
932
976
|
vpc_details=vpc_details,
|
933
977
|
tgws=[tgw],
|
934
978
|
assume_role=assume_role,
|
@@ -944,6 +988,7 @@ def test_missing_vpc_id(
|
|
944
988
|
mocker: MockerFixture,
|
945
989
|
app_interface_vault_settings: AppInterfaceSettingsV1,
|
946
990
|
cluster_with_tgw_connection: ClusterV1,
|
991
|
+
tgw_account: AWSAccountV1,
|
947
992
|
tgw: Mapping,
|
948
993
|
vpc_details: Mapping,
|
949
994
|
assume_role: str,
|
@@ -952,6 +997,7 @@ def test_missing_vpc_id(
|
|
952
997
|
mocker,
|
953
998
|
vault_settings=app_interface_vault_settings,
|
954
999
|
clusters=[cluster_with_tgw_connection],
|
1000
|
+
accounts=[tgw_account],
|
955
1001
|
vpc_details=None,
|
956
1002
|
tgws=[tgw],
|
957
1003
|
assume_role=assume_role,
|
@@ -967,6 +1013,7 @@ def test_error_in_tf_plan(
|
|
967
1013
|
mocker: MockerFixture,
|
968
1014
|
app_interface_vault_settings: AppInterfaceSettingsV1,
|
969
1015
|
cluster_with_tgw_connection: ClusterV1,
|
1016
|
+
tgw_account: AWSAccountV1,
|
970
1017
|
account_tgw_connection: ClusterPeeringConnectionAccountTGWV1,
|
971
1018
|
tgw: Mapping,
|
972
1019
|
vpc_details: Mapping,
|
@@ -976,6 +1023,7 @@ def test_error_in_tf_plan(
|
|
976
1023
|
mocker,
|
977
1024
|
vault_settings=app_interface_vault_settings,
|
978
1025
|
clusters=[cluster_with_tgw_connection],
|
1026
|
+
accounts=[tgw_account],
|
979
1027
|
vpc_details=vpc_details,
|
980
1028
|
tgws=[tgw],
|
981
1029
|
assume_role=assume_role,
|
@@ -992,6 +1040,7 @@ def test_disabled_deletions_detected_in_tf_plan(
|
|
992
1040
|
mocker: MockerFixture,
|
993
1041
|
app_interface_vault_settings: AppInterfaceSettingsV1,
|
994
1042
|
cluster_with_tgw_connection: ClusterV1,
|
1043
|
+
tgw_account: AWSAccountV1,
|
995
1044
|
account_tgw_connection: ClusterPeeringConnectionAccountTGWV1,
|
996
1045
|
tgw: Mapping,
|
997
1046
|
vpc_details: Mapping,
|
@@ -1001,6 +1050,7 @@ def test_disabled_deletions_detected_in_tf_plan(
|
|
1001
1050
|
mocker,
|
1002
1051
|
vault_settings=app_interface_vault_settings,
|
1003
1052
|
clusters=[cluster_with_tgw_connection],
|
1053
|
+
accounts=[tgw_account],
|
1004
1054
|
vpc_details=vpc_details,
|
1005
1055
|
tgws=[tgw],
|
1006
1056
|
assume_role=assume_role,
|
@@ -1018,6 +1068,7 @@ def test_error_in_terraform_apply(
|
|
1018
1068
|
app_interface_vault_settings: AppInterfaceSettingsV1,
|
1019
1069
|
cluster_with_tgw_connection: ClusterV1,
|
1020
1070
|
account_tgw_connection: ClusterPeeringConnectionAccountTGWV1,
|
1071
|
+
tgw_account: AWSAccountV1,
|
1021
1072
|
tgw: Mapping,
|
1022
1073
|
vpc_details: Mapping,
|
1023
1074
|
assume_role: str,
|
@@ -1026,6 +1077,7 @@ def test_error_in_terraform_apply(
|
|
1026
1077
|
mocker,
|
1027
1078
|
vault_settings=app_interface_vault_settings,
|
1028
1079
|
clusters=[cluster_with_tgw_connection],
|
1080
|
+
accounts=[tgw_account],
|
1029
1081
|
vpc_details=vpc_details,
|
1030
1082
|
tgws=[tgw],
|
1031
1083
|
assume_role=assume_role,
|
@@ -4,10 +4,10 @@ import reconcile.utils.aws_helper as awsh
|
|
4
4
|
from reconcile.utils.secret_reader import SecretReader
|
5
5
|
|
6
6
|
|
7
|
-
def
|
7
|
+
def test_get_id_from_arn():
|
8
8
|
user_id = "id"
|
9
9
|
arn = f"arn:aws:iam::12345:user/{user_id}"
|
10
|
-
result = awsh.
|
10
|
+
result = awsh.get_id_from_arn(arn)
|
11
11
|
assert result == user_id
|
12
12
|
|
13
13
|
|
reconcile/utils/aws_helper.py
CHANGED
@@ -854,7 +854,8 @@ class TerrascriptClient: # pylint: disable=too-many-public-methods
|
|
854
854
|
@staticmethod
|
855
855
|
def get_alias_name_from_assume_role(assume_role):
|
856
856
|
uid = awsh.get_account_uid_from_arn(assume_role)
|
857
|
-
|
857
|
+
role_name = awsh.get_id_from_arn(assume_role)
|
858
|
+
return f"account-{uid}-{role_name}"
|
858
859
|
|
859
860
|
def populate_additional_providers(self, accounts):
|
860
861
|
for account in accounts:
|
@@ -2315,7 +2316,7 @@ class TerrascriptClient: # pylint: disable=too-many-public-methods
|
|
2315
2316
|
role_grants = ocm.get_aws_infrastructure_access_role_grants(cluster)
|
2316
2317
|
for user_arn, _, state, switch_role_link in role_grants:
|
2317
2318
|
# find correct user by identifier
|
2318
|
-
user_id = awsh.
|
2319
|
+
user_id = awsh.get_id_from_arn(user_arn)
|
2319
2320
|
# output will only be added once
|
2320
2321
|
# terraform-resources created the user
|
2321
2322
|
# and ocm-aws-infrastructure-access granted it the role
|
File without changes
|
File without changes
|
{qontract_reconcile-0.10.1rc122.dist-info → qontract_reconcile-0.10.1rc124.dist-info}/top_level.txt
RENAMED
File without changes
|