qontract-reconcile 0.10.1rc916__py3-none-any.whl → 0.10.1rc917__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.1rc916
3
+ Version: 0.10.1rc917
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
@@ -10,7 +10,7 @@ reconcile/aws_iam_password_reset.py,sha256=q96mwr2KeEQ5bpNniGlgIMZTxiuLSodcYfX-t
10
10
  reconcile/aws_support_cases_sos.py,sha256=Jk6_XjDeJSYxgRGqcEAOcynt9qJF2r5HPIPcSKmoBv8,2974
11
11
  reconcile/blackbox_exporter_endpoint_monitoring.py,sha256=O1wFp52EyF538c6txaWBs8eMtUIy19gyHZ6VzJ6QXS8,3512
12
12
  reconcile/checkpoint.py,sha256=_JhMxrye5BgkRMxWYuf7Upli6XayPINKSsuo3ynHTRc,5010
13
- reconcile/cli.py,sha256=W4lRKuz6Z_EHXLf-mQLb3mVdcAr23H4JrY-R8UUPBbs,105862
13
+ reconcile/cli.py,sha256=Cd_Oq-izWc-NJ1jRCPbkhADTrOsYprhVUip-mz2uyp8,106043
14
14
  reconcile/closedbox_endpoint_monitoring_base.py,sha256=rLh16BOlBOxTmJ8Si3wWyyEpmMlhh4Znx1Gc36qsmOc,4865
15
15
  reconcile/cluster_deployment_mapper.py,sha256=5gumAaRCcFXsabUJ1dnuUy9WrP_FEEM5JnOnE8ch9sE,2326
16
16
  reconcile/dashdotdb_base.py,sha256=l34QDu1G96_Ctnh7ZXdxXgSeCE93GQMdLAkWxmN6vDA,4775
@@ -661,7 +661,7 @@ reconcile/utils/gitlab_api.py,sha256=T4kAaiXRztgxTMpyR0XND_6Wm0WThRoHUNULzNZxNBA
661
661
  reconcile/utils/gpg.py,sha256=EKG7_fdMv8BMlV5yUdPiqoTx-KrzmVSEAl2sLkaKwWI,1123
662
662
  reconcile/utils/gql.py,sha256=IGhxzBcuebbapDKLseevEThSsxa_eDCPNpo3A4VnOS4,14066
663
663
  reconcile/utils/grouping.py,sha256=vr9SFHZ7bqmHYrvYcEZt-Er3-yQYfAAdq5sHLZVmXPY,456
664
- reconcile/utils/helm.py,sha256=Rt1ao4yI4GdThZyIPV75JLJjkvu9d8kOLKQht6KUzyE,1325
664
+ reconcile/utils/helm.py,sha256=qnXtw3nyKJqobSG4d6PtvulqToqiEGuXK5PbgfwSFHI,1942
665
665
  reconcile/utils/helpers.py,sha256=k9svgFFZG7H5FvHYY0g5jJyvgvh2UDZxf0Ib221teag,1179
666
666
  reconcile/utils/imap_client.py,sha256=PMsX8UjJ2F59fXbbqREjLVdapYWznYTB8svFmpt39qA,1949
667
667
  reconcile/utils/instrumented_wrappers.py,sha256=eVwMoa6FCrYxLv3RML3WpZF9qKVfCTjMxphgVXG03OM,1073
@@ -793,7 +793,7 @@ reconcile/utils/runtime/sharding.py,sha256=r0ieUtNed7NvknSw6qQrCkKpVXE1shuHGnfFc
793
793
  reconcile/utils/saasherder/__init__.py,sha256=J3MBZBFa5YmhqYm08QsjBXz8mFcVOCiOCkyIcw41t7E,343
794
794
  reconcile/utils/saasherder/interfaces.py,sha256=C2wrw34OXypshVocAsPrVZsSHptgw4g9u7Haa2wulZQ,9087
795
795
  reconcile/utils/saasherder/models.py,sha256=McvpJhwh-QfrNT76hekvx5U5Xq2Hp1Yt1XHTW2d3Cn8,5466
796
- reconcile/utils/saasherder/saasherder.py,sha256=pg3eL_Rx8ZgoYSfXYdyftEdYWv5sHi_UgNuihlIaG9o,87701
796
+ reconcile/utils/saasherder/saasherder.py,sha256=ul6sRbgvxUSnrDZXwJQ9nnQumkpTERTLFBWuiIWlCUA,88241
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.1rc916.dist-info/METADATA,sha256=KPsigSS8webUozoUf662AHUkUx8hpkChedhbl1ngNKY,2273
848
- qontract_reconcile-0.10.1rc916.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
849
- qontract_reconcile-0.10.1rc916.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
850
- qontract_reconcile-0.10.1rc916.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
851
- qontract_reconcile-0.10.1rc916.dist-info/RECORD,,
847
+ qontract_reconcile-0.10.1rc917.dist-info/METADATA,sha256=9i8HABFSIkcnnT-zpqr2yfJeF9T7rzIQVADi3hQzMy4,2273
848
+ qontract_reconcile-0.10.1rc917.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
849
+ qontract_reconcile-0.10.1rc917.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
850
+ qontract_reconcile-0.10.1rc917.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
851
+ qontract_reconcile-0.10.1rc917.dist-info/RECORD,,
reconcile/cli.py CHANGED
@@ -50,6 +50,9 @@ TERRAFORM_VERSION_REGEX = r"^Terraform\sv([\d]+\.[\d]+\.[\d]+)$"
50
50
  OC_VERSIONS = ["4.12.46", "4.10.15"]
