qontract-reconcile 0.10.1rc748__py3-none-any.whl → 0.10.1rc750__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.1rc748
3
+ Version: 0.10.1rc750
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
@@ -109,7 +109,7 @@ reconcile/sql_query.py,sha256=zZkihfI-f0JjMez9A83HGTlVwqqbkP8lLjRg-z7sOUU,25878
109
109
  reconcile/status.py,sha256=cY4IJFXemhxptRJqR4qaaOWqei9e4jgLXuVSGajMsjg,544
110
110
  reconcile/status_board.py,sha256=nA74_133jukxVShjPKJpkXOA3vggDTTEhYTegoXbN1M,8632
111
111
  reconcile/terraform_aws_route53.py,sha256=R8eZHlvP368nvtmLd_cMSK3RGxD7jso9qE7NP92iniU,9986
112
- reconcile/terraform_cloudflare_dns.py,sha256=auU4bzeLwd4S8D8oqpqJbrCUoEdELXrgi7vHOedjYFk,13332
112
+ reconcile/terraform_cloudflare_dns.py,sha256=MZO3_2Hb0BhNkOTWIm2UHvR-SPKvLsk2l_fHNk4WOrk,13471
113
113
  reconcile/terraform_cloudflare_resources.py,sha256=EbQQaoDnZ7brvRCpbFtwlD7KLk2hDVNcjhrJGaAywEk,15023
114
114
  reconcile/terraform_cloudflare_users.py,sha256=1EbTHwJgiPkJpMP-Ag340QNgGK3mXn3dcC3DpLakudM,13987
115
115
  reconcile/terraform_repo.py,sha256=tQkMUEDEB6QfuWYwiW7H-NnX4SHxYK7mLZYZffKj-hE,16301
@@ -122,7 +122,7 @@ reconcile/vpc_peerings_validator.py,sha256=Kv22HJVlTW9l9GB2eXwjPWqdDbr_VuvQBNPtt
122
122
  reconcile/aus/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
123
123
  reconcile/aus/advanced_upgrade_service.py,sha256=MPqcWpq1QeYzBsB8rtTlo102h_cR_q83oOYtWAncuAk,22391
124
124
  reconcile/aus/aus_label_source.py,sha256=qoP8Fgxuu1tCuhG6ixCWve7Ll-KD6a79E2uLAmC0ifw,4184
125
- reconcile/aus/base.py,sha256=4VTHqc22IW1xyLCgxhUrSBDRsaF99RW3uzoQafTQDN4,49410
125
+ reconcile/aus/base.py,sha256=RqFUwH2xiWFN1U6plp-UG77iFkK60b8YKODsD4YWWyc,49880
126
126
  reconcile/aus/cluster_version_data.py,sha256=j4UyEBi5mQuvPq5Lo7a_L_0blxvH790wJV07uAiikFU,7126
127
127
  reconcile/aus/healthchecks.py,sha256=S8_KPn_zFiOo_wf5XlVmz-I3tUDYAim3EGSqiSPMvLQ,2707
128
128
  reconcile/aus/metrics.py,sha256=nKT4m2zGT-QOMR0c-z-npVNKWsNMubzdffpU_f9n4II,3927
@@ -715,8 +715,8 @@ reconcile/utils/mr/ocm_update_recommended_version.py,sha256=p_aVP0TGrlKk9WBwgQnY
715
715
  reconcile/utils/mr/ocm_upgrade_scheduler_org_updates.py,sha256=RzEKRT_BhvB2ud9pyNFZ1cNZFmDGBUah9vjpP0y9f9w,2810
716
716
  reconcile/utils/mr/user_maintenance.py,sha256=cHPBn8zrReWLHalyk-EFdkFJe9zjVjRoZhT4t2zZfGE,3956
717
717
  reconcile/utils/ocm/__init__.py,sha256=xv7CJp7K9LCQfa4gL_W0MMCOD1P4qOy8t5aZj1xXNUE,808
718
- reconcile/utils/ocm/addons.py,sha256=swWSOPbLprbxhmt8jd4hH5y3xeWF78y8hk9o4rfIXms,6890
719
- reconcile/utils/ocm/base.py,sha256=GclZtCrPkPJmGP9HHvqIlV-8VXSKuaQTQJkA2pklN60,13817
718
+ reconcile/utils/ocm/addons.py,sha256=IHlqOO12TAdYwwU6Oedz3ussF1kELj9EI5GxPP6LKi8,7376
719
+ reconcile/utils/ocm/base.py,sha256=sdcINGBy1FlotY0MZuVC--Yn3zcYDn_N33ownMD8SQE,14030
720
720
  reconcile/utils/ocm/cluster_groups.py,sha256=F8oqVqN_4QUnGL0K61zZhoYIzJeP57EcmZpwmoV0mr4,1751
721
721
  reconcile/utils/ocm/clusters.py,sha256=Nw9m-jgN3GHHCh6w9UOBbMV4rtS24_-Ep09jAWQ-_fE,7653
