qontract-reconcile 0.10.1rc478__py3-none-any.whl → 0.10.1rc480__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.1rc478
3
+ Version: 0.10.1rc480
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
@@ -118,10 +118,10 @@ reconcile/vpc_peerings_validator.py,sha256=Kv22HJVlTW9l9GB2eXwjPWqdDbr_VuvQBNPtt
118
118
  reconcile/aus/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
119
119
  reconcile/aus/advanced_upgrade_service.py,sha256=DQ9FrphzhKsKaXbXeA2v3Qsg1ABXXEtPhD-R-FwUsBA,21007
120
120
  reconcile/aus/aus_label_source.py,sha256=X6FD4NYcX27llMUSmmBcCh-pG7U5FnBd0zl-0zwCj2U,4118
121
- reconcile/aus/base.py,sha256=L7A_9N8fS98P2ltSuDI-ZFpjbLOlnBrYLPBAlZtep10,43625
121
+ reconcile/aus/base.py,sha256=aad4dkVOTZfeLLNmdDranLugt8Z3whQuae86yyYcgBU,44417
122
122
  reconcile/aus/cluster_version_data.py,sha256=j4UyEBi5mQuvPq5Lo7a_L_0blxvH790wJV07uAiikFU,7126
123
123
  reconcile/aus/metrics.py,sha256=fIew-rzi_kYuI5Gxn3-4bQVIr2oNibiKPyGnhB-xKU4,3538
124
- reconcile/aus/models.py,sha256=oBSVZ-3JTngxKg_bH1vAfREpz55t8K-Y3eC9TA4pOTw,6849
124
+ reconcile/aus/models.py,sha256=muBmbovxYtSNLFrTLVRcJYZ4dx6JLh8n3Q1-DjWJOHM,7098
125
125
  reconcile/aus/ocm_addons_upgrade_scheduler_org.py,sha256=fshslI27hrqT40qrVsVOQaWxD-jkmzcVZryXzX7plhY,8960
126
126
  reconcile/aus/ocm_upgrade_scheduler.py,sha256=7cK2SakCFkl5EdnqUEAYdUo4pUnnf-SsUR10uytAGyE,3058
127
127
  reconcile/aus/ocm_upgrade_scheduler_org.py,sha256=OBgE5mnVdQQV4tMH0AE2V_PDt9Gy6d-LyuPceqjORts,2331
@@ -548,7 +548,7 @@ reconcile/utils/oc_map.py,sha256=nT69J5pdPeIDnIYjD9fwY6GkE3BMQCf-AF0rmHJuUNw,906
548
548
  reconcile/utils/ocm_base_client.py,sha256=UV-tQYrjg9kLYw2NE5nixrWlRz5bhyZsz8Q4WUhvBRA,6096
549
549
  reconcile/utils/openshift_resource.py,sha256=WYLetCNItODjoOVeYqbCaEx_Lv-ntsj6I97x-1o2yAk,25116
550
550
  reconcile/utils/openssl.py,sha256=QVvhzhpChq_4Daf_5wE1qeZJr4thg3DDjJPn4bOPD4E,365
551
- reconcile/utils/output.py,sha256=htcMXMe0y2dNnwu8MW8x0JZ5YBaEJRy5w4tR8yLF0OU,1738
551
+ reconcile/utils/output.py,sha256=4tObxIS_-EdJY_YCOOOmaYvHY40Q72IpYjWhjpJR1Ec,1856
552
552
  reconcile/utils/pagerduty_api.py,sha256=ckZZMn_ri7mUFsmMb8Lejuw5Lf_0-OWv8MbOzPc2zkQ,7567
553
553
  reconcile/utils/parse_dhms_duration.py,sha256=TONpLnec5gHeF7k815YNJpQyDjXhkxZIcv9s8ffbTSY,1840
554
554
  reconcile/utils/password_validator.py,sha256=XwuWg-8CPlcuG7dl_oQ1G1h2gSVSnfMym_VkuprpWVg,2183
@@ -650,8 +650,8 @@ tools/test/test_app_interface_metrics_exporter.py,sha256=SX7qL3D1SIRKFo95FoQztvf
650
650
  tools/test/test_qontract_cli.py,sha256=awwTHEc2DWlykuqGIYM0WOBoSL0KRnOraCLk3C7izis,1401
