qontract-reconcile 0.10.1rc32__py3-none-any.whl → 0.10.1rc33__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.1rc32
3
+ Version: 0.10.1rc33
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
@@ -84,7 +84,7 @@ reconcile/openshift_saas_deploy_trigger_moving_commits.py,sha256=VqjwgRhA-yOSq0W
84
84
  reconcile/openshift_saas_deploy_trigger_upstream_jobs.py,sha256=etfBGj7GDXTOhNHKc40ee5QM0Chq3oHE40HrbWgopc8,971
85
85
  reconcile/openshift_serviceaccount_tokens.py,sha256=UlBRjfAxzf9-h4uxQwHqrYnBWMUGFqqfp6KvW2lM76k,6369
86
86
  reconcile/openshift_tekton_resources.py,sha256=2BiTYkJqMqqrOdI6jxhLvTJQNWCeWpgxaz1v2LzU-Eo,13558
87
- reconcile/openshift_upgrade_watcher.py,sha256=B4WevVcOzzcE6I3HMUjFX4m9NUikrHRijGWDm-om7WE,4833
87
+ reconcile/openshift_upgrade_watcher.py,sha256=CEixqF9vNMo0Igfgt3x5d5fzm2vH5ZhoiWaODG4__XU,4886
88
88
  reconcile/openshift_users.py,sha256=dKWS3AVmgMKcblafHYz1pLVnTOp1ZzfePGQCaTpVc_8,5213
89
89
  reconcile/openshift_vault_secrets.py,sha256=Hy6pVWLsbEjxvn4S1k1zacbM447i5uDdyeT263-bNOI,1562
90
90
  reconcile/prometheus_rules_tester_old.py,sha256=YftjUxePvxrcZLRbOhenVTIqbDoyNyMFJodMbb5orrA,14385
@@ -120,10 +120,10 @@ reconcile/vault_replication.py,sha256=xobxnsOfUcwvdQ-RZ7JH_sZCDh8rpEY7MJ36nkvfFq
120
120
  reconcile/vpc_peerings_validator.py,sha256=10igLYTQpBMGXO9mTO7sJBzgr4jXQ2hf1OH5r5DKugE,3586
121
121
  reconcile/aus/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
122
122
  reconcile/aus/advanced_upgrade_service.py,sha256=O2LDgMbFYKsNuflh8b80sIr59WpJwFHSCeZtacMA6Kg,810
123
- reconcile/aus/base.py,sha256=6tZLndQNhKUplSvjc9n3BIXVFjvOIwZX_6VCWTHY4MI,27632
123
+ reconcile/aus/base.py,sha256=BTtDuwp4XuBkQv_4nbQbDP3ApvtaXiF9EORpF4CjNhs,25396
124
124
  reconcile/aus/models.py,sha256=iPdJCd0bJc1FInZWyGWr6hPCabcowLld2__efzUGFtA,3495
125
125
  reconcile/aus/ocm_addons_upgrade_scheduler_org.py,sha256=vjZM7lNGR2b2phKhimdOw6E1MccRGyXe87oMgn_R4dA,6029
126
- reconcile/aus/ocm_upgrade_scheduler.py,sha256=wkItEEuU16t5vP5-OvwZwah0tDCmABbLgV4rWRnYYXU,3401
126
+ reconcile/aus/ocm_upgrade_scheduler.py,sha256=4K5FgjI9xV4KziSSs1MIXUrq1tNWhkihOMaIwMr5gqM,3361
127
127
  reconcile/aus/ocm_upgrade_scheduler_org.py,sha256=Ye0eNWNWWn2UecbofO275xMrZpSiqD0JUFlERGU_05w,1484
128
128
  reconcile/change_owners/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
129
129
  reconcile/change_owners/approver.py,sha256=L7XJWJ-rgn8BOmeMb6lBDV8lHFCUaNoHGDSD7OH03vA,2244
@@ -318,7 +318,7 @@ reconcile/test/test_ocm_clusters.py,sha256=R5evfzLWCzHQKywDV5XOXcx9P6lpAXNAmFkkG
318
318
  reconcile/test/test_ocm_clusters_manifest_updates.py,sha256=SkHsWj8FZjOkigUky3IgiEswLqMzHJyRg7qPeALp8p0,3330
319
319
  reconcile/test/test_ocm_oidc_idp.py,sha256=np2QUFzI8rR1LBy-eKtHtUpkvyM3lLkqKgc9SAlHzXQ,10351
320
320
  reconcile/test/test_ocm_update_recommended_version.py,sha256=ONY3slwUHwEdonvIYRI2Z8nWPDMTSSLGZ2I1dqaz7fg,4328
