qontract-reconcile 0.10.1rc942__py3-none-any.whl → 0.10.1rc943__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.1rc942
3
+ Version: 0.10.1rc943
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
@@ -54,7 +54,7 @@ reconcile/ocm_additional_routers.py,sha256=KfcFDVbNoc6n5dHWjYdAf1_DiVqVG6Tw23WLK
54
54
  reconcile/ocm_addons.py,sha256=qqAyqRBRbdZQvAcjb-QlSVyRAyQBZk6iVlgnI4jyi7s,3353
55
55
  reconcile/ocm_addons_upgrade_tests_trigger.py,sha256=A9zXeYG-_52DsS1dz47yDSnHz62du5XpPBlaeRa6zxY,3975
56
56
  reconcile/ocm_aws_infrastructure_access.py,sha256=SghVWdmgliPVo_xHsp-e64_iC3mqDiia2ANSHb-g5G8,6891
57
- reconcile/ocm_clusters.py,sha256=bD8zlnUbwfDaVvHd-lSDGWmqY1ag_Gcr6kQ0y3aiKG4,16702
57
+ reconcile/ocm_clusters.py,sha256=0AlqFrUoxxB8rsOgobvnwiBI2Zal8BK2TI2cpWa0Qqg,16895
58
58
  reconcile/ocm_external_configuration_labels.py,sha256=imEpDv1RBpCSj8tHDv0R76hmNCFtcUzVNgS1yOVl8vs,3870
59
59
  reconcile/ocm_github_idp.py,sha256=glwXMsIBcl38-OmDDQCpe0YoLLXfoRgVQmqwXMEXjds,3946
60
60
  reconcile/ocm_groups.py,sha256=-rTPMewkdyo1De6gs4u-294p3z34oUbGfuNi8ov56Sk,3424
@@ -242,7 +242,7 @@ reconcile/gql_definitions/common/app_interface_state_settings.py,sha256=VXIK0Hmy
242
242
  reconcile/gql_definitions/common/app_interface_vault_settings.py,sha256=w8quvdG0cSq71ZyJokPPp7MyMpoDb6-HLQ3o9JHVGRQ,1771
243
243
  reconcile/gql_definitions/common/aws_vpc_requests.py,sha256=2lpyy-QSfHPSTvV_zbnqzqUoFzVNl-CJDmoqd_zVSX4,2366
244
244
  reconcile/gql_definitions/common/aws_vpcs.py,sha256=Dss9dQ3xagnz3Ltg1e9mtG2PAmQGBbUzKCmmzvuN28s,1892
245
- reconcile/gql_definitions/common/clusters.py,sha256=lIBA_wgwOTdcQgkFJ7EU23e9mlln-7WgstB_2psxZA4,21624
245
+ reconcile/gql_definitions/common/clusters.py,sha256=Dr5AsSsTuqjAxkI9fU0fdiaP6u5qkmRpkkCcYDnU584,21868
246
246
  reconcile/gql_definitions/common/clusters_minimal.py,sha256=JYrJV_aStmryiiGKyiXhj47qpF_8KilCqy-d9CofBCo,4635
247
247
  reconcile/gql_definitions/common/clusters_with_dms.py,sha256=GJ53P8tgMLh1NfVkaV9_AmaqF9pNUqJZcDkcKzKzUy0,2242
248
248
  reconcile/gql_definitions/common/clusters_with_peering.py,sha256=9NGjhJW_QWA5XSGGjULdIJdDVObdRqiX2OwEl9zTu4U,11838
@@ -398,7 +398,7 @@ reconcile/jenkins/types.py,sha256=8YJVwnwilTbBKcB46mlMztudDwd0x7rzNOI4D_lV4Fc,29
398
398
  reconcile/ldap_groups/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
399
399
  reconcile/ldap_groups/integration.py,sha256=XNyiipjEWSWgSy6RdHTTJa8ztlV1EPZLsTNsHAgRyMc,10644
400
400
  reconcile/ocm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
401
- reconcile/ocm/types.py,sha256=vbHUUnD4CLR4TKFrVjWQtdCjPTI4A3h0Xodt3WlIsEo,2370
401
+ reconcile/ocm/types.py,sha256=mPudTvjDSO-i7ruXG2oDn64scsKhr0Zf9KMvL0bBO_o,2405
402
402
  reconcile/ocm_internal_notifications/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
403
403
  reconcile/ocm_internal_notifications/integration.py,sha256=FIFHGJSjk_22A32ajJ-W-zsPM0w01kUmGPA8MVYWMPE,4364
404
404
  reconcile/ocm_labels/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -459,7 +459,7 @@ reconcile/templates/aws_access_key_email.j2,sha256=2MUr1ERmyISzKgHqsWYLd-1Wbl-pe
