qontract-reconcile 0.10.1rc774__py3-none-any.whl → 0.10.1rc776__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.1rc774.dist-info → qontract_reconcile-0.10.1rc776.dist-info}/METADATA +1 -1
- {qontract_reconcile-0.10.1rc774.dist-info → qontract_reconcile-0.10.1rc776.dist-info}/RECORD +11 -11
- reconcile/openshift_saas_deploy_trigger_base.py +2 -7
- reconcile/test/test_openshift_saas_deploy.py +2 -1
- reconcile/utils/oc.py +15 -14
- reconcile/utils/openshift_resource.py +9 -1
- reconcile/utils/promotion_state.py +0 -2
- reconcile/utils/saasherder/saasherder.py +2 -5
- {qontract_reconcile-0.10.1rc774.dist-info → qontract_reconcile-0.10.1rc776.dist-info}/WHEEL +0 -0
- {qontract_reconcile-0.10.1rc774.dist-info → qontract_reconcile-0.10.1rc776.dist-info}/entry_points.txt +0 -0
- {qontract_reconcile-0.10.1rc774.dist-info → qontract_reconcile-0.10.1rc776.dist-info}/top_level.txt +0 -0
{qontract_reconcile-0.10.1rc774.dist-info → qontract_reconcile-0.10.1rc776.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.1rc776
|
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.1rc774.dist-info → qontract_reconcile-0.10.1rc776.dist-info}/RECORD
RENAMED
@@ -77,7 +77,7 @@ reconcile/openshift_rolebindings.py,sha256=LlImloBisEqzc36jaatic-TeM3hzqMEfxogF-
|
|
77
77
|
reconcile/openshift_routes.py,sha256=fXvuPSjcjVw1X3j2EQvUAdbOepmIFdKk-M3qP8QzPiw,1075
|
78
78
|
reconcile/openshift_saas_deploy.py,sha256=fmhopPEbyZsGQHRPzyzpKEvoBXEGN3aPxFi7Utq0emU,12788
|
79
79
|
reconcile/openshift_saas_deploy_change_tester.py,sha256=fMmPDz-ZRO-WH8OIiDo4e4sBK4-zzpvFXmVCKGY1l-I,8837
|
80
|
-
reconcile/openshift_saas_deploy_trigger_base.py,sha256
|
80
|
+
reconcile/openshift_saas_deploy_trigger_base.py,sha256=-XsLbN1FRIbrBwdUyE3Xa4cIHu72imG1GNsMFH9jCTs,14040
|
81
81
|
reconcile/openshift_saas_deploy_trigger_cleaner.py,sha256=gU226N1JUvgEbTgDf7ouJ6QzZGMI_BLwXdS67UCukRk,3554
|
82
82
|
reconcile/openshift_saas_deploy_trigger_configs.py,sha256=uWzUV5D5CW0frdi1ys7BObNg-rA-VZKlefd4TD_Z-pY,959
|
83
83
|
reconcile/openshift_saas_deploy_trigger_images.py,sha256=Yl4lMtxqab-c04I2Ju8isAJuYuNTbHN01Bk3dF9nTos,967
|
@@ -497,7 +497,7 @@ reconcile/test/test_openshift_namespace_labels.py,sha256=P1hqi6P88NijNrurdXG_QR2
|
|
497
497
|
reconcile/test/test_openshift_namespaces.py,sha256=HmRnCE5EnFt3MYceVEFHmk8wWRtCrxu2AFGFkY9pdyA,9214
|
498
498
|
reconcile/test/test_openshift_resource.py,sha256=lbTf48jX1q6rGnRiA5pPvfU0uPfY8zhNylMtryn0sLI,12995
|
499
499
|
reconcile/test/test_openshift_resources_base.py,sha256=LtlR9x3o7KkSEw0JN0fZhinFeAAxBAQlB_9PpBnKwOM,14353
|
500
|
-
reconcile/test/test_openshift_saas_deploy.py,sha256=
|
500
|
+
reconcile/test/test_openshift_saas_deploy.py,sha256=X0cv-f6YoAz-42UamPPFgZROirkzuBBJMiQEYZU_rKA,6001
|
501
501
|
reconcile/test/test_openshift_saas_deploy_change_tester.py,sha256=1yVe54Hx9YdVjn6qdnKge5Sa_s732c-8uZqCnuT1gGI,12871
|
502
502
|
reconcile/test/test_openshift_saas_deploy_trigger_cleaner.py,sha256=cha3bUiXAWPCwrp8XwVC3RNJtJHLcsGTE-F8Zn6XxsU,2852
|
503
503
|
reconcile/test/test_openshift_tekton_resources.py,sha256=RtRWsdm51S13OSkENC9nY_rOH0QELSCaO5tjF0XqIDI,11222
|
@@ -635,19 +635,19 @@ reconcile/utils/make.py,sha256=QaEwucrzbl8-VHS66Wfdjfo0ubmAcvt_hZGpiGsKU50,231
|
|
635
635
|
reconcile/utils/metrics.py,sha256=ot4dBO-KLZRowvNozm7jG0RWjcVsH1SL-lQ0jJgBBZM,18645
|
636
636
|
reconcile/utils/models.py,sha256=It_Q1WNIvw_EDCsiSWzIgpSPr_X9jMgbJI-DR3N23xY,4677
|
637
637
|
reconcile/utils/oauth2_backend_application_session.py,sha256=6W16sMpnWEPFDUX7qi5Cui2yOnmLfpgUxWtB3Ii35D0,4177
|
638
|
-
reconcile/utils/oc.py,sha256=
|
638
|
+
reconcile/utils/oc.py,sha256=ZA2RwR7UcLzhvRKUoFt0knhizl7wm-4WpZyT4N48ntg,65564
|
639
639
|
reconcile/utils/oc_connection_parameters.py,sha256=85slrnDigYwYmzhyceVkMElWzFArp4ge1d-fHXVqh0w,9729
|
640
640
|
reconcile/utils/oc_filters.py,sha256=R2Lf3fo0jQCeE62Ygeo_KN24XbAosq0QbjimYG6qHI4,1402
|
641
641
|
reconcile/utils/oc_map.py,sha256=nT69J5pdPeIDnIYjD9fwY6GkE3BMQCf-AF0rmHJuUNw,9068
|
642
642
|
reconcile/utils/ocm_base_client.py,sha256=X8qkPXfpfJdBKBtFv7zyGD33HNAEBJL8owf-ykrt-Ts,6469
|
643
|
-
reconcile/utils/openshift_resource.py,sha256=
|
643
|
+
reconcile/utils/openshift_resource.py,sha256=Gxhc3oyYDCfMix7RDVvNAZX9O1bQII0KAjGsC5pu7oA,24831
|
644
644
|
reconcile/utils/openssl.py,sha256=QVvhzhpChq_4Daf_5wE1qeZJr4thg3DDjJPn4bOPD4E,365
|
645
645
|
reconcile/utils/output.py,sha256=4tObxIS_-EdJY_YCOOOmaYvHY40Q72IpYjWhjpJR1Ec,1856
|
646
646
|
reconcile/utils/pagerduty_api.py,sha256=fcSAUez6w51woDvbm0plJW2qSw6_NXQs1Fit_KTNitc,7653
|
647
647
|
reconcile/utils/parse_dhms_duration.py,sha256=TONpLnec5gHeF7k815YNJpQyDjXhkxZIcv9s8ffbTSY,1840
|
648
648
|
reconcile/utils/password_validator.py,sha256=XwuWg-8CPlcuG7dl_oQ1G1h2gSVSnfMym_VkuprpWVg,2183
|
649
649
|
reconcile/utils/prometheus.py,sha256=i5aCQ_I4WOg76iEjglVxxO9-OKby2N80ScErAbDtHE8,3848
|
650
|
-
reconcile/utils/promotion_state.py,sha256=
|
650
|
+
reconcile/utils/promotion_state.py,sha256=avYxHUf4zK3dBhXEdUEry79EOSgJ7gfStvvOpcedZnI,2575
|
651
651
|
reconcile/utils/promtool.py,sha256=kT2rFZSBaRqW7SSHAuYzGZzQxM5Dzk8KW1NnEUYZU_s,2896
|
652
652
|
reconcile/utils/quay_api.py,sha256=EuOegpb-7ntEjkKLFwM2Oo4Nw7SyFtmyl3sQ9aXMtrM,8152
|
653
653
|
reconcile/utils/raw_github_api.py,sha256=ZHC-SZuAyRe1zaMoOU7Krt1-zecDxENd9c_NzQYqK9g,2968
|
@@ -750,7 +750,7 @@ reconcile/utils/runtime/sharding.py,sha256=roCdbnBklhTK_g34zbgQYqzpKPaNQ8J6Xd9XL
|
|
750
750
|
reconcile/utils/saasherder/__init__.py,sha256=J3MBZBFa5YmhqYm08QsjBXz8mFcVOCiOCkyIcw41t7E,343
|
751
751
|
reconcile/utils/saasherder/interfaces.py,sha256=XXY35h8VWQ66z3LBPxaoUAMkIW50264DQiecrzyV6oA,9076
|
752
752
|
reconcile/utils/saasherder/models.py,sha256=1DKXUmiTS_MejUfSpFCeuBLMTgR4ldv2N1tAz8qHAwc,5547
|
753
|
-
reconcile/utils/saasherder/saasherder.py,sha256=
|
753
|
+
reconcile/utils/saasherder/saasherder.py,sha256=i15fDTccbSrOWlTPE35WAs8isnfeHYZf18vCMNc_794,86165
|
754
754
|
reconcile/utils/terraform/__init__.py,sha256=zNbiyTWo35AT1sFTElL2j_AA0jJ_yWE_bfFn-nD2xik,250
|
755
755
|
reconcile/utils/terraform/config.py,sha256=5UVrd563TMcvi4ooa5JvWVDW1I3bIWg484u79evfV_8,164
|
756
756
|
reconcile/utils/terraform/config_client.py,sha256=py-Ree-QUYD6Hvng6bM40VgSuttteehIKNgwOSoJO1o,4706
|
@@ -785,8 +785,8 @@ tools/test/test_app_interface_metrics_exporter.py,sha256=SX7qL3D1SIRKFo95FoQztvf
|
|
785
785
|
tools/test/test_qontract_cli.py,sha256=w2l4BHB09k1d-BGJ1jBUNCqDv7zkqYrMHojQXg-21kQ,4155
|
786
786
|
tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
|
787
787
|
tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
|
788
|
-
qontract_reconcile-0.10.
|
789
|
-
qontract_reconcile-0.10.
|
790
|
-
qontract_reconcile-0.10.
|
791
|
-
qontract_reconcile-0.10.
|
792
|
-
qontract_reconcile-0.10.
|
788
|
+
qontract_reconcile-0.10.1rc776.dist-info/METADATA,sha256=N0MOOl3RGtVHM2A1UdCmL6f4MnDhzZGiaux-KheA8w8,2382
|
789
|
+
qontract_reconcile-0.10.1rc776.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
790
|
+
qontract_reconcile-0.10.1rc776.dist-info/entry_points.txt,sha256=rIxI5zWtHNlfpDeq1a7pZXAPoqf7HG32KMTN3MeWK_8,429
|
791
|
+
qontract_reconcile-0.10.1rc776.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
|
792
|
+
qontract_reconcile-0.10.1rc776.dist-info/RECORD,,
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import datetime
|
2
1
|
import logging
|
3
2
|
from collections.abc import Callable
|
4
3
|
from threading import Lock
|
@@ -356,11 +355,7 @@ def _construct_tekton_trigger_resource(
|
|
356
355
|
tkn_name, tkn_long_name = SaasHerder.build_saas_file_env_combo(
|
357
356
|
saas_file_name, env_name
|
358
357
|
)
|
359
|
-
|
360
|
-
# we may want to revisit traceability, but this is compatible
|
361
|
-
# with what we currently have in Jenkins.
|
362
|
-
ts = datetime.datetime.utcnow().strftime("%Y%m%d%H%M") # len 12
|
363
|
-
name = f"{tkn_name.lower()}-{ts}"
|
358
|
+
name = tkn_name.lower()
|
364
359
|
|
365
360
|
parameters = [
|
366
361
|
{"name": "saas_file_name", "value": saas_file_name},
|
@@ -381,7 +376,7 @@ def _construct_tekton_trigger_resource(
|
|
381
376
|
body: dict[str, Any] = {
|
382
377
|
"apiVersion": "tekton.dev/v1",
|
383
378
|
"kind": "PipelineRun",
|
384
|
-
"metadata": {"
|
379
|
+
"metadata": {"generateName": f"{name}-"},
|
385
380
|
"spec": {
|
386
381
|
"pipelineRef": {"name": tkn_pipeline_name},
|
387
382
|
"params": parameters,
|
@@ -15,6 +15,7 @@ from reconcile.utils import (
|
|
15
15
|
openshift_resource,
|
16
16
|
slack_api,
|
17
17
|
)
|
18
|
+
from reconcile.utils.saasherder.saasherder import UNIQUE_SAAS_FILE_ENV_COMBO_LEN
|
18
19
|
|
19
20
|
|
20
21
|
@pytest.fixture
|
@@ -72,7 +73,7 @@ def test_compose_console_url_with_medium_saas_name(
|
|
72
73
|
|
73
74
|
url = compose_console_url(saas_file, env_name)
|
74
75
|
|
75
|
-
expected_run_name = f"{saas_name}-{env_name}"[:
|
76
|
+
expected_run_name = f"{saas_name}-{env_name}"[:UNIQUE_SAAS_FILE_ENV_COMBO_LEN]
|
76
77
|
assert (
|
77
78
|
url == "https://console.url/k8s/ns/namespace_name/tekton.dev~v1beta1~Pipeline/"
|
78
79
|
"o-saas-deploy-saas-openshift-cert-manager-routes/"
|
reconcile/utils/oc.py
CHANGED
@@ -51,6 +51,7 @@ from reconcile.utils.jump_host import (
|
|
51
51
|
)
|
52
52
|
from reconcile.utils.metrics import reconcile_time
|
53
53
|
from reconcile.utils.oc_connection_parameters import OCConnectionParameters
|
54
|
+
from reconcile.utils.openshift_resource import OpenshiftResource as OR
|
54
55
|
from reconcile.utils.secret_reader import (
|
55
56
|
SecretNotFound,
|
56
57
|
SecretReader,
|
@@ -162,10 +163,10 @@ class OCDecorators:
|
|
162
163
|
time_spent = time.time() - commit_time
|
163
164
|
|
164
165
|
try:
|
165
|
-
resource_kind = msg.resource
|
166
|
-
resource_name = msg.resource
|
167
|
-
annotations = msg.resource
|
168
|
-
except
|
166
|
+
resource_kind = msg.resource.kind
|
167
|
+
resource_name = msg.resource.name
|
168
|
+
annotations = msg.resource.annotations
|
169
|
+
except Exception as e:
|
169
170
|
logging.warning(f"Error processing metric: {e}")
|
170
171
|
return result
|
171
172
|
|
@@ -204,11 +205,11 @@ class OCDecorators:
|
|
204
205
|
class OCProcessReconcileTimeDecoratorMsg:
|
205
206
|
def __init__(
|
206
207
|
self,
|
207
|
-
namespace,
|
208
|
-
resource,
|
209
|
-
server,
|
210
|
-
slow_oc_reconcile_threshold,
|
211
|
-
is_log_slow_oc_reconcile,
|
208
|
+
namespace: str,
|
209
|
+
resource: OR,
|
210
|
+
server: Optional[str],
|
211
|
+
slow_oc_reconcile_threshold: float,
|
212
|
+
is_log_slow_oc_reconcile: bool,
|
212
213
|
):
|
213
214
|
self.namespace = namespace
|
214
215
|
self.resource = resource
|
@@ -523,7 +524,7 @@ class OCCli: # pylint: disable=too-many-public-methods
|
|
523
524
|
]
|
524
525
|
self._run(cmd)
|
525
526
|
|
526
|
-
def _msg_to_process_reconcile_time(self, namespace, resource):
|
527
|
+
def _msg_to_process_reconcile_time(self, namespace: str, resource: OR):
|
527
528
|
return OCProcessReconcileTimeDecoratorMsg(
|
528
529
|
namespace=namespace,
|
529
530
|
resource=resource,
|
@@ -550,25 +551,25 @@ class OCCli: # pylint: disable=too-many-public-methods
|
|
550
551
|
def apply(self, namespace, resource):
|
551
552
|
cmd = ["apply", "-n", namespace, "-f", "-"]
|
552
553
|
self._run(cmd, stdin=resource.toJSON(), apply=True)
|
553
|
-
return self._msg_to_process_reconcile_time(namespace, resource
|
554
|
+
return self._msg_to_process_reconcile_time(namespace, resource)
|
554
555
|
|
555
556
|
@OCDecorators.process_reconcile_time
|
556
557
|
def create(self, namespace, resource):
|
557
558
|
cmd = ["create", "-n", namespace, "-f", "-"]
|
558
559
|
self._run(cmd, stdin=resource.toJSON(), apply=True)
|
559
|
-
return self._msg_to_process_reconcile_time(namespace, resource
|
560
|
+
return self._msg_to_process_reconcile_time(namespace, resource)
|
560
561
|
|
561
562
|
@OCDecorators.process_reconcile_time
|
562
563
|
def replace(self, namespace, resource):
|
563
564
|
cmd = ["replace", "-n", namespace, "-f", "-"]
|
564
565
|
self._run(cmd, stdin=resource.toJSON(), apply=True)
|
565
|
-
return self._msg_to_process_reconcile_time(namespace, resource
|
566
|
+
return self._msg_to_process_reconcile_time(namespace, resource)
|
566
567
|
|
567
568
|
@OCDecorators.process_reconcile_time
|
568
569
|
def patch(self, namespace, kind, name, patch):
|
569
570
|
cmd = ["patch", "-n", namespace, kind, name, "-p", json.dumps(patch)]
|
570
571
|
self._run(cmd)
|
571
|
-
resource = {"kind": kind, "metadata": {"name": name}}
|
572
|
+
resource = OR({"kind": kind, "metadata": {"name": name}}, "", "")
|
572
573
|
return self._msg_to_process_reconcile_time(namespace, resource)
|
573
574
|
|
574
575
|
@OCDecorators.process_reconcile_time
|
@@ -214,12 +214,20 @@ class OpenshiftResource:
|
|
214
214
|
|
215
215
|
@property
|
216
216
|
def name(self):
|
217
|
-
|
217
|
+
# PipelineRun name can be empty when creating
|
218
|
+
if self.kind == "PipelineRun" and "name" not in self.body["metadata"]:
|
219
|
+
return self.body["metadata"]["generateName"][:-1]
|
220
|
+
else:
|
221
|
+
return self.body["metadata"]["name"]
|
218
222
|
|
219
223
|
@property
|
220
224
|
def kind(self):
|
221
225
|
return self.body["kind"]
|
222
226
|
|
227
|
+
@property
|
228
|
+
def annotations(self):
|
229
|
+
return self.body["metadata"].get("annotations", {})
|
230
|
+
|
223
231
|
@property
|
224
232
|
def kind_and_group(self):
|
225
233
|
return fully_qualified_kind(self.kind, self.body["apiVersion"])
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import logging
|
2
2
|
from collections import defaultdict
|
3
|
-
from datetime import datetime
|
4
3
|
from typing import Optional
|
5
4
|
|
6
5
|
from pydantic import (
|
@@ -23,7 +22,6 @@ class PromotionData(BaseModel):
|
|
23
22
|
success: bool
|
24
23
|
target_config_hash: Optional[str]
|
25
24
|
saas_file: Optional[str]
|
26
|
-
check_in: Optional[datetime]
|
27
25
|
|
28
26
|
class Config:
|
29
27
|
smart_union = True
|
@@ -16,7 +16,6 @@ from collections.abc import (
|
|
16
16
|
Sequence,
|
17
17
|
)
|
18
18
|
from contextlib import suppress
|
19
|
-
from datetime import datetime, timezone
|
20
19
|
from types import TracebackType
|
21
20
|
from typing import (
|
22
21
|
Any,
|
@@ -94,7 +93,7 @@ from reconcile.utils.state import State
|
|
94
93
|
TARGET_CONFIG_HASH = "target_config_hash"
|
95
94
|
|
96
95
|
|
97
|
-
UNIQUE_SAAS_FILE_ENV_COMBO_LEN =
|
96
|
+
UNIQUE_SAAS_FILE_ENV_COMBO_LEN = 56
|
98
97
|
|
99
98
|
|
100
99
|
def is_commit_sha(ref: str) -> bool:
|
@@ -492,7 +491,7 @@ class SaasHerder: # pylint: disable=too-many-public-methods
|
|
492
491
|
"""
|
493
492
|
Build a tuple of short and long names for a saas file and environment combo,
|
494
493
|
max tekton pipelinerun name length can be 63,
|
495
|
-
leaving
|
494
|
+
leaving 7 for the rerun leaves us with 56 to create a unique pipelinerun name.
|
496
495
|
|
497
496
|
:param saas_file_name: name of the saas file
|
498
497
|
:param env_name: name of the environment
|
@@ -1966,7 +1965,6 @@ class SaasHerder: # pylint: disable=too-many-public-methods
|
|
1966
1965
|
if not (self.state and self._promotion_state):
|
1967
1966
|
raise Exception("state is not initialized")
|
1968
1967
|
|
1969
|
-
now = datetime.now(timezone.utc)
|
1970
1968
|
for promotion in self.promotions:
|
1971
1969
|
if promotion is None:
|
1972
1970
|
continue
|
@@ -1984,7 +1982,6 @@ class SaasHerder: # pylint: disable=too-many-public-methods
|
|
1984
1982
|
saas_file=promotion.saas_file,
|
1985
1983
|
success=success,
|
1986
1984
|
target_config_hash=promotion.target_config_hash,
|
1987
|
-
check_in=now,
|
1988
1985
|
),
|
1989
1986
|
)
|
1990
1987
|
logging.info(
|
File without changes
|
File without changes
|
{qontract_reconcile-0.10.1rc774.dist-info → qontract_reconcile-0.10.1rc776.dist-info}/top_level.txt
RENAMED
File without changes
|