321
- reconcile/test/test_ocm_upgrade_scheduler.py,sha256=kyIg5MlDgod_ut-SUvf001O3gocVr6XMY3j0cxetJl8,29073
321
+ reconcile/test/test_ocm_upgrade_scheduler.py,sha256=gAHSBVOt1ul3mpXUrLu9QePnOe4za_VjByYDexolGbQ,28181
322
322
  reconcile/test/test_ocm_upgrade_scheduler_org_updater.py,sha256=zYRGUX7pAmxSv9oFYw2ZnPGa-YAPgDfmqXOJM4eE-8A,4353
323
323
  reconcile/test/test_openshift_base.py,sha256=8GF4Z1dutnjySMqFN03DHTx03y3UDsW724zgZ7djibE,19345
324
324
  reconcile/test/test_openshift_namespace_labels.py,sha256=P1hqi6P88NijNrurdXG_QR2usyo3EYZSy9zpwYHvDsM,12104
@@ -536,7 +536,7 @@ reconcile/utils/ocm/base.py,sha256=8pCZB_V6pZhc-qZQFTuIr1kM5nxrzz9kT86-DW3rgq0,1
536
536
  reconcile/utils/ocm/cluster_groups.py,sha256=TBb3mIzw68BHBcCzacmAN8IsNPo8FfOnTMphuctwuU0,2679
537
537
  reconcile/utils/ocm/clusters.py,sha256=FkkiTSG6Ec0eDWvf0tFF2RVmAG4bZY4sX4WwNF9tKDU,7174
538
538
  reconcile/utils/ocm/labels.py,sha256=UqpbJ0HGPHVcooDeKcihnU70NihKz4_BAb480XUk5_U,2986
539
- reconcile/utils/ocm/ocm.py,sha256=hjwFZ_HzhYeNVTc3ewTrRR4Uxr-nvlpqWbN3kglxqek,66331
539
+ reconcile/utils/ocm/ocm.py,sha256=pp-T6cT0RQf91oqrWFm5QSd_LyH8n5gJmPaetDtMioI,64455
540
540
  reconcile/utils/ocm/search_filters.py,sha256=zExZpYBh7_tucG-xKoPHUxz1b_6l9qwbEMpMihQg7nA,15043
541
541
  reconcile/utils/ocm/service_log.py,sha256=g6eQTfjdBg3aMOK2JalQ4zNJocgNJdI62XcyVfL3cBQ,2592
542
542
  reconcile/utils/ocm/subscriptions.py,sha256=kuHster01yLy0_s5DWFLXh9zse3NIpbGTuKW78q_b90,2322
@@ -574,8 +574,8 @@ tools/sre_checkpoints/util.py,sha256=zEDbGr18ZeHNQwW8pUsr2JRjuXIPz--WAGJxZo9sv_Y
574
574
  tools/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
575
575
  tools/test/test_qontract_cli.py,sha256=awwTHEc2DWlykuqGIYM0WOBoSL0KRnOraCLk3C7izis,1401
576
576
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
577
- qontract_reconcile-0.10.1rc32.dist-info/METADATA,sha256=T1H3ivhtOaK-yHLP6dXLUEcNEyXUfaR0YO6ofBUAkY8,2288
578
- qontract_reconcile-0.10.1rc32.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
579
- qontract_reconcile-0.10.1rc32.dist-info/entry_points.txt,sha256=Af70EWPJxsTiCNF6gA-pWdw1A0Heqn-PZF-oBc5NmiU,302
580
- qontract_reconcile-0.10.1rc32.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
581
- qontract_reconcile-0.10.1rc32.dist-info/RECORD,,
577
+ qontract_reconcile-0.10.1rc33.dist-info/METADATA,sha256=IAKI89TDY__fE_Hh9m-1DYk41-WyYP3u083eOnU5160,2288
578
+ qontract_reconcile-0.10.1rc33.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
579
+ qontract_reconcile-0.10.1rc33.dist-info/entry_points.txt,sha256=Af70EWPJxsTiCNF6gA-pWdw1A0Heqn-PZF-oBc5NmiU,302
580
+ qontract_reconcile-0.10.1rc33.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
581
+ qontract_reconcile-0.10.1rc33.dist-info/RECORD,,
reconcile/aus/base.py CHANGED
@@ -169,40 +169,27 @@ class AddonUpgradePolicy(AbstractUpgradePolicy):
169
169
  class ClusterUpgradePolicy(AbstractUpgradePolicy):
170
170
  """Class to create and delete ClusterUpgradePolicies in OCM"""
