qontract-reconcile 0.10.1rc932__py3-none-any.whl → 0.10.1rc933__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.1rc932.dist-info → qontract_reconcile-0.10.1rc933.dist-info}/METADATA +1 -1
- {qontract_reconcile-0.10.1rc932.dist-info → qontract_reconcile-0.10.1rc933.dist-info}/RECORD +8 -8
- reconcile/test/test_saasherder.py +4 -4
- reconcile/utils/saasherder/models.py +13 -0
- reconcile/utils/saasherder/saasherder.py +27 -54
- {qontract_reconcile-0.10.1rc932.dist-info → qontract_reconcile-0.10.1rc933.dist-info}/WHEEL +0 -0
- {qontract_reconcile-0.10.1rc932.dist-info → qontract_reconcile-0.10.1rc933.dist-info}/entry_points.txt +0 -0
- {qontract_reconcile-0.10.1rc932.dist-info → qontract_reconcile-0.10.1rc933.dist-info}/top_level.txt +0 -0
{qontract_reconcile-0.10.1rc932.dist-info → qontract_reconcile-0.10.1rc933.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.1rc933
|
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.1rc932.dist-info → qontract_reconcile-0.10.1rc933.dist-info}/RECORD
RENAMED
@@ -537,7 +537,7 @@ reconcile/test/test_quay_repos.py,sha256=TdkcRF_a8PLp01Kti9eZZN-vGup2yPBT4Iba3k0
|
|
537
537
|
reconcile/test/test_queries.py,sha256=SpH3RmNpBjEr_ne3VjAMCgKK8RE1z1zo7bypkT5uoO4,1946
|
538
538
|
reconcile/test/test_repo_owners.py,sha256=uRYMLbMmh-9usF0TerabZTZV-Z1CS4I6ybT-LQqCLe8,1423
|
539
539
|
reconcile/test/test_requests_sender.py,sha256=7fd9C2kEFS0-CYtlsif66N1kO9c44pzuBPAJKR9igqU,5385
|
540
|
-
reconcile/test/test_saasherder.py,sha256=
|
540
|
+
reconcile/test/test_saasherder.py,sha256=VOVSltKFYXuNFSZLsACn8_ATsZruX1g0UokJg36TkTM,57102
|
541
541
|
reconcile/test/test_saasherder_allowed_secret_paths.py,sha256=5NHQwNJO66at6HiyMZ5sVRTQDwxdvlOQo0KmkBWCw5Q,4853
|
542
542
|
reconcile/test/test_secret_reader.py,sha256=kz7nzcPjvA08cytnvcA_PMA98AEyqJWsESkYeRn5xCk,4994
|
543
543
|
reconcile/test/test_slack_base.py,sha256=pTUGvJ2S2wF3PhJyGWmiNXG52QtXKy2cbu-G8Ymrv6I,5019
|
@@ -792,8 +792,8 @@ reconcile/utils/runtime/runner.py,sha256=PBfE_M4hTZKtyubg29AkMWlLi2KKyA74yItREtT
|
|
792
792
|
reconcile/utils/runtime/sharding.py,sha256=r0ieUtNed7NvknSw6qQrCkKpVXE1shuHGnfFcnpA_k4,16142
|
793
793
|
reconcile/utils/saasherder/__init__.py,sha256=J3MBZBFa5YmhqYm08QsjBXz8mFcVOCiOCkyIcw41t7E,343
|
794
794
|
reconcile/utils/saasherder/interfaces.py,sha256=C2wrw34OXypshVocAsPrVZsSHptgw4g9u7Haa2wulZQ,9087
|
795
|
-
reconcile/utils/saasherder/models.py,sha256
|
796
|
-
reconcile/utils/saasherder/saasherder.py,sha256=
|
795
|
+
reconcile/utils/saasherder/models.py,sha256=z8ln03zi2a8cu716NcNUDHp8Dv1VcVbhqdWVxCl7x9A,10148
|
796
|
+
reconcile/utils/saasherder/saasherder.py,sha256=N7cDHs6lkY9Lejw2HDGPLA-onfcASIWn5Lj18IO-FO8,84413
|
797
797
|
reconcile/utils/terraform/__init__.py,sha256=zNbiyTWo35AT1sFTElL2j_AA0jJ_yWE_bfFn-nD2xik,250
|
798
798
|
reconcile/utils/terraform/config.py,sha256=5UVrd563TMcvi4ooa5JvWVDW1I3bIWg484u79evfV_8,164
|
799
799
|
reconcile/utils/terraform/config_client.py,sha256=3gUIIIEv52Vx7-VgQ2FZYfCCrfqUv_5gw_TQ3mbLcTs,4666
|
@@ -844,8 +844,8 @@ tools/test/test_qontract_cli.py,sha256=_D61RFGAN5x44CY1tYbouhlGXXABwYfxKSWSQx3Jr
|
|
844
844
|
tools/test/test_saas_promotion_state.py,sha256=dy4kkSSAQ7bC0Xp2CociETGN-2aABEfL6FU5D9Jl00Y,6056
|
845
845
|
tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
|
846
846
|
tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
|
847
|
-
qontract_reconcile-0.10.
|
848
|
-
qontract_reconcile-0.10.
|
849
|
-
qontract_reconcile-0.10.
|
850
|
-
qontract_reconcile-0.10.
|
851
|
-
qontract_reconcile-0.10.
|
847
|
+
qontract_reconcile-0.10.1rc933.dist-info/METADATA,sha256=g1Et8aAb9vUomuEd6ZdF6INhXma7-0Q5qqXBR6U8IG0,2262
|
848
|
+
qontract_reconcile-0.10.1rc933.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
849
|
+
qontract_reconcile-0.10.1rc933.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
|
850
|
+
qontract_reconcile-0.10.1rc933.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
|
851
|
+
qontract_reconcile-0.10.1rc933.dist-info/RECORD,,
|
@@ -847,11 +847,11 @@ class TestPopulateDesiredState(TestCase):
|
|
847
847
|
|
848
848
|
def fake_get_file_contents(
|
849
849
|
self, url: str, path: str, ref: str, github: Github
|
850
|
-
) -> tuple[Any, str
|
850
|
+
) -> tuple[Any, str]:
|
851
851
|
self.assertEqual("https://github.com/rhobs/configuration", url)
|
852
852
|
|
853
853
|
content = self.fxts.get(ref + (path.replace("/", "_")))
|
854
|
-
return yaml.safe_load(content),
|
854
|
+
return yaml.safe_load(content), ref
|
855
855
|
|
856
856
|
def tearDown(self) -> None:
|
857
857
|
for p in (
|
@@ -1040,7 +1040,7 @@ class TestConfigHashPromotionsValidation(TestCase):
|
|
1040
1040
|
|
1041
1041
|
self.gfc_patcher = patch.object(SaasHerder, "_get_file_contents", autospec=True)
|
1042
1042
|
gfc_mock = self.gfc_patcher.start()
|
1043
|
-
gfc_mock.return_value = (self.template, "
|
1043
|
+
gfc_mock.return_value = (self.template, "ahash")
|
1044
1044
|
|
1045
1045
|
self.deploy_current_state_fxt = self.fxt.get_anymarkup("saas_deploy.state.json")
|
1046
1046
|
|
@@ -1242,7 +1242,7 @@ class TestSoakDays(TestCase):
|
|
1242
1242
|
|
1243
1243
|
self.gfc_patcher = patch.object(SaasHerder, "_get_file_contents", autospec=True)
|
1244
1244
|
gfc_mock = self.gfc_patcher.start()
|
1245
|
-
gfc_mock.return_value = (self.template, "
|
1245
|
+
gfc_mock.return_value = (self.template, "ahash")
|
1246
1246
|
|
1247
1247
|
self.deploy_current_state_fxt = self.fxt.get_anymarkup("saas_deploy.state.json")
|
1248
1248
|
|
@@ -256,6 +256,10 @@ class TargetSpec:
|
|
256
256
|
def path(self) -> str:
|
257
257
|
return self.resource_template.path
|
258
258
|
|
259
|
+
@property
|
260
|
+
def ref(self) -> str:
|
261
|
+
return self.target.ref
|
262
|
+
|
259
263
|
@property
|
260
264
|
def provider(self) -> str:
|
261
265
|
return self.resource_template.provider or "openshift-template"
|
@@ -272,6 +276,15 @@ class TargetSpec:
|
|
272
276
|
def delete(self) -> bool:
|
273
277
|
return bool(self.target.delete)
|
274
278
|
|
279
|
+
@property
|
280
|
+
def html_url(self) -> str:
|
281
|
+
git_object = "blob" if self.provider == "openshift-template" else "tree"
|
282
|
+
return f"{self.url}/{git_object}/{self.ref}{self.path}"
|
283
|
+
|
284
|
+
@property
|
285
|
+
def error_prefix(self) -> str:
|
286
|
+
return f"[{self.saas_file_name}/{self.resource_template_name}] {self.html_url}:"
|
287
|
+
|
275
288
|
def parameters(self, adjust: bool = True) -> dict[str, Any]:
|
276
289
|
environment_parameters = self._collect_parameters(
|
277
290
|
self.target.namespace.environment, adjust=adjust
|
@@ -746,8 +746,7 @@ class SaasHerder: # pylint: disable=too-many-public-methods
|
|
746
746
|
@retry(max_attempts=20)
|
747
747
|
def _get_file_contents(
|
748
748
|
self, url: str, path: str, ref: str, github: Github
|
749
|
-
) -> tuple[Any, str
|
750
|
-
html_url = f"{url}/blob/{ref}{path}"
|
749
|
+
) -> tuple[Any, str]:
|
751
750
|
commit_sha = self._get_commit_sha(url, ref, github)
|
752
751
|
|
753
752
|
if "github" in url:
|
@@ -763,13 +762,12 @@ class SaasHerder: # pylint: disable=too-many-public-methods
|
|
763
762
|
else:
|
764
763
|
raise Exception(f"Only GitHub and GitLab are supported: {url}")
|
765
764
|
|
766
|
-
return yaml.safe_load(content),
|
765
|
+
return yaml.safe_load(content), commit_sha
|
767
766
|
|
768
767
|
@retry()
|
769
768
|
def _get_directory_contents(
|
770
769
|
self, url: str, path: str, ref: str, github: Github
|
771
|
-
) -> tuple[list[Any], str
|
772
|
-
html_url = f"{url}/tree/{ref}{path}"
|
770
|
+
) -> tuple[list[Any], str]:
|
773
771
|
commit_sha = self._get_commit_sha(url, ref, github)
|
774
772
|
resources = []
|
775
773
|
if "github" in url:
|
@@ -800,7 +798,7 @@ class SaasHerder: # pylint: disable=too-many-public-methods
|
|
800
798
|
else:
|
801
799
|
raise Exception(f"Only GitHub and GitLab are supported: {url}")
|
802
800
|
|
803
|
-
return resources,
|
801
|
+
return resources, commit_sha
|
804
802
|
|
805
803
|
@retry()
|
806
804
|
def _get_commit_sha(self, url: str, ref: str, github: Github) -> str:
|
@@ -863,31 +861,27 @@ class SaasHerder: # pylint: disable=too-many-public-methods
|
|
863
861
|
return True
|
864
862
|
return False
|
865
863
|
|
866
|
-
def _process_template(
|
867
|
-
self, spec: TargetSpec
|
868
|
-
) -> tuple[list[Any], str, Promotion | None]:
|
864
|
+
def _process_template(self, spec: TargetSpec) -> tuple[list[Any], Promotion | None]:
|
869
865
|
saas_file_name = spec.saas_file_name
|
870
866
|
resource_template_name = spec.resource_template_name
|
871
|
-
image_auth = spec.image_auth
|
872
867
|
url = spec.url
|
873
868
|
path = spec.path
|
869
|
+
ref = spec.ref
|
874
870
|
provider = spec.provider
|
875
871
|
hash_length = spec.hash_length
|
876
872
|
target = spec.target
|
877
873
|
github = spec.github
|
878
874
|
target_config_hash = spec.target_config_hash
|
875
|
+
error_prefix = spec.error_prefix
|
879
876
|
|
880
877
|
if provider == "openshift-template":
|
881
878
|
consolidated_parameters = spec.parameters()
|
882
879
|
try:
|
883
|
-
template,
|
884
|
-
url=url, path=path, ref=
|
880
|
+
template, commit_sha = self._get_file_contents(
|
881
|
+
url=url, path=path, ref=ref, github=github
|
885
882
|
)
|
886
883
|
except Exception as e:
|
887
|
-
logging.error(
|
888
|
-
f"[{url}/blob/{target.ref}{path}] "
|
889
|
-
+ f"error fetching template: {str(e)}"
|
890
|
-
)
|
884
|
+
logging.error(f"{error_prefix} error fetching template: {str(e)}")
|
891
885
|
raise
|
892
886
|
|
893
887
|
# add COMMIT_SHA only if it is unspecified
|
@@ -905,8 +899,7 @@ class SaasHerder: # pylint: disable=too-many-public-methods
|
|
905
899
|
channel = consolidated_parameters["CHANNEL"]
|
906
900
|
except KeyError:
|
907
901
|
logging.error(
|
908
|
-
f"
|
909
|
-
+ f"{html_url}: CHANNEL is required when "
|
902
|
+
f"{error_prefix} CHANNEL is required when "
|
910
903
|
+ "'use_channel_in_image_tag' is true."
|
911
904
|
)
|
912
905
|
raise
|
@@ -928,21 +921,17 @@ class SaasHerder: # pylint: disable=too-many-public-methods
|
|
928
921
|
registry_image = consolidated_parameters["REGISTRY_IMG"]
|
929
922
|
except KeyError as e:
|
930
923
|
logging.error(
|
931
|
-
f"
|
932
|
-
+ f"{html_url}: error generating REPO_DIGEST. "
|
924
|
+
f"{error_prefix} error generating REPO_DIGEST. "
|
933
925
|
+ "Is REGISTRY_IMG missing? "
|
934
926
|
+ f"{str(e)}"
|
935
927
|
)
|
936
928
|
raise
|
937
929
|
|
938
930
|
image_uri = f"{registry_image}:{image_tag}"
|
939
|
-
error_prefix = (
|
940
|
-
f"[{saas_file_name}/{resource_template_name}] {html_url}:"
|
941
|
-
)
|
942
931
|
img = self._get_image(
|
943
932
|
image=image_uri,
|
944
933
|
image_patterns=spec.image_patterns,
|
945
|
-
image_auth=image_auth,
|
934
|
+
image_auth=spec.image_auth,
|
946
935
|
error_prefix=error_prefix,
|
947
936
|
)
|
948
937
|
if not img:
|
@@ -959,20 +948,16 @@ class SaasHerder: # pylint: disable=too-many-public-methods
|
|
959
948
|
try:
|
960
949
|
resources = oc.process(template, consolidated_parameters)
|
961
950
|
except StatusCodeError as e:
|
962
|
-
logging.error(
|
963
|
-
f"[{saas_file_name}/{resource_template_name}] "
|
964
|
-
+ f"{html_url}: error processing template: {str(e)}"
|
965
|
-
)
|
951
|
+
logging.error(f"{error_prefix} error processing template: {str(e)}")
|
966
952
|
|
967
953
|
elif provider == "directory":
|
968
954
|
try:
|
969
|
-
resources,
|
970
|
-
url=url, path=path, ref=
|
955
|
+
resources, commit_sha = self._get_directory_contents(
|
956
|
+
url=url, path=path, ref=ref, github=github
|
971
957
|
)
|
972
958
|
except Exception as e:
|
973
959
|
logging.error(
|
974
|
-
f"
|
975
|
-
+ f"error fetching directory: {str(e)} "
|
960
|
+
f"{error_prefix} error fetching directory: {str(e)} "
|
976
961
|
+ "(We do not support nested directories. Do you by chance have subdirectories?)"
|
977
962
|
)
|
978
963
|
raise
|
@@ -983,10 +968,9 @@ class SaasHerder: # pylint: disable=too-many-public-methods
|
|
983
968
|
if self.gitlab and url.startswith(self.gitlab.server)
|
984
969
|
else True
|
985
970
|
)
|
986
|
-
html_url = f"{url}/tree/{target.ref}{path}"
|
987
971
|
consolidated_parameters = spec.parameters(adjust=False)
|
988
972
|
if not consolidated_parameters.get("image", {}).get("tag"):
|
989
|
-
commit_sha = self._get_commit_sha(url,
|
973
|
+
commit_sha = self._get_commit_sha(url, ref, github)
|
990
974
|
image_tag = commit_sha[:hash_length]
|
991
975
|
consolidated_parameters.setdefault("image", {})["tag"] = image_tag
|
992
976
|
resources = helm.template_all(
|
@@ -998,10 +982,7 @@ class SaasHerder: # pylint: disable=too-many-public-methods
|
|
998
982
|
)
|
999
983
|
|
1000
984
|
else:
|
1001
|
-
logging.error(
|
1002
|
-
f"[{saas_file_name}/{resource_template_name}] "
|
1003
|
-
+ f"unknown provider: {provider}"
|
1004
|
-
)
|
985
|
+
logging.error(f"{error_prefix} unknown provider: {provider}")
|
1005
986
|
|
1006
987
|
target_promotion = None
|
1007
988
|
if target.promotion:
|
@@ -1023,7 +1004,7 @@ class SaasHerder: # pylint: disable=too-many-public-methods
|
|
1023
1004
|
),
|
1024
1005
|
soak_days=target.promotion.soak_days or 0,
|
1025
1006
|
)
|
1026
|
-
return resources,
|
1007
|
+
return resources, target_promotion
|
1027
1008
|
|
1028
1009
|
def _assemble_channels(
|
1029
1010
|
self, saas_files: Iterable[SaasFile] | None
|
@@ -1154,14 +1135,9 @@ class SaasHerder: # pylint: disable=too-many-public-methods
|
|
1154
1135
|
|
1155
1136
|
def _check_images(
|
1156
1137
|
self,
|
1157
|
-
|
1158
|
-
resource_template_name: str,
|
1159
|
-
image_auth: ImageAuth,
|
1160
|
-
image_patterns: list[str],
|
1161
|
-
html_url: str,
|
1138
|
+
spec: TargetSpec,
|
1162
1139
|
resources: Resources,
|
1163
1140
|
) -> bool:
|
1164
|
-
error_prefix = f"[{saas_file_name}/{resource_template_name}] {html_url}:"
|
1165
1141
|
images_list = threaded.run(
|
1166
1142
|
self._collect_images, resources, self.available_thread_pool_size
|
1167
1143
|
)
|
@@ -1173,9 +1149,9 @@ class SaasHerder: # pylint: disable=too-many-public-methods
|
|
1173
1149
|
self._get_image,
|
1174
1150
|
images,
|
1175
1151
|
self.available_thread_pool_size,
|
1176
|
-
image_patterns=image_patterns,
|
1177
|
-
image_auth=image_auth,
|
1178
|
-
error_prefix=error_prefix,
|
1152
|
+
image_patterns=spec.image_patterns,
|
1153
|
+
image_auth=spec.image_auth,
|
1154
|
+
error_prefix=spec.error_prefix,
|
1179
1155
|
)
|
1180
1156
|
return None in images
|
1181
1157
|
|
@@ -1299,8 +1275,9 @@ class SaasHerder: # pylint: disable=too-many-public-methods
|
|
1299
1275
|
# to delete resources, we avoid adding them to the desired state
|
1300
1276
|
return None
|
1301
1277
|
|
1278
|
+
html_url = spec.html_url
|
1302
1279
|
try:
|
1303
|
-
resources,
|
1280
|
+
resources, promotion = self._process_template(spec)
|
1304
1281
|
except Exception as e:
|
1305
1282
|
# error log message send in _process_template. We cannot just
|
1306
1283
|
# register an error without logging as inventory errors don't have details.
|
@@ -1334,11 +1311,7 @@ class SaasHerder: # pylint: disable=too-many-public-methods
|
|
1334
1311
|
self._additional_resource_process(resources, html_url)
|
1335
1312
|
# check images
|
1336
1313
|
image_error = self._check_images(
|
1337
|
-
|
1338
|
-
resource_template_name=spec.resource_template_name,
|
1339
|
-
image_auth=spec.image_auth,
|
1340
|
-
image_patterns=spec.image_patterns,
|
1341
|
-
html_url=html_url,
|
1314
|
+
spec=spec,
|
1342
1315
|
resources=resources,
|
1343
1316
|
)
|
1344
1317
|
if image_error:
|
File without changes
|
File without changes
|
{qontract_reconcile-0.10.1rc932.dist-info → qontract_reconcile-0.10.1rc933.dist-info}/top_level.txt
RENAMED
File without changes
|