qontract-reconcile 0.10.1rc41__py3-none-any.whl → 0.10.1rc42__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.1rc41
3
+ Version: 0.10.1rc42
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
@@ -7,7 +7,7 @@ reconcile/aws_iam_password_reset.py,sha256=NwErtrqgBiXr7eGCAHdtGGOx0S7-4JnSc29Ie
7
7
  reconcile/aws_support_cases_sos.py,sha256=i6bSWnlH9fh14P14PjVhFLwNl-q3fD733_rXKM_O51c,2992
8
8
  reconcile/blackbox_exporter_endpoint_monitoring.py,sha256=W_VJagnsJR1v5oqjlI3RJJE0_nhtJ0m81RS8zWA5u5c,3538
9
9
  reconcile/checkpoint.py,sha256=figtZRuWUvdpdSnkhAqeGvO5dI02TT6J3heyeFhlwqM,5016
10
- reconcile/cli.py,sha256=bPn61Jm35bH2FZfD2fXj_ITmbK6SdHQZjL-3ixjpBIY,70379
10
+ reconcile/cli.py,sha256=zeNbdiFnF19osDOAoWbnlYHvnVZblcSFGWGiyFKGD-s,70611
11
11
  reconcile/closedbox_endpoint_monitoring_base.py,sha256=0xg_d8dwd36Y8GY1mE-LLO1LQpPEMM77bzAfc_KdgzU,4870
12
12
  reconcile/cluster_deployment_mapper.py,sha256=2Ah-nu-Mdig0pjuiZl_XLrmVAjYzFjORR3dMlCgkmw0,2352
13
13
  reconcile/dashdotdb_base.py,sha256=Ca75-OQiu5HeA8Q6zQpEYuhyCSjeuWe99K4y9ipTORM,4032
@@ -119,8 +119,8 @@ reconcile/unleash_watcher.py,sha256=xNLUFpIr66XESEyXUkmHTTmHghVWHiMtnS_k0OC7gd8,
119
119
  reconcile/vault_replication.py,sha256=xobxnsOfUcwvdQ-RZ7JH_sZCDh8rpEY7MJ36nkvfFqE,17262
120
120
  reconcile/vpc_peerings_validator.py,sha256=10igLYTQpBMGXO9mTO7sJBzgr4jXQ2hf1OH5r5DKugE,3586
121
121
  reconcile/aus/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
122
- reconcile/aus/advanced_upgrade_service.py,sha256=X3_mjNsocBEwgyGHs1O2hG6lTL0BOlM2DX_cvsmXtZ8,10953
123
- reconcile/aus/base.py,sha256=z76_aJrxJZHu8XZmVeGHlVKF3SjMwE8Ayrr5NL1VRqc,26221
122
+ reconcile/aus/advanced_upgrade_service.py,sha256=R0V-APkx12JOQNySLSM1HvJDJSzKp3QyBO0hBBoVzlM,11316
123
+ reconcile/aus/base.py,sha256=qnO8kmnesMho6a-EgFdrVejjPtwS_jkdlSPHaXYB1Rs,26259
124
124
  reconcile/aus/models.py,sha256=Qj4hmJr6J3fsH1acOaudqvGnXIuk5pXakckOf3L_qHA,4536
125
125
  reconcile/aus/ocm_addons_upgrade_scheduler_org.py,sha256=b9qGFWwY8aSEzXeTtw89dqQeK_dJGBEfopOOkdjO8V8,6026
126
126
  reconcile/aus/ocm_upgrade_scheduler.py,sha256=Wh2ZbODeOF7_hEbXfsFUGnAJ9CLSy76lNKEmir-GHuM,3447
@@ -537,13 +537,13 @@ reconcile/utils/mr/user_maintenance.py,sha256=_4VwAMJsBxD7maM7AZsMl_GjYRgQtZb_rl
537
537
  reconcile/utils/ocm/__init__.py,sha256=5Pcf5cyftDWT5XRi1EzvNklOVxGplJi-v12HN3TDarc,57
538
538
  reconcile/utils/ocm/base.py,sha256=8pCZB_V6pZhc-qZQFTuIr1kM5nxrzz9kT86-DW3rgq0,168
539
539
  reconcile/utils/ocm/cluster_groups.py,sha256=TBb3mIzw68BHBcCzacmAN8IsNPo8FfOnTMphuctwuU0,2679