171
171
 
172
- def create(self, ocm: OCM) -> None:
173
- policy = {
174
- "version": self.version,
175
- "schedule_type": "manual",
176
- "next_run": self.next_run,
177
- }
178
- ocm.create_control_plane_upgrade_policy(self.cluster, policy)
179
-
180
- def delete(self, ocm: OCM) -> None:
181
- item = {
182
- "id": self.id,
183
- }
184
- ocm.delete_control_plane_upgrade_policy(self.cluster, item)
185
-
172
+ gates_to_agree: Optional[list[GateAgreement]]
186
173
 
187
- class ControlPlaneUpgradePolicy(AbstractUpgradePolicy):
188
- """Class to create and delete ControlPlanUpgradePolicies in OCM"""
174
+ def _create_gate_agreements(self, ocm: OCM) -> None:
175
+ for gate in self.gates_to_agree or []:
176
+ gate.create(ocm, self.cluster)
189
177
 
190
178
  def create(self, ocm: OCM) -> None:
179
+ self._create_gate_agreements(ocm)
191
180
  policy = {
192
181
  "version": self.version,
193
182
  "schedule_type": "manual",
194
- "upgrade_type": "ControlPlane",
195
- "cluster_id": ocm.cluster_ids[self.cluster],
196
183
  "next_run": self.next_run,
197
184
  }
198
- ocm.create_control_plane_upgrade_policy(self.cluster, policy)
185
+ ocm.create_upgrade_policy(self.cluster, policy)
199
186
 
200
187
  def delete(self, ocm: OCM) -> None:
201
188
  item = {
202
189
  "version": self.version,
203
190
  "id": self.id,
204
191
  }
205
- ocm.delete_control_plane_upgrade_policy(self.cluster, item)
192
+ ocm.delete_upgrade_policy(self.cluster, item)
206
193
 
207
194
 
208
195
  class UpgradePolicyHandler(BaseModel):
@@ -211,12 +198,6 @@ class UpgradePolicyHandler(BaseModel):
211
198
  action: str
212
199
  policy: AbstractUpgradePolicy
213
200
 
214
- gates_to_agree: Optional[list[GateAgreement]]
215
-
216
- def _create_gate_agreements(self, ocm: OCM) -> None:
217
- for gate in self.gates_to_agree or []:
218
- gate.create(ocm, self.policy.cluster)
219
-
220
201
  def act(self, dry_run: bool, ocm: OCM) -> None:
221
202
  action_log(
222
203
  self.action,
@@ -233,7 +214,6 @@ class UpgradePolicyHandler(BaseModel):
233
214
  elif self.action == "delete":
234
215
  self.policy.delete(ocm)
235
216
  elif self.action == "create":
236
- self._create_gate_agreements(ocm)
237
217
  self.policy.create(ocm)
238
218
 
239
219
 
@@ -243,21 +223,12 @@ def fetch_current_state(
243
223
  current_state: list[AbstractUpgradePolicy] = []
244
224
  for cluster in clusters:
245
225
  cluster_name = cluster.name
246
- cluster_spec = ocm_map.get(cluster_name).clusters.get(cluster_name)
247
- if cluster_spec:
248
- # None is fine, we only care if hypershift is true
249
- is_hypershift = cluster_spec.spec.hypershift
250
226
  ocm = ocm_map.get(cluster_name)
251
227
  if addons:
252
228
  upgrade_policies = ocm.get_addon_upgrade_policies(cluster_name)
253
229
  for upgrade_policy in upgrade_policies:
254
230
  upgrade_policy["cluster"] = cluster_name
255
231
  current_state.append(AddonUpgradePolicy(**upgrade_policy))
256
- elif is_hypershift:
257
- upgrade_policies = ocm.get_control_plan_upgrade_policies(cluster_name)
258
- for upgrade_policy in upgrade_policies:
259
- upgrade_policy["cluster"] = cluster_name
260
- current_state.append(ControlPlaneUpgradePolicy(**upgrade_policy))
261
232
  else:
262
233
  upgrade_policies = ocm.get_upgrade_policies(cluster_name)
263
234
  for upgrade_policy in upgrade_policies:
@@ -694,10 +665,6 @@ def calculate_diff(
694
665
  if verify_lock_should_skip(p, locked, ocm, p.cluster):
695
666
  continue
696
667
 
697
- cluster = ocm.clusters.get(p.cluster)
698
- if not cluster:
699
- continue
700
-
701
668
  upgrades = get_upgrades(addon_id, p, ocm)
702
669
  version = upgradeable_version(p, version_data_map, ocm, upgrades, addon_id)
703
670
  if version:
@@ -717,30 +684,6 @@ def calculate_diff(
717
684
  ),
718
685
  )
719
686
  )
720
- elif cluster.spec.hypershift:
721
- diffs.append(
722
- UpgradePolicyHandler(
723
- action="create",
724
- policy=ControlPlaneUpgradePolicy(
725
- **{
726
- "action": "create",
727
- "cluster": p.cluster,
728
- "version": version,
729
- "schedule_type": "manual",
730
- "next_run": next_schedule,
731
- }
732
- ),
733
- gates_to_agree=[
734
- GateAgreement(id=g)
735
- for g in gates_to_agree(
736
- get_version_prefix(version),
737
- p.cluster,
738
- p.current_version,
739
- ocm,
740
- )
741
- ],
742
- )
743
- )
744
687
  else:
745
688
  diffs.append(
746
689
  UpgradePolicyHandler(
@@ -752,17 +695,17 @@ def calculate_diff(
752
695
  "version": version,
753
696
  "schedule_type": "manual",
754
697
  "next_run": next_schedule,
698
+ "gates_to_agree": [
699
+ GateAgreement(id=g)
700
+ for g in gates_to_agree(
701
+ get_version_prefix(version),
702
+ p.cluster,
703
+ p.current_version,
704
+ ocm,
705
+ )
706
+ ],
755
707
  }
756
708
  ),
757
- gates_to_agree=[
758
- GateAgreement(id=g)
759
- for g in gates_to_agree(
760
- get_version_prefix(version),
761
- p.cluster,
762
- p.current_version,
763
- ocm,
764
- )
765
- ],
766
709
  )
767
710
  )