459
459
  reconcile/templates/email.yml.j2,sha256=OZgczNRgXPj2gVYTgwQyHAQrMGu7xp-e4W1rX19GcrU,690
460
460
  reconcile/templates/jira-checkpoint-missinginfo.j2,sha256=c_Vvg-lEENsB3tgxm9B6Y9igCUQhCnFDYh6xw-zcIbU,570
461
461
  reconcile/templates/rosa-classic-cluster-creation.sh.j2,sha256=zqMMlKWV-aUDMtA-Xu5kl5pYLilewDClnKM0c807nNA,2146
462
- reconcile/templates/rosa-hcp-cluster-creation.sh.j2,sha256=DdnABKA-vu2x420JBBrr200bK8GE62GSzY9lBr2k7v8,2178
462
+ reconcile/templates/rosa-hcp-cluster-creation.sh.j2,sha256=hQ-WapiBNV3oEKQ813W3bD4HwQ4gADRPy80z9OLtW3Y,2317
463
463
  reconcile/templating/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
464
464
  reconcile/templating/renderer.py,sha256=rcaGQ8sQjsAyWJKjsOFgKhLEUnPvJAh7eDAJBHHSQMs,12800
465
465
  reconcile/templating/validator.py,sha256=5f9f35PCHOOdjb7KZquL2YdabyuAUokPDa4xutSEHIQ,5360
@@ -811,7 +811,7 @@ tools/app_interface_metrics_exporter.py,sha256=zkwkxdAUAxjdc-pzx2_oJXG25fo0Fnyd5
811
811
  tools/app_interface_reporter.py,sha256=uy9eRHf6EdvD8ZY2WYdroGXm18DOdnqVZyxaWN3Bm_0,17724
812
812
  tools/glitchtip_access_reporter.py,sha256=oPBnk_YoDuljU3v0FaChzOwwnk4vap1xEE67QEjzdqs,2948
813
813
  tools/glitchtip_access_revalidation.py,sha256=8kbBJk04mkq28kWoRDDkfCGIF3GRg3pJrFAh1sW0dbk,2821
814
- tools/qontract_cli.py,sha256=mBQpTirTnjAZcywEreXIufLHQHb7o4UpHy7ulw_5JyE,124302
814
+ tools/qontract_cli.py,sha256=wF3CcF0Acgid41rPxD_8Y9FMb1dDQGJnvqkk8iwiXVs,124415
815
815
  tools/sd_app_sre_alert_report.py,sha256=e9vAdyenUz2f5c8-z-5WY0wv-SJ9aePKDH2r4IwB6pc,5063
816
816
  tools/template_validation.py,sha256=qpKYaTgk0GOPGa2Ct5_5sKdwIHtCAKIBGzsMPuJU5fw,3371
817
817
  tools/cli_commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -842,8 +842,8 @@ tools/test/test_qontract_cli.py,sha256=_D61RFGAN5x44CY1tYbouhlGXXABwYfxKSWSQx3Jr
842
842
  tools/test/test_saas_promotion_state.py,sha256=dy4kkSSAQ7bC0Xp2CociETGN-2aABEfL6FU5D9Jl00Y,6056
843
843
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
844
844
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
845
- qontract_reconcile-0.10.1rc942.dist-info/METADATA,sha256=LnuGjDStHCcmDoK-WgUvP6Afuscee9cW5zp1wy28cdg,2262
846
- qontract_reconcile-0.10.1rc942.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
847
- qontract_reconcile-0.10.1rc942.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
848
- qontract_reconcile-0.10.1rc942.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
849
- qontract_reconcile-0.10.1rc942.dist-info/RECORD,,
845
+ qontract_reconcile-0.10.1rc943.dist-info/METADATA,sha256=Sel-GjBOufLUlo5F8Z2XWaZx1sto1PCFMBo23ls2Sns,2262
846
+ qontract_reconcile-0.10.1rc943.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
847
+ qontract_reconcile-0.10.1rc943.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
848
+ qontract_reconcile-0.10.1rc943.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
849
+ qontract_reconcile-0.10.1rc943.dist-info/RECORD,,
@@ -190,6 +190,9 @@ query Clusters($name: String) {
190
190
  worker_role_arn
191
191
  }
192
192
  }
193
+ billingAccount {
194
+ uid
195
+ }
193
196
  }
194
197
  }
195
198
  id
@@ -438,6 +441,10 @@ class RosaOcmSpecV1(ConfiguredBaseModel):
438
441
  ocm_environments: Optional[list[RosaOcmAwsSpecV1]] = Field(..., alias="ocm_environments")
439
442
 
440
443
 