51
51
  OC_VERSION_REGEX = r"^Client\sVersion:\s([\d]+\.[\d]+\.[\d]+)$"
52
52
 
53
+ HELM_VERSIONS = ["3.11.1"]
54
+ HELM_VERSION_REGEX = r"^version.BuildInfo{Version:\"v([\d]+\.[\d]+\.[\d]+)\".*$"
55
+
53
56
 
54
57
  def before_breadcrumb(crumb, hint):
55
58
  # https://docs.sentry.io/platforms/python/configuration/filtering/
@@ -1394,6 +1397,7 @@ def openshift_resources(
1394
1397
  @use_jump_host()
1395
1398
  @binary(["oc", "ssh"])
1396
1399
  @binary_version("oc", ["version", "--client"], OC_VERSION_REGEX, OC_VERSIONS)
1400
+ @binary_version("helm", ["version"], HELM_VERSION_REGEX, HELM_VERSIONS)
1397
1401
  @click.option("--saas-file-name", default=None, help="saas-file to act on.")
1398
1402
  @click.option("--env-name", default=None, help="environment to deploy to.")
1399
1403
  @trigger_integration
reconcile/utils/helm.py CHANGED
@@ -1,6 +1,6 @@
1
1
  import json
2
2
  import tempfile
3
- from collections.abc import Mapping
3
+ from collections.abc import Iterable, Mapping
4
4
  from subprocess import (
5
5
  CalledProcessError,
6
6
  run,
@@ -9,6 +9,7 @@ from typing import Any
9
9
 
10
10
  import yaml
11
11
 
12
+ from reconcile.utils import git
12
13
  from reconcile.utils.runtime.sharding import ShardSpec
13
14
 
14
15
 
@@ -23,7 +24,11 @@ class JSONEncoder(json.JSONEncoder):
23
24
  return super().default(o)
24
25
 
25
26
 
26
- def template(values: Mapping[str, Any]) -> Mapping[str, Any]:
27
+ def do_template(
28
+ values: Mapping[str, Any],
29
+ path: str,
30
+ name: str,
31
+ ) -> str:
27
32
  try:
28
33
  with tempfile.NamedTemporaryFile(mode="w+", encoding="locale") as values_file:
29
34
  values_file.write(json.dumps(values, cls=JSONEncoder))
@@ -31,9 +36,9 @@ def template(values: Mapping[str, Any]) -> Mapping[str, Any]:
31
36
  cmd = [
32
37
  "helm",
33
38
  "template",
34
- "./helm/qontract-reconcile",
39
+ path,
35
40
  "-n",
36
- "qontract-reconcile",
41
+ name,
37
42
  "-f",
38
43
  values_file.name,
39
44
  ]
@@ -46,4 +51,26 @@ def template(values: Mapping[str, Any]) -> Mapping[str, Any]:
46
51
  msg += f" {e.stderr.decode()}"
47
52
  raise HelmTemplateError(msg)
48
53
 
49
- return yaml.safe_load(result.stdout.decode())
54
+ return result.stdout.decode()
55
+
56
+
57
+ def template(
58
+ values: Mapping[str, Any],
59
+ path: str = "./helm/qontract-reconcile",
60
+ name: str = "qontract-reconcile",
61
+ ) -> Mapping[str, Any]:
62
+ return yaml.safe_load(do_template(values=values, path=path, name=name))
63
+
64
+
65
+ def template_all(
66
+ url: str,
67
+ path: str,
68
+ name: str,
69
+ values: Mapping[str, Any],
70
+ ssl_verify: bool = True,
71
+ ) -> Iterable[Mapping[str, Any]]:
72
+ with tempfile.TemporaryDirectory() as wd:
73
+ git.clone(url, wd, depth=1, verify=ssl_verify)
74
+ return yaml.safe_load_all(
75
+ do_template(values=values, path=f"{wd}{path}", name=name)
76
+ )
@@ -39,6 +39,7 @@ from sretoolbox.utils import (
39
39
 
40
40
  from reconcile.github_org import get_default_config
41
41
  from reconcile.status import RunningState
42
+ from reconcile.utils import helm
42
43
  from reconcile.utils.gitlab_api import GitLabApi
43
44
  from reconcile.utils.jenkins_api import JenkinsApi
44
45
  from reconcile.utils.jjb_client import JJB
@@ -1034,6 +1035,21 @@ class SaasHerder: # pylint: disable=too-many-public-methods
1034
1035
  )
1035
1036
  raise
1036
1037
 
1038
+ elif provider == "helm":
1039
+ ssl_verify = (
1040
+ self.gitlab.ssl_verify
1041
+ if self.gitlab and url.startswith(self.gitlab.server)
1042
+ else True
1043
+ )
1044
+ html_url = f"{url}/tree/{target.ref}{path}"
1045
+ resources = helm.template_all(
1046
+ url=url,
1047
+ path=path,
1048
+ name=resource_template_name,
1049
+ values=target.parameters or {},
1050
+ ssl_verify=ssl_verify,
1051
+ )
1052
+
1037
1053
  else:
1038
1054
  logging.error(
1039
1055
  f"[{saas_file_name}/{resource_template_name}] "