768
711
 
@@ -15,12 +15,11 @@ from reconcile.utils import gql
15
15
  from reconcile.utils.disabled_integrations import integration_is_enabled
16
16
  from reconcile.utils.ocm import (
17
17
  OCM_PRODUCT_OSD,
18
- OCM_PRODUCT_ROSA,
19
18
  OCMMap,
20
19
  )
21
20
 
22
21
  QONTRACT_INTEGRATION = "ocm-upgrade-scheduler"
23
- SUPPORTED_OCM_PRODUCTS = [OCM_PRODUCT_OSD, OCM_PRODUCT_ROSA]
22
+ SUPPORTED_OCM_PRODUCTS = [OCM_PRODUCT_OSD]
24
23
 
25
24
 
26
25
  class OCMClusterUpgradeSchedulerIntegration(
@@ -127,7 +127,9 @@ def run(
127
127
  if defer:
128
128
  defer(state.cleanup)
129
129
 
130
- clusters = [c for c in get_clusters() if c.ocm]
130
+ clusters = [
131
+ c for c in get_clusters() if c.ocm and not (c.spec and c.spec.hypershift)
132
+ ]
131
133
 
132
134
  slack: Optional[SlackApi] = None
133
135
  if not dry_run:
@@ -6,7 +6,6 @@ from typing import Any
6
6
  from unittest import TestCase
7
7
  from unittest.mock import (
8
8
  Mock,
9
- NonCallableMagicMock,
10
9
  patch,
11
10
  )
12
11
 
@@ -220,10 +219,10 @@ class TestUpgradeLock:
220
219
  "cluster": "cluster1",
221
220
  "version": "4.3.6",
222
221
  "schedule_type": "manual",
222
+ "gates_to_agree": [],
223
223
  "next_run": "2021-08-30T19:00:00Z",
224
224
  }
225
225
  ),
226
- gates_to_agree=[],
227
226
  )
228
227
 
229
228
  @patch.object(aus, "datetime", Mock(wraps=datetime))
@@ -672,10 +671,6 @@ class TestCalculateDiff:
672
671
  ocm.get_available_upgrades.return_value = ["4.9.5", "4.10.1"]
673
672
  ocm.addons = [{"id": "addon1", "version": {"id": "4.9.5"}}]
674
673
  ocm.version_blocked.return_value = False
675
- cluster = mocker.patch("reconcile.ocm.types.OCMSpec")
676
- cluster.spec.hypershift = False
677
- ocm = map.get.return_value
678
- ocm.clusters.get.return_value = cluster
679
674
  return map
680
675
 
681
676
  @staticmethod
@@ -750,28 +745,7 @@ class TestCalculateDiff:
750
745
  assert cup.version == "4.9.5"
751
746
  assert cup.schedule_type == "manual"
752
747
  assert isinstance(cup, aus.ClusterUpgradePolicy)
