Skip to content

Commit 6d4a9bf

Browse files
Merge pull request openshift#7738 from cjschaef/cors-2934
CORS-2934: IBMCloud: Add support for BYOK
2 parents 0afc1b9 + d6251bd commit 6d4a9bf

File tree

89 files changed

+74714
-42707
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+74714
-42707
lines changed

data/data/ibmcloud/bootstrap/main.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ locals {
66
# If we need to setup SecurityGroupRules to SSH to bootstrap, for non-public clusters (no Floating IP)
77
# combine the Control Plane and Compute subnet CIDRs, to create rules for ingress on those CIDR's
88
all_subnet_cidrs = local.public_endpoints ? [] : concat(data.ibm_is_subnet.control_plane_subnets[*].ipv4_cidr_block, data.ibm_is_subnet.compute_subnets[*].ipv4_cidr_block)
9+
10+
# If a boot volume encryption key CRN was supplied, create a list containing that CRN, otherwise an empty list for a dynamic block of boot volumes
11+
boot_volume_key_crns = var.ibmcloud_control_plane_boot_volume_key == "" ? [] : [var.ibmcloud_control_plane_boot_volume_key]
912
}
1013

1114
############################################
@@ -40,6 +43,13 @@ resource "ibm_is_instance" "bootstrap_node" {
4043
security_groups = concat(var.control_plane_security_group_id_list, [ibm_is_security_group.bootstrap.id])
4144
}
4245

46+
dynamic "boot_volume" {
47+
for_each = local.boot_volume_key_crns
48+
content {
49+
encryption = boot_volume.value
50+
}
51+
}
52+
4353
dedicated_host = length(var.control_plane_dedicated_host_id_list) > 0 ? var.control_plane_dedicated_host_id_list[0] : null
4454

4555
vpc = var.vpc_id

data/data/ibmcloud/master/main.tf

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
locals {
2-
prefix = var.cluster_id
3-
port_kubernetes_api = 6443
4-
port_machine_config = 22623
5-
subnet_count = length(var.control_plane_subnet_id_list)
6-
zone_count = length(var.control_plane_subnet_zone_list)
2+
# If a boot volume encryption key CRN was supplied, create a list containing that CRN, otherwise an empty list for a dynamic block of boot volumes
3+
boot_volume_key_crns = var.ibmcloud_control_plane_boot_volume_key == "" ? [] : [var.ibmcloud_control_plane_boot_volume_key]
4+
prefix = var.cluster_id
5+
port_kubernetes_api = 6443
6+
port_machine_config = 22623
7+
subnet_count = length(var.control_plane_subnet_id_list)
8+
zone_count = length(var.control_plane_subnet_zone_list)
79
}
810

911
############################################
@@ -25,6 +27,13 @@ resource "ibm_is_instance" "master_node" {
2527
security_groups = var.control_plane_security_group_id_list
2628
}
2729

30+
dynamic "boot_volume" {
31+
for_each = local.boot_volume_key_crns
32+
content {
33+
encryption = boot_volume.value
34+
}
35+
}
36+
2837
dedicated_host = length(var.control_plane_dedicated_host_id_list) > 0 ? var.control_plane_dedicated_host_id_list[count.index % local.zone_count] : null
2938

3039
vpc = var.vpc_id
@@ -63,4 +72,4 @@ resource "ibm_is_lb_pool_member" "machine_config" {
6372
pool = var.lb_pool_machine_config_id
6473
port = local.port_machine_config
6574
target_address = ibm_is_instance.master_node[count.index].primary_network_interface.0.primary_ipv4_address
66-
}
75+
}

data/data/ibmcloud/variables-ibmcloud.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ variable "ibmcloud_vpc" {
7979
default = null
8080
}
8181

82+
variable "ibmcloud_control_plane_boot_volume_key" {
83+
type = string
84+
description = "IBM Cloud Key Protect key CRN to use to encrypt the control plane's volume(s)."
85+
default = null
86+
}
87+
8288
variable "ibmcloud_control_plane_subnets" {
8389
type = list(string)
8490
description = "The names of the existing subnets for the control plane."

go.mod

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ require (
1919
github.com/IBM-Cloud/bluemix-go v0.0.0-20211102075456-ffc4e11dfb16
2020
github.com/IBM-Cloud/power-go-client v1.5.3
2121
github.com/IBM/go-sdk-core/v5 v5.14.1
22+
github.com/IBM/keyprotect-go-client v0.12.2
2223
github.com/IBM/networking-go-sdk v0.42.2
23-
github.com/IBM/platform-services-go-sdk v0.42.0
24-
github.com/IBM/vpc-go-sdk v0.20.0
24+
github.com/IBM/platform-services-go-sdk v0.52.1
25+
github.com/IBM/vpc-go-sdk v0.42.0
2526
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1264
2627
github.com/aliyun/aliyun-oss-go-sdk v2.1.8+incompatible
2728
github.com/apparentlymart/go-cidr v1.1.0
@@ -59,18 +60,18 @@ require (
5960
github.com/microsoftgraph/msgraph-sdk-go v0.47.0
6061
github.com/nutanix-cloud-native/prism-go-client v0.2.1-0.20220804130801-c8a253627c64
6162
github.com/onsi/gomega v1.28.1
62-
github.com/openshift/api v0.0.0-20231120222239-b86761094ee3
63+
github.com/openshift/api v0.0.0-20231128111040-e1845c5a7acd
6364
github.com/openshift/assisted-image-service v0.0.0-20230829160050-0b98ec74397b
6465
github.com/openshift/assisted-service/api v0.0.0
6566
github.com/openshift/assisted-service/client v0.0.0
6667
github.com/openshift/assisted-service/models v0.0.0
67-
github.com/openshift/client-go v0.0.0-20221019143426-16aed247da5c
68+
github.com/openshift/client-go v0.0.0-20230503144108-75015d2347cb
6869
github.com/openshift/cloud-credential-operator v0.0.0-20200316201045-d10080b52c9e
6970
github.com/openshift/cluster-api-provider-baremetal v0.0.0-20220408122422-7a548effc26e
7071
github.com/openshift/cluster-api-provider-libvirt v0.2.1-0.20230308152226-83c0473d4429
7172
github.com/openshift/cluster-api-provider-ovirt v0.1.1-0.20220323121149-e3f2850dd519
7273
github.com/openshift/hive/apis v0.0.0-20220222213051-def9088fdb5a
73-
github.com/openshift/library-go v0.0.0-20220920133651-093893cf326b
74+
github.com/openshift/library-go v0.0.0-20230508110756-9b7abe2c9cbf
7475
github.com/openshift/machine-api-provider-ibmcloud v0.0.0-20230124105206-50aa171a52e1
7576
github.com/openshift/machine-config-operator v0.0.0
7677
github.com/ovirt/go-ovirt v0.0.0-20210809163552-d4276e35d3db
@@ -175,7 +176,6 @@ require (
175176
github.com/googleapis/gax-go/v2 v2.11.0 // indirect
176177
github.com/hashicorp/errwrap v1.0.0 // indirect
177178
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
178-
github.com/hashicorp/go-hclog v1.2.0 // indirect
179179
github.com/hashicorp/go-retryablehttp v0.7.4 // indirect
180180
github.com/hashicorp/go-uuid v1.0.3 // indirect
181181
github.com/hashicorp/terraform-json v0.14.0 // indirect
@@ -263,6 +263,9 @@ replace (
263263
// sigs.k8s.io/cluster-api-provider-azure => github.com/openshift/cluster-api-provider-azure v0.1.0-alpha.3.0.20210626224711-5d94c794092f // Indirect dependency through MAO from cluster API providers
264264
)
265265

266+
// TODO(cjschaef): Remove before merge
267+
replace github.com/openshift/machine-api-provider-ibmcloud => github.com/cjschaef/machine-api-provider-ibmcloud v0.0.0-20231125212514-e4de41aba4e9
268+
266269
replace sigs.k8s.io/cluster-api-provider-aws/v2 => sigs.k8s.io/cluster-api-provider-aws/v2 v2.0.0-20231024062453-0bf78b04b305
267270

268271
replace sigs.k8s.io/cluster-api-provider-azure => sigs.k8s.io/cluster-api-provider-azure v1.11.1-0.20231026140308-a3f4914170d9

0 commit comments

Comments
 (0)