Skip to content

Commit

Permalink
update to support new mandatory "billing account id"
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Czarkowski <username.taken@gmail.com>
  • Loading branch information
paulczar committed Dec 11, 2023
1 parent 9c26cef commit fb5b7e2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace: rh_mobb
name: rosa
version: 2.2.0
version: 2.2.1
readme: README.md
authors:
- Paul Czarkowski <pczarkow@redhat.com>
Expand Down
31 changes: 19 additions & 12 deletions plugins/module_utils/ocm.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ def rosa_creator_arn():
client = boto3.client("sts")
return client.get_caller_identity()["Arn"]

def aws_account_id():
client = boto3.client("sts")
return client.get_caller_identity()["Account"]

def rosa_compute_node_count(params):
# return the requested compute node count if set
if params['compute_nodes']:
Expand Down Expand Up @@ -158,7 +162,7 @@ def rosa_compute_nodes(params, availability_zones):
)

return compute_nodes

# return compute node object for non-autoscaling use case
compute_nodes.compute = int(rosa_compute_node_count(params))

Expand Down Expand Up @@ -264,18 +268,21 @@ def create_cluster(api_instance, params):
instance_iam_roles = ocm_client.InstanceIAMRoles(
worker_role_arn = params['worker_iam_role'],
)
if not params['hosted_cp']:
instance_iam_roles.master_role_arn = params['controlplane_iam_role']
else:
# correct the multi-az input for hosted control planes. hosted control plane is
# always considered multi-az because the control plane itself is multi-az. the
if params['hosted_cp']:
# correct the multi-az input for hosted control planes. hosted control plane is
# always considered multi-az because the control plane itself is multi-az. the
# machine pools are managed differently.
params['multi_az'] = True
# billing account id must be set (todo make it configurable)
billing_account_id = params['aws_account_id']
else:
instance_iam_roles.master_role_arn = params['controlplane_iam_role']
billing_account_id = None
cluster = ocm_client.Cluster(

api = api_visibility((params['private_link'] or params['private'])),
aws = ocm_client.AWS(
sts = ocm_client.STS(
aws = ocm_client.AWS(
sts = ocm_client.STS(
enabled = params['sts'],
auto_mode = False, #params['hosted_cp'],
instance_iam_roles = instance_iam_roles,
Expand All @@ -285,9 +292,9 @@ def create_cluster(api_instance, params):
role_arn = params['role_arn'],
support_role_arn = params['support_role_arn'],
),
kms_key_arn=params['kms_key_arn'],


kms_key_arn=params['kms_key_arn'],
billing_account_id = billing_account_id,
account_id = params['aws_account_id'],
# audit_log
etcd_encryption = ocm_client.AwsEtcdEncryption(),
Expand Down Expand Up @@ -345,7 +352,7 @@ def create_cluster(api_instance, params):
channel_group = "stable",
),


)

try:
Expand Down
2 changes: 1 addition & 1 deletion roles/_vars/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ rosa_private_link: false
rosa_disable_workload_monitoring: false
rosa_hcp: false

rosa_version: "4.14.1"
rosa_version: "4.14.4"

# disable autoscaling
# rosa_compute_nodes: 3
Expand Down

0 comments on commit fb5b7e2

Please sign in to comment.