753
- assert x[0].gates_to_agree == []
754
-
755
- def test_calculate_control_plane(
756
- self,
757
- cluster_upgrade_policy: ConfiguredClusterUpgradePolicy,
758
- ocm_map: NonCallableMagicMock,
759
- ):
760
- ocm_map.get.return_value.clusters.get.return_value.spec.hypershift = True
761
-
762
- x = aus.calculate_diff(
763
- [], [cluster_upgrade_policy], ocm_map, self.create_version_data_map()
764
- )
765
-
766
- assert len(x) == 1
767
- cup = x[0].policy
768
-
769
- assert x[0].action == "create"
770
- assert cup.cluster == "cluster1"
771
- assert cup.version == "4.9.5"
772
- assert cup.schedule_type == "manual"
773
- assert isinstance(cup, aus.ControlPlaneUpgradePolicy)
774
- assert x[0].gates_to_agree == []
748
+ assert cup.gates_to_agree == []
775
749
 
776
750
  def test_calculate_not_soaked(
777
751
  self, cluster_upgrade_policy: ConfiguredClusterUpgradePolicy, ocm_map: OCMMap
@@ -1174,33 +1174,6 @@ class OCM: # pylint: disable=too-many-public-methods
1174
1174
  api = f"{CS_API_BASE}/v1/versions/{version_id}"
1175
1175
  return self._get_json(api).get("available_upgrades", [])
1176
1176
 
1177
- def get_control_plan_upgrade_policies(
1178
- self, cluster, schedule_type=None
1179
- ) -> list[dict[str, Any]]:
1180
- """Returns a list of details of Upgrade Policies
1181
-
1182
- :param cluster: cluster name
1183
-
1184
- :type cluster: string
1185
- """
1186
- results: list[dict[str, Any]] = []
1187
- cluster_id = self.cluster_ids.get(cluster)
1188
- if not cluster_id:
1189
- return results
1190
-
1191
- api = f"{CS_API_BASE}/v1/clusters/{cluster_id}/control_plane/upgrade_policies"
1192
- items = self._get_json(api).get("items")
1193
- if not items:
1194
- return results
1195
-
1196
- for item in items:
1197
- if schedule_type and item["schedule_type"] != schedule_type:
1198
- continue
1199
- result = {k: v for k, v in item.items() if k in UPGRADE_POLICY_DESIRED_KEYS}
1200
- results.append(result)
1201
-
1202
- return results
1203
-
1204
1177
  def get_upgrade_policies(self, cluster, schedule_type=None) -> list[dict[str, Any]]:
1205
1178
  """Returns a list of details of Upgrade Policies
1206
1179
 
@@ -1225,19 +1198,6 @@ class OCM: # pylint: disable=too-many-public-methods
1225
1198
 
1226
1199
  return results
1227
1200
 
1228
- def create_control_plane_upgrade_policy(self, cluster, spec):
1229
- """Creates a new Upgrade Policy for the control plane
1230
-
1231
- :param cluster: cluster name
1232
- :param spec: required information for creation
1233
-
1234
- :type cluster: string
1235
- :type spec: dictionary
1236
- """
1237
- cluster_id = self.cluster_ids[cluster]
1238
- api = f"{CS_API_BASE}/v1/clusters/{cluster_id}/control_plane/upgrade_policies"
1239
- self._post(api, spec)
1240
-
1241
1201
  def create_upgrade_policy(self, cluster, spec):
1242
1202
  """Creates a new Upgrade Policy
1243
1203
 
@@ -1251,23 +1211,6 @@ class OCM: # pylint: disable=too-many-public-methods
1251
1211
  api = f"{CS_API_BASE}/v1/clusters/{cluster_id}/upgrade_policies"
1252
1212
  self._post(api, spec)
1253
1213
 
1254
- def delete_control_plane_upgrade_policy(self, cluster, spec):
1255
- """Deletes an existing Control Plane Upgrade Policy
1256
-
1257
- :param cluster: cluster name
1258
- :param spec: required information for update
1259
-
1260
- :type cluster: string
1261
- :type spec: dictionary
1262
- """
1263
- cluster_id = self.cluster_ids[cluster]
1264
- upgrade_policy_id = spec["id"]
1265
- api = (
1266
- f"{CS_API_BASE}/v1/clusters/{cluster_id}/"
1267
- + f"control_plane/upgrade_policies/{upgrade_policy_id}"
1268
- )
1269
- self._delete(api)
1270
-
1271
1214
  def delete_upgrade_policy(self, cluster, spec):
1272
1215
  """Deletes an existing Upgrade Policy
1273
1216