540
- reconcile/utils/ocm/clusters.py,sha256=0QuvFUQIRGXlPBvVdQrUeKbVj67eL2KcATwOpoOp12c,7407
540
+ reconcile/utils/ocm/clusters.py,sha256=4Ddc0Ah-s5gmNUK0K_4e2zaHyip50fyCCSFuAirPO2s,7766
541
541
  reconcile/utils/ocm/labels.py,sha256=5Edjk9F3o4AnhzYc-YUiwDkG_pnEPcXrIXT9g1uE3x0,4883
542
542
  reconcile/utils/ocm/ocm.py,sha256=pp-T6cT0RQf91oqrWFm5QSd_LyH8n5gJmPaetDtMioI,64455
543
543
  reconcile/utils/ocm/search_filters.py,sha256=zExZpYBh7_tucG-xKoPHUxz1b_6l9qwbEMpMihQg7nA,15043
544
544
  reconcile/utils/ocm/service_log.py,sha256=6_RNLG6KlnXNmJW6xBrlqGdyyz-fuaSeFmiJFOLN51g,2535
545
545
  reconcile/utils/ocm/sre_capability_labels.py,sha256=HY5v3ndMu1hwbLipX24l1R-dvm0SFKFettnV7detVBI,1530
546
- reconcile/utils/ocm/subscriptions.py,sha256=kuHster01yLy0_s5DWFLXh9zse3NIpbGTuKW78q_b90,2322
546
+ reconcile/utils/ocm/subscriptions.py,sha256=PO5Rp440NEmZxIVVvhQpPzDRcKL1jYoQq5j2N9AkM1c,2344
547
547
  reconcile/utils/runtime/__init__.py,sha256=l9o8APZxyED5Q6ylGoLIESksQF4f3O8cdke3IdMFOTQ,108
548
548
  reconcile/utils/runtime/desired_state_diff.py,sha256=AQhJmq3CP2YOWP-KpmVtYKnhZ46sxERfbk_R6PHO-zc,8272
549
549
  reconcile/utils/runtime/environment.py,sha256=cJgCMRBeschdeKJuk_N6BhDWaOCZbo-41i2a9L9DpBE,1328
@@ -570,7 +570,7 @@ tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
570
570
  tools/app_interface_reporter.py,sha256=M_5C7ySACJG6Hp0UcY-w9ZY0sTVE7oQ48qoijp10jag,21933
571
571
  tools/glitchtip_access_reporter.py,sha256=oPBnk_YoDuljU3v0FaChzOwwnk4vap1xEE67QEjzdqs,2948
572
572
  tools/glitchtip_access_revalidation.py,sha256=PXN5wxl6OX8sxddPaakDF3X79nFLvpm-lz0mWLVelw0,2806
573
- tools/qontract_cli.py,sha256=GLnFJS2FQs1yX_bjAVR4PNgEDlCPcNqDv1i4pEOiqVU,90439
573
+ tools/qontract_cli.py,sha256=pGBwz3TjvfSDCYlKSISTzCG5ab1ljxJQIfTh3lkljOY,90671
574
574
  tools/cli_commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
575
575
  tools/cli_commands/gpg_encrypt.py,sha256=JryinrDdvztN931enUY3FuDeLVnfs6y58mnK7itNK6Y,4940
576
576
  tools/sre_checkpoints/__init__.py,sha256=CDaDaywJnmRCLyl_NCcvxi-Zc0hTi_3OdwKiFOyS39I,145
@@ -578,8 +578,8 @@ tools/sre_checkpoints/util.py,sha256=zEDbGr18ZeHNQwW8pUsr2JRjuXIPz--WAGJxZo9sv_Y
578
578
  tools/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
579
579
  tools/test/test_qontract_cli.py,sha256=awwTHEc2DWlykuqGIYM0WOBoSL0KRnOraCLk3C7izis,1401
580
580
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
581
- qontract_reconcile-0.10.1rc41.dist-info/METADATA,sha256=FcNoC48l0wdeWYF2QclApVirXpYew_Ew1bJtzZD_n38,2288
582
- qontract_reconcile-0.10.1rc41.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
583
- qontract_reconcile-0.10.1rc41.dist-info/entry_points.txt,sha256=Af70EWPJxsTiCNF6gA-pWdw1A0Heqn-PZF-oBc5NmiU,302
584
- qontract_reconcile-0.10.1rc41.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
585
- qontract_reconcile-0.10.1rc41.dist-info/RECORD,,
581
+ qontract_reconcile-0.10.1rc42.dist-info/METADATA,sha256=GHL6WI4VYINYdxldOjinx2mUmBm0tpnLz9aWAJHxDnk,2288
582
+ qontract_reconcile-0.10.1rc42.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
583
+ qontract_reconcile-0.10.1rc42.dist-info/entry_points.txt,sha256=Af70EWPJxsTiCNF6gA-pWdw1A0Heqn-PZF-oBc5NmiU,302
584
+ qontract_reconcile-0.10.1rc42.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
585
+ qontract_reconcile-0.10.1rc42.dist-info/RECORD,,
@@ -75,7 +75,11 @@ class AdvancedUpgradeServiceIntegration(OCMClusterUpgradeSchedulerOrgIntegration
75
75
  self, ocm_env: OCMEnvironment, org_ids: Optional[set[str]]
76
76
  ) -> dict[str, OrganizationUpgradeSpec]:
77
77
  ocm_api = init_ocm_base_client(ocm_env, self.secret_reader)
78
- clusters_by_org = _discover_clusters(ocm_api=ocm_api, org_ids=org_ids)
78
+ clusters_by_org = discover_clusters(
79
+ ocm_api=ocm_api,
80
+ org_ids=org_ids,
81
+ ignore_sts_clusters=self.params.ignore_sts_clusters,
82
+ )
79
83
  labels_by_org = _get_org_labels(ocm_api=ocm_api, org_ids=org_ids)
80
84
 
81
85
  return _build_org_upgrade_specs_for_ocm_env(
@@ -96,8 +100,10 @@ class AdvancedUpgradeServiceIntegration(OCMClusterUpgradeSchedulerOrgIntegration
96
100
  )
97
101
 
98
102
 
99
- def _discover_clusters(
100
- ocm_api: OCMBaseClient, org_ids: Optional[set[str]] = None
103
+ def discover_clusters(
104
+ ocm_api: OCMBaseClient,
105
+ org_ids: Optional[set[str]] = None,
106
+ ignore_sts_clusters: bool = False,
101
107
  ) -> dict[str, list[ClusterDetails]]:
102
108
  """
103
109
  Discover all clusters that are part of the AUS service.
@@ -111,7 +117,10 @@ def _discover_clusters(
111
117
  # group by org and filter if org_id is specified
112
118
  clusters_by_org: dict[str, list[ClusterDetails]] = defaultdict(list)
113
119
  for c in clusters:
114
- if org_ids is None or c.organization_id in org_ids:
120
+ is_sts_cluster = c.ocm_cluster.aws and c.ocm_cluster.aws.sts_enabled
121
+ passed_sts_filter = not ignore_sts_clusters or not is_sts_cluster
122
+ passed_ocm_filters = org_ids is None or c.organization_id in org_ids
123
+ if passed_ocm_filters and passed_sts_filter:
115
124
  clusters_by_org[c.organization_id].append(c)
116
125
 
117
126
  return clusters_by_org
reconcile/aus/base.py CHANGED
@@ -59,6 +59,7 @@ class AdvancedUpgradeSchedulerBaseIntegrationParams(PydanticRunParams):
59
59
 
60
60
  ocm_environment: Optional[str] = None
61
61
  ocm_organization_ids: Optional[set[str]] = None
62
+ ignore_sts_clusters: bool = False
62
63
 
63
64
 
64
65
  class AdvancedUpgradeSchedulerBaseIntegration(
reconcile/cli.py CHANGED
@@ -1996,8 +1996,14 @@ def ocm_addons_upgrade_scheduler_org(ctx):
1996
1996
  required=False,
1997
1997
  envvar="AUS_OCM_ORG_IDS",
1998
1998
  )
1999
+ @click.option(
2000
+ "--ignore-sts-clusters",
2001
+ is_flag=True,
2002
+ default=os.environ.get("IGNORE_STS_CLUSTERS", False),
2003
+ help="Ignore STS clusters",
2004
+ )
1999
2005
  @click.pass_context
2000
- def aus_upgrade_scheduler_org(ctx, ocm_env, ocm_org_ids):
2006
+ def aus_upgrade_scheduler_org(ctx, ocm_env, ocm_org_ids, ignore_sts_clusters):
2001
2007
  from reconcile.aus.advanced_upgrade_service import AdvancedUpgradeServiceIntegration
2002
2008
  from reconcile.aus.base import AdvancedUpgradeSchedulerBaseIntegrationParams
2003
2009
 
@@ -2007,6 +2013,7 @@ def aus_upgrade_scheduler_org(ctx, ocm_env, ocm_org_ids):
2007
2013
  AdvancedUpgradeSchedulerBaseIntegrationParams(
2008
2014
  ocm_environment=ocm_env,
2009
2015
  ocm_organization_ids=parsed_ocm_org_ids,
2016
+ ignore_sts_clusters=ignore_sts_clusters,
2010
2017
  )
2011
2018
  ),
2012
2019
  ctx=ctx.obj,
@@ -24,6 +24,8 @@ from reconcile.utils.ocm.subscriptions import (
24
24
  )
25
25
  from reconcile.utils.ocm_base_client import OCMBaseClient
26
26
 
27
+ ACTIVE_SUBSCRIPTION_STATES = {"Active", "Reserved"}
28
+
27
29
 
28
30
  class OCMClusterState(Enum):
29
31
  ERROR = "error"
@@ -39,6 +41,19 @@ class OCMClusterState(Enum):
39
41
  WAITING = "waiting"
40
42
 
41
43
 
44
+ class OCMClusterFlag(BaseModel):
45
+
46
+ enabled: bool
47
+
48
+
49
+ class OCMClusterAWSSettings(BaseModel):
50
+ sts: Optional[OCMClusterFlag]
51
+
52
+ @property
53
+ def sts_enabled(self) -> bool:
54
+ return self.sts is not None and self.sts.enabled
55
+
56
+
42
57
  class OCMCluster(BaseModel):
43
58
 
44
59
  kind: str = "Cluster"
@@ -52,8 +67,6 @@ class OCMCluster(BaseModel):
52
67
  display_name: str
53
68
 
54
69
  managed: bool
55
-
56
- openshift_version: str
57
70
  state: OCMClusterState
58
71
 
59
72
  subscription: OCMModelLink
@@ -61,6 +74,8 @@ class OCMCluster(BaseModel):
61
74
  cloud_provider: OCMModelLink
62
75
  product: OCMModelLink
63
76
 
77
+ aws: Optional[OCMClusterAWSSettings]
78
+
64
79
 
65
80
  class ClusterDetails(BaseModel):
66
81
 
@@ -188,7 +203,8 @@ def get_cluster_details_for_subscriptions(
188
203
  # get subscription details
189
204
  subscriptions = get_subscriptions(
190
205
  ocm_api=ocm_api,
191
- filter=(subscription_filter or Filter()) & build_subscription_filter(),
206
+ filter=(subscription_filter or Filter())
207
+ & build_subscription_filter(states=ACTIVE_SUBSCRIPTION_STATES, managed=True),
192
208
  )
193
209
  if not subscriptions:
194
210
  return
@@ -77,9 +77,11 @@ def get_subscriptions(
77
77
  return subscriptions
78
78
 
79
79
 
80
- def build_subscription_filter(state: str = "Active", managed: bool = True) -> Filter:
80
+ def build_subscription_filter(
81
+ states: Optional[set[str]] = None, managed: bool = True
82
+ ) -> Filter:
81
83
  """
82
84
  Helper function to create a subscription search filer for two very common
83
85
  fields: status and managed.
84
86
  """
85
- return Filter().eq("status", state).eq("managed", str(managed).lower())
87
+ return Filter().is_in("status", states).eq("managed", str(managed).lower())
tools/qontract_cli.py CHANGED
@@ -630,8 +630,14 @@ def ocm_fleet_upgrade_policies(
630
630
  required=False,
631
631
  envvar="AUS_OCM_ORG_IDS",
632
632
  )
633
+ @click.option(
634
+ "--ignore-sts-clusters",
635
+ is_flag=True,
636
+ default=os.environ.get("IGNORE_STS_CLUSTERS", False),
637
+ help="Ignore STS clusters",
638
+ )
633
639
  @click.pass_context
634
- def aus_fleet_upgrade_policies(ctx, ocm_env, ocm_org_ids):
640
+ def aus_fleet_upgrade_policies(ctx, ocm_env, ocm_org_ids, ignore_sts_clusters):
635
641
  from reconcile.aus.advanced_upgrade_service import AdvancedUpgradeServiceIntegration
636
642
 
637
643
  parsed_ocm_org_ids = set(ocm_org_ids.split(",")) if ocm_org_ids else None
@@ -641,6 +647,7 @@ def aus_fleet_upgrade_policies(ctx, ocm_env, ocm_org_ids):
641
647
  AdvancedUpgradeSchedulerBaseIntegrationParams(
642
648
  ocm_environment=ocm_env,
643
649
  ocm_organization_ids=parsed_ocm_org_ids,
650
+ ignore_sts_clusters=ignore_sts_clusters,
644
651
  )
645
652
  ),
646
653
  )