Skip to content

Commit 3d4468b

Browse files
Merge pull request openshift#7795 from hamzy/powervs-MULTIARCH-4030
PowerVS: MULTIARCH-4030: Reintroduce serviceInstanceGUID install option
2 parents 1fd3719 + b7fd81d commit 3d4468b

File tree

25 files changed

+292
-63
lines changed

25 files changed

+292
-63
lines changed

data/data/install.openshift.io_installconfigs.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4378,6 +4378,12 @@ spec:
43784378
description: Region specifies the IBM Cloud colo region where
43794379
the cluster will be created.
43804380
type: string
4381+
serviceInstanceGUID:
4382+
description: ServiceInstanceGUID is the GUID of the Power IAAS
4383+
instance created from the IBM Cloud Catalog before the cluster
4384+
is completed. Leave unset to allow the installer to create
4385+
a service instance during cluster creation.
4386+
type: string
43814387
userID:
43824388
description: UserID is the login for the user's IBM Cloud account.
43834389
type: string

data/data/powervs/bootstrap/iaas/iaas.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ data "ibm_resource_group" "group" {
33
}
44

55
data "ibm_resource_instance" "powervs_service_instance" {
6-
name = "${var.cluster_id}-power-iaas"
6+
name = var.service_instance_name == "" ? "${var.cluster_id}-power-iaas" : var.service_instance_name
77
}

data/data/powervs/bootstrap/iaas/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@ variable "resource_group" {
77
type = string
88
description = "The name of the Power VS resource group to which the user belongs."
99
}
10+
11+
variable "service_instance_name" {
12+
type = string
13+
description = "Optionally, the service instance name of an existing object before cluster creation"
14+
}

data/data/powervs/bootstrap/main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ module "iaas" {
6161
# define and pass variables to:
6262
# data/data/powervs/bootstrap/iaas/variables.tf
6363
#
64-
cluster_id = var.cluster_id
65-
resource_group = var.powervs_resource_group
64+
cluster_id = var.cluster_id
65+
resource_group = var.powervs_resource_group
66+
service_instance_name = var.powervs_service_instance_name
6667
}

data/data/powervs/cluster/iaas/iaas.tf

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@ data "ibm_resource_group" "group" {
22
name = var.resource_group
33
}
44

5-
resource "ibm_resource_instance" "powervs_service_instance" {
5+
data "ibm_resource_instance" "existing_service_instance" {
6+
count = var.service_instance_name != "" ? 1 : 0
7+
name = var.service_instance_name
8+
service = "power-iaas"
9+
resource_group_id = data.ibm_resource_group.group.id
10+
}
11+
12+
resource "ibm_resource_instance" "created_service_instance" {
13+
count = var.service_instance_name == "" ? 1 : 0
614
name = "${var.cluster_id}-power-iaas"
715
service = "power-iaas"
816
plan = "power-virtual-server-group"
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
output "si_name" {
2+
value = var.service_instance_name == "" ? one(resource.ibm_resource_instance.created_service_instance[*].name) : one(data.ibm_resource_instance.existing_service_instance[*].name)
3+
}
4+
15
output "si_guid" {
2-
value = ibm_resource_instance.powervs_service_instance.guid
6+
value = var.service_instance_name == "" ? one(resource.ibm_resource_instance.created_service_instance[*].guid) : one(data.ibm_resource_instance.existing_service_instance[*].guid)
37
}
48

59
output "si_crn" {
6-
value = ibm_resource_instance.powervs_service_instance.crn
10+
value = var.service_instance_name == "" ? one(resource.ibm_resource_instance.created_service_instance[*].crn) : one(data.ibm_resource_instance.existing_service_instance[*].crn)
711
}

data/data/powervs/cluster/iaas/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,8 @@ variable "powervs_zone" {
1212
type = string
1313
description = "The Power VS zone in which to create resources."
1414
}
15+
16+
variable "service_instance_name" {
17+
type = string
18+
description = "Optionally, the service instance name of an existing object before cluster creation"
19+
}

data/data/powervs/cluster/main.tf

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ module "master" {
5656
providers = {
5757
ibm = ibm.powervs
5858
}
59-
source = "./master"
60-
cloud_instance_id = module.iaas.si_guid
61-
cluster_id = var.cluster_id
62-
resource_group = var.powervs_resource_group
63-
instance_count = var.master_count
59+
source = "./master"
6460

61+
cloud_instance_id = module.iaas.si_guid
62+
cluster_id = var.cluster_id
63+
resource_group = var.powervs_resource_group
64+
instance_count = var.master_count
6565
api_key = var.powervs_api_key
6666
powervs_region = var.powervs_region
6767
powervs_zone = var.powervs_zone
@@ -166,7 +166,8 @@ module "iaas" {
166166
# define and pass variables to:
167167
# data/data/powervs/cluster/iaas/variables.tf
168168
#
169-
cluster_id = var.cluster_id
170-
resource_group = var.powervs_resource_group
171-
powervs_zone = var.powervs_zone
169+
cluster_id = var.cluster_id
170+
resource_group = var.powervs_resource_group
171+
powervs_zone = var.powervs_zone
172+
service_instance_name = var.powervs_service_instance_name
172173
}

data/data/powervs/variables-powervs.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ variable "powervs_publish_strategy" {
4040
default = "External"
4141
}
4242

43+
variable "powervs_service_instance_name" {
44+
type = string
45+
description = "Optionally, the service instance name of an existing object before cluster creation"
46+
}
47+
4348
################################################################
4449
# Configure storage
4550
################################################################

pkg/asset/cluster/powervs/powervs.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ func Metadata(config *types.InstallConfig, meta *icpowervs.Metadata) *powervs.Me
2222
Region: config.Platform.PowerVS.Region,
2323
VPCRegion: config.Platform.PowerVS.VPCRegion,
2424
Zone: config.Platform.PowerVS.Zone,
25+
ServiceInstanceGUID: config.Platform.PowerVS.ServiceInstanceGUID,
2526
}
2627
}

0 commit comments

Comments
 (0)