722
722
  reconcile/utils/ocm/identity_providers.py,sha256=dKed09N8iWmn39tI_MpwgVe47x23eLsknGbjMUxtwr4,2175
@@ -778,8 +778,8 @@ tools/test/test_app_interface_metrics_exporter.py,sha256=SX7qL3D1SIRKFo95FoQztvf
778
778
  tools/test/test_qontract_cli.py,sha256=w2l4BHB09k1d-BGJ1jBUNCqDv7zkqYrMHojQXg-21kQ,4155
779
779
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
780
780
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
781
- qontract_reconcile-0.10.1rc748.dist-info/METADATA,sha256=ceTfijoo-x5F6mo0WQjXgfkmBWkj6OvaecXkCj0R2-I,2382
782
- qontract_reconcile-0.10.1rc748.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
783
- qontract_reconcile-0.10.1rc748.dist-info/entry_points.txt,sha256=rIxI5zWtHNlfpDeq1a7pZXAPoqf7HG32KMTN3MeWK_8,429
784
- qontract_reconcile-0.10.1rc748.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
785
- qontract_reconcile-0.10.1rc748.dist-info/RECORD,,
781
+ qontract_reconcile-0.10.1rc750.dist-info/METADATA,sha256=OjuBqPZe4yfGlnEFvZcd-EipJpq4RxRDY6wrvn-_sQU,2382
782
+ qontract_reconcile-0.10.1rc750.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
783
+ qontract_reconcile-0.10.1rc750.dist-info/entry_points.txt,sha256=rIxI5zWtHNlfpDeq1a7pZXAPoqf7HG32KMTN3MeWK_8,429
784
+ qontract_reconcile-0.10.1rc750.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
785
+ qontract_reconcile-0.10.1rc750.dist-info/RECORD,,
reconcile/aus/base.py CHANGED
@@ -587,13 +587,22 @@ def fetch_current_state(
587
587
  for spec in org_upgrade_spec.specs:
588
588
  if addons and isinstance(spec, ClusterAddonUpgradeSpec):
589
589
  addon_spec = cast(ClusterAddonUpgradeSpec, spec)
590
- upgrade_policies = addon_service.get_addon_upgrade_policies(
590
+ addon_upgrade_policies = addon_service.get_addon_upgrade_policies(
591
591
  ocm_api, spec.cluster.id, addon_id=addon_spec.addon.addon.id
592
592
  )
593
- for upgrade_policy in upgrade_policies:
594
- upgrade_policy["cluster"] = spec.cluster
593
+ for addon_upgrade_policy in addon_upgrade_policies:
595
594
  current_state.append(
596
- AddonUpgradePolicy(**upgrade_policy, addon_service=addon_service)
595
+ AddonUpgradePolicy(
596
+ id=addon_upgrade_policy.id,
597
+ addon_id=addon_spec.addon.addon.id,
598
+ cluster=spec.cluster,
599
+ next_run=addon_upgrade_policy.next_run,
600
+ schedule=addon_upgrade_policy.schedule,
601
+ schedule_type=addon_upgrade_policy.schedule_type,
602
+ version=addon_upgrade_policy.version,
603
+ state=addon_upgrade_policy.state,
604
+ addon_service=addon_service,
605
+ )
597
606
  )
598
607
  elif spec.cluster.is_rosa_hypershift():
599
608
  upgrade_policies = get_control_plane_upgrade_policies(
@@ -10,6 +10,8 @@ from typing import (
10
10
  Sequence,
11
11
  )
12
12
 
13
+ from deepdiff import DeepHash
14
+
13
15
  from reconcile.gql_definitions.terraform_cloudflare_dns import (
14
16
  app_interface_cloudflare_dns_settings,
15
17
  terraform_cloudflare_zones,
@@ -204,13 +206,17 @@ class TerraformCloudflareDNSIntegration(
204
206
  ) -> dict[str, Any]:
205
207
  desired_state = self._get_cloudflare_desired_state()
206
208
 
207
- # return {"zones":desired_state.zones}
208
- return desired_state.dict()
209
+ return {
210
+ "state": {
211
+ z.identifier: {"shard": z.identifier, "hash": DeepHash(z).get(z)}
212
+ for z in desired_state.zones or []
213
+ }
214
+ }
209
215
 
210
216
  def get_desired_state_shard_config(self) -> DesiredStateShardConfig:
211
217
  return DesiredStateShardConfig(
212
218
  shard_arg_name="selected_zone",
213
- shard_path_selectors={"zones[*].identifier"},
219
+ shard_path_selectors={"state.*.shard"},
214
220
  sharded_run_review=lambda proposal: len(proposal.proposed_shards) <= 2,
215
221
  )
216
222
 
@@ -3,18 +3,12 @@ from typing import (
3
3
  Optional,
4
4
  )
5
5
 
6
- from reconcile.utils.ocm.base import OCMAddonInstallation
6
+ from reconcile.utils.ocm.base import (
7
+ OCMAddonInstallation,
8
+ OCMAddonUpgradePolicy,
9
+ )
7
10
  from reconcile.utils.ocm_base_client import OCMBaseClient
8
11
 
9
- ADDON_UPGRADE_POLICY_DESIRED_KEYS = {
10
- "id",
11
- "addon_id",
12
- "schedule_type",
13
- "schedule",
14
- "next_run",
15
- "version",
16
- }
17
-
18
12
 
19
13
  class AddonService:
20
14
  def get_addon_latest_versions(self, ocm_api: OCMBaseClient) -> dict[str, str]:
@@ -65,7 +59,7 @@ class AddonService:
65
59
 
66
60
  def get_addon_upgrade_policies(
67
61
  self, ocm_api: OCMBaseClient, cluster_id: str, addon_id: Optional[str] = None
68
- ) -> list[dict[str, Any]]:
62
+ ) -> list[OCMAddonUpgradePolicy]:
69
63
  raise NotImplementedError()
70
64
 
71
65
  def create_addon_upgrade_policy(
@@ -95,23 +89,30 @@ class AddonServiceV1(AddonService):
95
89
 
96
90
  def get_addon_upgrade_policies(
97
91
  self, ocm_api: OCMBaseClient, cluster_id: str, addon_id: Optional[str] = None
98
- ) -> list[dict[str, Any]]:
99
- results: list[dict[str, Any]] = []
92
+ ) -> list[OCMAddonUpgradePolicy]:
93
+ results: list[OCMAddonUpgradePolicy] = []
100
94
 
101
95
  for policy in ocm_api.get_paginated(
102
96
  f"{self.addon_base_api_path()}/clusters/{cluster_id}/addon_upgrade_policies"
103
97
  ):
104
98
  if addon_id and policy["addon_id"] != addon_id:
105
99
  continue
106
- policy_data = {
107
- k: v
108
- for k, v in policy.items()
109
- if k in ADDON_UPGRADE_POLICY_DESIRED_KEYS
110
- }
111
- policy_data["state"] = self._get_addon_upgrade_policy_state(
100
+
101
+ state = self._get_addon_upgrade_policy_state(
112
102
  ocm_api, cluster_id, policy["id"]
113
103
  )
114
- results.append(policy_data)
104
+ results.append(
105
+ OCMAddonUpgradePolicy(
106
+ id=policy["id"],
107
+ addon_id=addon_id,
108
+ cluster_id=cluster_id,
109
+ schedule_type=policy["schedule_type"],
110
+ schedule=policy.get("schedule"),
111
+ next_run=policy.get("next_run"),
112
+ version=policy["version"],
113
+ state=state,
114
+ )
115
+ )
115
116
 
116
117
  return results
117
118
 
@@ -171,20 +172,28 @@ class AddonServiceV2(AddonService):
171
172
 
172
173
  def get_addon_upgrade_policies(
173
174
  self, ocm_api: OCMBaseClient, cluster_id: str, addon_id: Optional[str] = None
174
- ) -> list[dict[str, Any]]:
175
- results: list[dict[str, Any]] = []
175
+ ) -> list[OCMAddonUpgradePolicy]:
176
+ results: list[OCMAddonUpgradePolicy] = []
176
177
 
177
178
  for policy in ocm_api.get_paginated(
178
179
  f"{self.addon_base_api_path()}/clusters/{cluster_id}/upgrade_plans"
179
180
  ):
180
181
  if addon_id and policy["addon_id"] != addon_id:
181
182
  continue
182
- policy_data = {
183
- k: v
184
- for k, v in policy.items()
185
- if k in ADDON_UPGRADE_POLICY_DESIRED_KEYS
186
- }
187
- results.append(policy_data)
183
+
184
+ results.append(
185
+ OCMAddonUpgradePolicy(
186
+ id=policy["id"],
187
+ addon_id=addon_id,
188
+ cluster_id=cluster_id,
189
+ schedule_type=policy["type"],
190
+ schedule=policy.get("schedule"),
191
+ next_run=policy.get("next_run"),
192
+ version=policy["version"],
193
+ state=policy.get("state"),
194
+ addon_service=self,
195
+ )
196
+ )
188
197
 
189
198
  return results
190
199
 
@@ -575,6 +575,17 @@ class OCMOIdentityProviderOidc(OCMOIdentityProvider):
575
575
  return self.name == other.name and self.open_id == other.open_id
576
576
 
577
577
 
578
+ class OCMAddonUpgradePolicy(BaseModel):
579
+ id: str
580
+ addon_id: str
581
+ cluster_id: str
582
+ next_run: Optional[str]
583
+ schedule: Optional[str]
584
+ schedule_type: str
585
+ version: str
586
+ state: Optional[str]
587
+
588
+
578
589
  def build_label_container(
579
590
  *label_iterables: Optional[Iterable[OCMLabel]],
580
591
  ) -> LabelContainer: