Skip to content

Commit

Permalink
Merge pull request openshift#65 from clnperez/fork-migration
Browse files Browse the repository at this point in the history
updates by way of the PRs that were intended to go upstream. these have some changes including code fixes, linting, test updates, and then a PR that addressed some of the comments from Prashanth on the terraform PR upstream.
  • Loading branch information
clnperez authored Nov 9, 2021
2 parents 9218e99 + afe67d0 commit c83f252
Show file tree
Hide file tree
Showing 28 changed files with 363 additions and 224 deletions.
10 changes: 10 additions & 0 deletions OWNERS_ALIASES
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ aliases:
- mandre
- mdbooth
- pierreprinetti
powervs-approvers:
- Prashanth684
- clnperez
- mkumatag
powervs-reviewers:
- 23TNC
- clnperez
- mjturek
- mkumatag
- Prashanth684
vsphere-approvers:
- dav1x
- jcpowermac
Expand Down
129 changes: 129 additions & 0 deletions data/data/install.openshift.io_installconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,30 @@ spec:
- high_performance
type: string
type: object
powervs:
description: PowerVS is the configuration used when installing
on IBM Power VS.
properties:
memory:
description: Memory defines the memory in GB for the instance.
type: integer
procType:
description: ProcType defines the processor sharing model
for the instance.
type: string
processors:
description: Processors defines the processing units for
the instance.
sysType:
description: SysType defines the system type for instance.
type: string
volumeIDs:
description: VolumeIDs is the list of volumes attached to
the instance.
items:
type: string
type: array
type: object
vsphere:
description: VSphere is the configuration used when installing
on vSphere.
Expand Down Expand Up @@ -891,6 +915,30 @@ spec:
- high_performance
type: string
type: object
powervs:
description: PowerVS is the configuration used when installing
on IBM Power VS.
properties:
memory:
description: Memory defines the memory in GB for the instance.
type: integer
procType:
description: ProcType defines the processor sharing model
for the instance.
type: string
processors:
description: Processors defines the processing units for the
instance.
sysType:
description: SysType defines the system type for instance.
type: string
volumeIDs:
description: VolumeIDs is the list of volumes attached to
the instance.
items:
type: string
type: array
type: object
vsphere:
description: VSphere is the configuration used when installing
on vSphere.
Expand Down Expand Up @@ -2089,6 +2137,87 @@ spec:
- ovirt_cluster_id
- ovirt_storage_domain_id
type: object
powervs:
description: PowerVS is the configuration used when installing on
Power VS.
properties:
APIKey:
description: APIKey is the API key for the user's IBM Cloud account.
type: string
clusterOSImage:
description: ClusterOSImage is a pre-created Power VS boot image
that overrides the default image for cluster nodes.
type: string
defaultMachinePlatform:
description: DefaultMachinePlatform is the default configuration
used when installing on Power VS for machine pools which do
not define their own platform configuration.
properties:
memory:
description: Memory defines the memory in GB for the instance.
type: integer
procType:
description: ProcType defines the processor sharing model
for the instance.
type: string
processors:
description: Processors defines the processing units for the
instance.
sysType:
description: SysType defines the system type for instance.
type: string
volumeIDs:
description: VolumeIDs is the list of volumes attached to
the instance.
items:
type: string
type: array
type: object
powervsResourceGroup:
description: PowerVSResourceGroup is the resource group for creating
Power VS resources.
type: string
pvsNetworkName:
description: PVSNetworkName specifies an existing network within
the Power VS Service Instance.
type: string
region:
description: Region specifies the IBM Cloud region where the cluster
will be created.
type: string
serviceInstance:
description: ServiceInstanceID is the ID of the Power IAAS instance
created from the IBM Cloud Catalog
type: string
subnets:
description: Subnets specifies existing subnets (by ID) where
cluster resources will be created. Leave unset to have the
installer create subnets in a new VPC on your behalf.
items:
type: string
type: array
userID:
description: UserID is the login for the user's IBM Cloud account.
type: string
vpc:
description: VPC is a VPC inside IBM Cloud. Needed in order to
create VPC Load Balancers.
type: string
vpcRegion:
description: Zone in the region used to create VPC resources.
Leave unset to allow installer to randomly select a zone.
type: string
zone:
description: Zone specifies the IBM Cloud colo region where the
cluster will be created. Required for multi-zone regions.
type: string
required:
- powervsResourceGroup
- region
- serviceInstance
- userID
- zone
type: object
vsphere:
description: VSphere is the configuration used when installing on
vSphere.
Expand Down
12 changes: 6 additions & 6 deletions data/data/powervs/bootstrap/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ data "ibm_pi_image" "bootstrap_image" {

data "ignition_config" "bootstrap" {
merge {
source = ibms3presign.bootstrap_ignition.presigned_url
source = ibms3presign.bootstrap_ignition.presigned_url
}
}

Expand Down Expand Up @@ -47,12 +47,12 @@ resource "ibm_resource_key" "cos_service_cred" {
}

resource "ibms3presign" "bootstrap_ignition" {
access_key_id = ibm_resource_key.cos_service_cred.credentials["cos_hmac_keys.access_key_id"]
access_key_id = ibm_resource_key.cos_service_cred.credentials["cos_hmac_keys.access_key_id"]
secret_access_key = ibm_resource_key.cos_service_cred.credentials["cos_hmac_keys.secret_access_key"]
bucket_name = "${var.cluster_id}-bootstrap-ign"
key = "bootstrap.ign"
region_location = ibm_cos_bucket.ignition.region_location
storage_class = ibm_cos_bucket.ignition.storage_class
bucket_name = "${var.cluster_id}-bootstrap-ign"
key = "bootstrap.ign"
region_location = ibm_cos_bucket.ignition.region_location
storage_class = ibm_cos_bucket.ignition.storage_class
}

# Place the bootstrap ignition file in the ignition COS bucket
Expand Down
12 changes: 6 additions & 6 deletions data/data/powervs/iaas/power-iaas.tf
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
provider "ibm" {
ibmcloud_api_key = var.powervs_api_key
ibmcloud_api_key = var.powervs_api_key
}

data "ibm_resource_group" "group" {
name = var.powervs_resource_group
}

resource "ibm_resource_instance" "resource_instance" {
name = "${var.cluster_id}-power-iaas"
service = "power-iaas"
plan = "power-virtual-server-group"
location = var.powervs_region
tags = concat( var.service_tags, [ "${var.cluster_id}-power-iaas", "${var.cluster_id}" ] )
name = "${var.cluster_id}-power-iaas"
service = "power-iaas"
plan = "power-virtual-server-group"
location = var.powervs_region
tags = concat(var.service_tags, ["${var.cluster_id}-power-iaas", "${var.cluster_id}"])
resource_group_id = data.ibm_resource_group.group.id

timeouts {
Expand Down
4 changes: 2 additions & 2 deletions data/data/powervs/iaas/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ variable "powervs_region" {
}

variable "cluster_id" {
type = string
default = ""
type = string
default = ""
}

variable "service_tags" {
Expand Down
4 changes: 2 additions & 2 deletions data/data/powervs/loadbalancer/alb.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ data "ibm_resource_group" "resource_group" {

resource "ibm_is_lb" "load_balancer" {
name = "${var.cluster_id}-loadbalancer"
resource_group = data.ibm_resource_group.resource_group.id
resource_group = data.ibm_resource_group.resource_group.id
subnets = [var.vpc_subnet_id]
security_groups = [ibm_is_security_group.ocp_security_group.id]
tags = [var.cluster_id, "${var.cluster_id}-loadbalancer"]
Expand All @@ -20,7 +20,7 @@ resource "ibm_is_lb" "load_balancer" {

resource "ibm_is_lb" "load_balancer_int" {
name = "${var.cluster_id}-loadbalancer-int"
resource_group = data.ibm_resource_group.resource_group.id
resource_group = data.ibm_resource_group.resource_group.id
subnets = [var.vpc_subnet_id]
security_groups = [ibm_is_security_group.ocp_security_group.id]
tags = [var.cluster_id, "${var.cluster_id}-loadbalancer-int"]
Expand Down
6 changes: 3 additions & 3 deletions data/data/powervs/loadbalancer/sg.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ data "ibm_is_vpc" "vpc" {
}

resource "ibm_is_security_group" "ocp_security_group" {
name = "${var.cluster_id}-ocp-sec-group"
name = "${var.cluster_id}-ocp-sec-group"
resource_group = data.ibm_resource_group.resource_group.id
vpc = data.ibm_is_vpc.vpc.id
tags = [var.cluster_id]
vpc = data.ibm_is_vpc.vpc.id
tags = [var.cluster_id]
}

resource "ibm_is_security_group_rule" "inbound_ports" {
Expand Down
31 changes: 16 additions & 15 deletions data/data/powervs/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
provider "ibm" {
alias = "vpc"
ibmcloud_api_key = var.powervs_api_key
region = var.powervs_vpc_region
alias = "vpc"
ibmcloud_api_key = var.powervs_api_key
region = var.powervs_vpc_region
zone = var.powervs_vpc_zone
}

provider "ibm" {
Expand All @@ -11,7 +12,7 @@ provider "ibm" {
}

resource "ibm_pi_key" "cluster_key" {
provider = ibm.powervs
provider = ibm.powervs
pi_key_name = "${var.cluster_id}-key"
pi_ssh_key = var.powervs_ssh_key
pi_cloud_instance_id = var.powervs_cloud_instance_id
Expand Down Expand Up @@ -62,18 +63,18 @@ module "master" {

data "ibm_is_subnet" "vpc_subnet" {
provider = ibm.vpc
name = var.powervs_vpc_subnet_name
name = var.powervs_vpc_subnet_name
}

data "ibm_pi_image" "boot_image" {
provider = ibm.powervs
pi_image_name = var.powervs_image_name
provider = ibm.powervs
pi_image_name = var.powervs_image_name
pi_cloud_instance_id = var.powervs_cloud_instance_id
}

data "ibm_pi_network" "pvs_net" {
provider = ibm.powervs
pi_network_name = var.powervs_network_name
provider = ibm.powervs
pi_network_name = var.powervs_network_name
pi_cloud_instance_id = var.powervs_cloud_instance_id
}

Expand All @@ -83,12 +84,12 @@ module "loadbalancer" {
}
source = "./loadbalancer"

cluster_id = var.cluster_id
vpc_name = var.powervs_vpc_name
vpc_subnet_id = data.ibm_is_subnet.vpc_subnet.id
bootstrap_ip = module.bootstrap.bootstrap_ip
master_ips = module.master.master_ips
resource_group = var.powervs_resource_group
cluster_id = var.cluster_id
vpc_name = var.powervs_vpc_name
vpc_subnet_id = data.ibm_is_subnet.vpc_subnet.id
bootstrap_ip = module.bootstrap.bootstrap_ip
master_ips = module.master.master_ips
resource_group = var.powervs_resource_group
}


Expand Down
6 changes: 3 additions & 3 deletions data/data/powervs/master/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ resource "ibm_pi_instance" "master" {
pi_cloud_instance_id = var.cloud_instance_id
pi_network_ids = [data.ibm_pi_network.network.id]

pi_user_data = base64encode(var.ignition)
pi_key_pair_name = var.key_id
pi_health_status = "WARNING"
pi_user_data = base64encode(var.ignition)
pi_key_pair_name = var.key_id
pi_health_status = "WARNING"
}

data "ibm_pi_instance_ip" "master_ip" {
Expand Down
2 changes: 1 addition & 1 deletion data/data/powervs/master/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
output "master_ips" {
value = data.ibm_pi_instance_ip.master_ip.*.ip
value = data.ibm_pi_instance_ip.master_ip.*.ip
}
10 changes: 5 additions & 5 deletions data/data/powervs/topology/pi_network.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
## And since they're optional, use the count = construct to conditionally create them if the tf
## vars are unset.

# Note, the following are incomplete placeholders to be tested and reviewed later when the TF
support for these has been added to the ibmcloud terraform provider (which is now forked into
https://github.com/openshift/terraform-provider-ibm)
## Note, the following are incomplete placeholders to be tested and reviewed later when the TF
## support for these has been added to the ibmcloud terraform provider (which is now forked into
## https://github.com/openshift/terraform-provider-ibm)

#resource "ibm_direct_link" "ocp_direct_link" {
# TODO
#}

#resource "ibm_pi_network" "ocp_network" {
# provider = ibm.powervs
# count = var.powervs_network_id == "" ? 1 : 0
# pi_network_name = "pvs_net_${var.cluster_id}"
# count = var.powervs_network_name == "" ? 1 : 0
# pi_network_name = "pvs-net-${var.cluster_id}"
# pi_cloud_instance_id = "powervs_cloud_instance_id"
# pi_network_type = "dhcp"
# pi_cidr = "192.168.0.0/24"
Expand Down
11 changes: 10 additions & 1 deletion data/data/powervs/variables-powervs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ variable "powervs_vpc_region" {
type = string
description = "The IBM Cloud region where you want to create the resources"
default = "eu-gb"
##default = "eu-gb"
}

variable "powervs_vpc_zone" {
type = string
description = "The IBM Cloud zone associated with the VPC region you're using"
}

variable "powervs_region" {
Expand All @@ -20,6 +24,11 @@ variable "powervs_region" {
default = "lon"
}

variable "powervs_zone" {
type = string
description = "The IBM Cloud zone associated with the region you're using"
}

variable "powervs_resource_group" {
type = string
description = "The cloud instance resource group"
Expand Down
Loading

0 comments on commit c83f252

Please sign in to comment.