444
+ class AWSAccountV1_AWSAccountV1(ConfiguredBaseModel):
445
+ uid: str = Field(..., alias="uid")
446
+
447
+
441
448
  class AWSAccountV1(ConfiguredBaseModel):
442
449
  name: str = Field(..., alias="name")
443
450
  uid: str = Field(..., alias="uid")
@@ -445,6 +452,7 @@ class AWSAccountV1(ConfiguredBaseModel):
445
452
  automation_token: VaultSecret = Field(..., alias="automationToken")
446
453
  resources_default_region: str = Field(..., alias="resourcesDefaultRegion")
447
454
  rosa: Optional[RosaOcmSpecV1] = Field(..., alias="rosa")
455
+ billing_account: Optional[AWSAccountV1_AWSAccountV1] = Field(..., alias="billingAccount")
448
456
 
449
457
 
450
458
  class ClusterSpecROSAV1(ClusterSpecV1):
reconcile/ocm/types.py CHANGED
@@ -70,6 +70,7 @@ class ROSAOcmAwsAttrs(BaseModel):
70
70
  class ROSAClusterAWSAccount(BaseModel):
71
71
  uid: str
72
72
  rosa: ROSAOcmAwsAttrs | None
73
+ billing_account_id: str | None
73
74
 
74
75
  class Config:
75
76
  extra = Extra.forbid
reconcile/ocm_clusters.py CHANGED
@@ -45,8 +45,9 @@ def _set_rosa_ocm_attrs(cluster: Mapping[str, Any]):
45
45
  but the cluster only needs the target OCM environment where it belongs.
46
46
  This method changes the cluster dictionary to include just those.
47
47
  """
48
- uid = cluster["spec"]["account"]["uid"]
49
- rosa_ocm_configs = cluster["spec"]["account"]["rosa"]
48
+ account = cluster["spec"]["account"]
49
+ uid = account["uid"]
50
+ rosa_ocm_configs = account["rosa"]
50
51
  rosa: ROSAOcmAwsAttrs | None = None
51
52
  if rosa_ocm_configs:
52
53
  ocm_env = [
@@ -75,10 +76,13 @@ def _set_rosa_ocm_attrs(cluster: Mapping[str, Any]):
75
76
  rosa = None
76
77
 
77
78
  # doing this allows to exclude account fields which can be queried in graphql
78
- cluster["spec"]["account"] = ROSAClusterAWSAccount(
79
+ rosa_cluster_aws_account = ROSAClusterAWSAccount(
79
80
  uid=uid,
80
81
  rosa=rosa,
81
82
  )
83
+ if billing_account := account.get("billingAccount"):
84
+ rosa_cluster_aws_account.billing_account_id = billing_account["uid"]
85
+ cluster["spec"]["account"] = rosa_cluster_aws_account
82
86
 
83
87
 
84
88
  def fetch_desired_state(clusters: Iterable[Mapping[str, Any]]) -> dict[str, OCMSpec]:
@@ -26,7 +26,11 @@ INSTALLER_ROLE_ARN=$(rosa list account-roles --region us-east-1 -o json | jq '.[
26
26
  rosa create operator-roles --prefix {{ cluster_name }} --oidc-config-id ${OIDC_CONFIG_ID} --hosted-cp --installer-role-arn ${INSTALLER_ROLE_ARN} -m auto -y
27
27
 
28
28
  # cluster creation
29
+ {% if cluster.spec.account.billing_account_id %}
30
+ BILLING_ACCOUNT_ID="{{ cluster.spec.account.billing_account_id }}"
31
+ {% else %}
29
32
  BILLING_ACCOUNT_ID=$(aws organizations describe-organization | jq .Organization.MasterAccountId -r)
33
+ {% endif %}
30
34
  rosa create cluster --cluster-name={{ cluster_name }} \
31
35
  --billing-account ${BILLING_ACCOUNT_ID} \
32
36
  {% if dry_run -%}
tools/qontract_cli.py CHANGED
@@ -1359,10 +1359,14 @@ def rosa_create_cluster_command(ctx, cluster_name):
1359
1359
 
1360
1360
  settings = queries.get_app_interface_settings()
1361
1361
  account = cluster.spec.account
1362
- with AWSApi(
1363
- 1, [account.dict(by_alias=True)], settings=settings, init_users=False
1364
- ) as aws_api:
1365
- billing_account = aws_api.get_organization_billing_account(account.name)
1362
+
1363
+ if account.billing_account:
1364
+ billing_account = account.billing_account.uid
1365
+ else:
1366
+ with AWSApi(
1367
+ 1, [account.dict(by_alias=True)], settings=settings, init_users=False
1368
+ ) as aws_api:
1369
+ billing_account = aws_api.get_organization_billing_account(account.name)
1366
1370
 
1367
1371
  print(
1368
1372
  " ".join([