651
651
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
652
652
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
653
- qontract_reconcile-0.10.1rc478.dist-info/METADATA,sha256=hna64KDMpTcGUWltZpRGgY2cCZVu2V3HmAzSHyRgngE,2348
654
- qontract_reconcile-0.10.1rc478.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
655
- qontract_reconcile-0.10.1rc478.dist-info/entry_points.txt,sha256=rTjAv28I_CHLM8ID3OPqMI_suoQ9s7tFbim4aYjn9kk,376
656
- qontract_reconcile-0.10.1rc478.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
657
- qontract_reconcile-0.10.1rc478.dist-info/RECORD,,
653
+ qontract_reconcile-0.10.1rc480.dist-info/METADATA,sha256=sYbe-Q2S0gZ4HubbppDKF9dOJ541nozJHC35X5d-vzc,2348
654
+ qontract_reconcile-0.10.1rc480.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
655
+ qontract_reconcile-0.10.1rc480.dist-info/entry_points.txt,sha256=rTjAv28I_CHLM8ID3OPqMI_suoQ9s7tFbim4aYjn9kk,376
656
+ qontract_reconcile-0.10.1rc480.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
657
+ qontract_reconcile-0.10.1rc480.dist-info/RECORD,,
reconcile/aus/base.py CHANGED
@@ -720,43 +720,42 @@ def version_conditions_met(
720
720
  return True
721
721
 
722
722
 
723
+ def gates_for_minor_version(
724
+ gates: list[OCMVersionGate],
725
+ target_version_prefix: str,
726
+ ) -> list[OCMVersionGate]:
727
+ return [g for g in gates if g.version_raw_id_prefix == target_version_prefix]
728
+
729
+
723
730
  def gates_to_agree(
724
731
  gates: list[OCMVersionGate],
725
- version_prefix: str,
726
- cluster: OCMCluster,
732
+ cluster_id: str,
727
733
  ocm_api: OCMBaseClient,
728
734
  ) -> list[OCMVersionGate]:
729
735
  """Check via OCM if a version is agreed
730
736
 
731
737
  Args:
732
- gates: list of OCMVersionGate objects
733
- version_prefix (string): major.minor version prefix
734
- cluster (string)
735
- cluster_version (string): current version of the cluster
736
- sts (bool): is the cluster a STS cluster
738
+ gates (OCMVersionGate): list of OCMVersionGate objects to check for agreements
739
+ cluster_id (str): the cluster that needs gate agreements
737
740
  ocm_api (OCMBaseClient): used to fetch infos from OCM
738
741
 
739
742
  Returns:
740
- list[OCMVersionGate]: list of gates to agree
743
+ list[OCMVersionGate]: list of gates a cluster has not agreed on yet
741
744
  """
742
- semver_cluster = parse_semver(f"{cluster.version.raw_id}")
743
-
744
745
  applicable_gates = [
745
746
  g
746
747
  for g in gates
747
- if g.version_raw_id_prefix == version_prefix
748
748
  # todo: sts version gates need special handling - https://issues.redhat.com/browse/APPSRE-7949
749
749
  # until this is solved, we can't do automated upgrades for STS clusters that cross a version gate
750
750
  # once we have proper and secure handling get gate agreements for STS clusters, we can use this condition:
751
751
  # `and (not g.sts_only or g.sts_only == cluster.is_sts())`
752
- and not g.sts_only
753
- and semver_cluster.match(f"<{g.version_raw_id_prefix}.0")
752
+ if not g.sts_only
754
753
  ]
755
754
 
756
755
  if applicable_gates:
757
756
  current_agreements = {
758
757
  agreement["version_gate"]["id"]
759
- for agreement in get_version_agreement(ocm_api, cluster.id)
758
+ for agreement in get_version_agreement(ocm_api, cluster_id)
760
759
  }
761
760
  return [gate for gate in applicable_gates if gate.id not in current_agreements]
762
761
  return []
@@ -1002,6 +1001,22 @@ def calculate_diff(
1002
1001
  )
1003
1002
  )
1004
1003
  else:
1004
+ target_version_prefix = get_version_prefix(version)
1005
+ minor_version_gates = gates_for_minor_version(
1006
+ gates, target_version_prefix
1007
+ )
1008
+ # skipping upgrades when there are no version gates is a safety
1009
+ # precaution to prevent cluster upgrades being scheduled.
1010
+ # missing version gates are an indicator that the version has not yet gone
1011
+ # through SREP gap analysis and is not yet ready for upgrades.
1012
+ #
1013
+ # this might change in the future - revisite for 4.16
1014
+ if not minor_version_gates:
1015
+ logging.debug(
1016
+ f"[{spec.org.org_id}/{spec.cluster.name}] no gates found for {target_version_prefix}. "
1017
+ "Skip creation of an upgrade policy."
1018
+ )
1019
+ continue
1005
1020
  diffs.append(
1006
1021
  UpgradePolicyHandler(
1007
1022
  action="create",
@@ -1009,9 +1024,8 @@ def calculate_diff(
1009
1024
  gates_to_agree=[
1010
1025
  GateAgreement(gate=g)
1011
1026
  for g in gates_to_agree(
1012
- gates,
1013
- get_version_prefix(version),
1014
- spec.cluster,
1027
+ minor_version_gates,
1028
+ spec.cluster.id,
1015
1029
  ocm_api,
1016
1030
  )
1017
1031
  ],
reconcile/aus/models.py CHANGED
@@ -133,9 +133,14 @@ class OrganizationUpgradeSpec(BaseModel):
133
133
  # add clusters to their sectors
134
134
  if spec.upgrade_policy.conditions.sector:
135
135
  if spec.upgrade_policy.conditions.sector not in self._sectors:
136
- raise ValueError(
136
+ self.add_organization_error(
137
137
  f"sector {spec.upgrade_policy.conditions.sector} not found in organization"
138
138
  )
139
+ self.add_cluster_error(
140
+ spec.cluster_uuid,
141
+ f"cluster {spec.cluster_uuid} references unknown sector {spec.upgrade_policy.conditions.sector}",
142
+ )
143
+ return
139
144
  self._sectors[spec.upgrade_policy.conditions.sector].add_spec(spec)
140
145
  self._specs.append(spec)
141
146
  self._specs.sort(key=upgrade_spec_sort_key)
reconcile/utils/output.py CHANGED
@@ -53,6 +53,8 @@ def format_table(content, columns, table_format="simple") -> str:
53
53
  cell = "<br />".join(cell)
54
54
  else:
55
55
  cell = "\n".join(cell)
56
+ if table_format == "github" and isinstance(cell, str):
57
+ cell = cell.replace("|", "&#124;")
56
58
  row_data.append(cell)
57
59
  table_data.append(row_data)
58
60
  return tabulate(table_data, headers=headers, tablefmt=table_format)