From 150029b41a4eee45ca9e80cdc75d2bfb47a30643 Mon Sep 17 00:00:00 2001 From: junior Date: Mon, 5 Dec 2022 23:56:13 -0600 Subject: [PATCH 1/3] update defaults for node pools Signed-off-by: junior --- cluster-tools.tf | 2 +- datasources.tf | 2 +- examples/5G-NF-Infra/networking.tf | 2 +- examples/5G-NF-Infra/variables.tf | 4 ++-- main.tf | 6 +++--- modules/oke/outputs.tf | 21 --------------------- outputs.tf | 8 ++++++++ 7 files changed, 16 insertions(+), 29 deletions(-) diff --git a/cluster-tools.tf b/cluster-tools.tf index 6a39663..793e13b 100644 --- a/cluster-tools.tf +++ b/cluster-tools.tf @@ -46,7 +46,7 @@ module "cluster-tools" { ## Grafana grafana_enabled = var.grafana_enabled - depends_on = [module.oke, module.oke_node_pool, module.oke_cluster_autoscaler] + depends_on = [module.oke, module.oke_node_pools, module.oke_cluster_autoscaler] } # Kubernetes Cluster Tools diff --git a/datasources.tf b/datasources.tf index dd905df..1d175fc 100644 --- a/datasources.tf +++ b/datasources.tf @@ -25,4 +25,4 @@ data "oci_core_services" "all_services_network" { values = ["All .* Services In Oracle Services Network"] regex = true } -} \ No newline at end of file +} diff --git a/examples/5G-NF-Infra/networking.tf b/examples/5G-NF-Infra/networking.tf index ddb9469..1d7ca01 100644 --- a/examples/5G-NF-Infra/networking.tf +++ b/examples/5G-NF-Infra/networking.tf @@ -7,7 +7,7 @@ locals { vcn_cidr_blocks = split(",", var.vcn_cidr_blocks) network_cidrs = { VCN-MAIN-CIDR = local.vcn_cidr_blocks[0] # e.g.: "10.75.0.0/16" = 65536 usable IPs - VCN-NATIVE-POD-NETWORKING-REGIONAL-SUBNET-CIDR = cidrsubnet(local.vcn_cidr_blocks[0], 1, 1) # e.g.: "10.20.128.0/17" = 32766 usable IPs (10.20.128.0 - 10.20.255.255) + VCN-NATIVE-POD-NETWORKING-REGIONAL-SUBNET-CIDR = cidrsubnet(local.vcn_cidr_blocks[0], 1, 1) # e.g.: "10.75.128.0/17" = 32766 usable IPs (10.20.128.0 - 10.20.255.255) SUBNET-5GC-OAM-CIDR = cidrsubnet(local.vcn_cidr_blocks[0], 9, 128) # e.g.: "10.75.64.0/25" = 128 usable IPs SUBNET-5GC-SIGNALLING-CIDR = cidrsubnet(local.vcn_cidr_blocks[0], 9, 129) # e.g.: "10.75.64.128/25" = 128 usable IPs SUBNET-5G-RAN-CIDR = cidrsubnet(local.vcn_cidr_blocks[0], 11, 520) # e.g.: "10.75.65.0/27" = 32 usable IPs diff --git a/examples/5G-NF-Infra/variables.tf b/examples/5G-NF-Infra/variables.tf index 133be8d..3ed5e7c 100644 --- a/examples/5G-NF-Infra/variables.tf +++ b/examples/5G-NF-Infra/variables.tf @@ -35,8 +35,8 @@ variable "node_pool_instance_shape_1" { type = map(any) default = { "instanceShape" = "VM.Standard3.Flex" - "ocpus" = 6 + "ocpus" = 8 "memory" = 96 } - description = "Pooll: A shape is a template that determines the number of OCPUs, amount of memory, and other resources allocated to a newly created instance for the Worker Node. Select at least 2 OCPUs and 16GB of memory if using Flex shapes" + description = "Pooll: A shape is a template that determines the number of OCPUs, amount of memory, and other resources allocated to a newly created instance for the Worker Node. Select at least 2 OCPUs and 16GB of memory if using Flex shapes." } diff --git a/main.tf b/main.tf index 2fc6968..f7de680 100644 --- a/main.tf +++ b/main.tf @@ -93,7 +93,7 @@ module "oke" { ################################################################################ # Module: OKE Node Pool ################################################################################ -module "oke_node_pool" { +module "oke_node_pools" { for_each = { for map in local.node_pools : map.node_pool_name => map } source = "./modules/oke-node-pool" @@ -176,9 +176,9 @@ module "oke_cluster_autoscaler" { ## Enable Cluster Autoscaler cluster_autoscaler_enabled = var.cluster_autoscaler_enabled - oke_node_pools = values(module.oke_node_pool) + oke_node_pools = values(module.oke_node_pools) - depends_on = [module.oke, module.oke_node_pool] + depends_on = [module.oke, module.oke_node_pools] } resource "oci_identity_compartment" "oke_compartment" { diff --git a/modules/oke/outputs.tf b/modules/oke/outputs.tf index 0da969f..f8176c8 100755 --- a/modules/oke/outputs.tf +++ b/modules/oke/outputs.tf @@ -39,24 +39,3 @@ output "oke_cluster_compartment_ocid" { value = local.oke_compartment_ocid description = "Compartment OCID used by the OKE Cluster" } - -# ### Important Security Notice ### -# # The private key generated by this resource will be stored unencrypted in your Terraform state file. -# # Use of this resource for production deployments is not recommended. -# # Instead, generate a private key file outside of Terraform and distribute it securely to the system where Terraform will be run. -# output "generated_private_key_pem" { -# value = var.generate_public_ssh_key ? tls_private_key.oke_worker_node_ssh_key.private_key_pem : "No Keys Auto Generated" -# sensitive = true -# } - -# output "oke_debug_oke_private_endpoint" { -# value = oci_containerengine_cluster.oke_cluster[0].endpoints.0.private_endpoint -# } - -# output "oke_debug_orm_private_endpoint_reachable_ip" { -# value = data.oci_resourcemanager_private_endpoint_reachable_ip.private_kubernetes_endpoint.0.ip_address -# } - -# output "oke_debug_oke_endpoints" { -# value = oci_containerengine_cluster.oke_cluster.0.endpoints -# } diff --git a/outputs.tf b/outputs.tf index 245b96b..5984e61 100755 --- a/outputs.tf +++ b/outputs.tf @@ -28,6 +28,13 @@ output "kubeconfig_for_kubectl" { value = module.oke.kubeconfig_for_kubectl description = "If using Terraform locally, this command set KUBECONFIG environment variable to run kubectl locally" } +output "oke_cluster_ocid" { + value = module.oke.oke_cluster_ocid +} +output "oke_node_pools" { + value = module.oke_node_pools +} + output "dev" { value = module.oke.dev } @@ -39,3 +46,4 @@ output "generated_private_key_pem" { value = var.generate_public_ssh_key ? tls_private_key.oke_worker_node_ssh_key.private_key_pem : "No Keys Auto Generated" sensitive = true } + From ea25d4d638812211a262ffba2e275528b283bd88 Mon Sep 17 00:00:00 2001 From: junior Date: Tue, 6 Dec 2022 00:12:49 -0600 Subject: [PATCH 2/3] 5G NF Infra example - vnic attachments Signed-off-by: junior --- examples/5G-NF-Infra/networking.tf | 66 +++++++++++++++++++++++++++++- examples/5G-NF-Infra/oke.tf | 2 +- 2 files changed, 66 insertions(+), 2 deletions(-) diff --git a/examples/5G-NF-Infra/networking.tf b/examples/5G-NF-Infra/networking.tf index 1d7ca01..251ea83 100644 --- a/examples/5G-NF-Infra/networking.tf +++ b/examples/5G-NF-Infra/networking.tf @@ -247,4 +247,68 @@ locals { ipv6cidr_block = null }, ] -} \ No newline at end of file +} + +# Node Pool 1 info for 5G VNICs attachments +data "oci_containerengine_node_pool" "node_pool_1" { + node_pool_id = module.oke-quickstart.oke_node_pools["pool1"].node_pool_id +} +locals { + node_pool_nodes = data.oci_containerengine_node_pool.node_pool_1.nodes + node_pool_nodes_ids = data.oci_containerengine_node_pool.node_pool_1.nodes.*.id +} +resource "oci_core_vnic_attachment" "vnic_attachment_5gc_oam" { + for_each = { for map in local.node_pool_nodes : map.id => map } + create_vnic_details { + display_name = "5GC-OAM vnic" + private_ip = [for hostnum in range(4, 15) : cidrhost(lookup(local.network_cidrs, "SUBNET-5GC-OAM-CIDR"), hostnum)][index(local.node_pool_nodes_ids, each.key)] + subnet_id = module.oke-quickstart.subnets["5GC_OAM_subnet"].subnet_id + defined_tags = {} + freeform_tags = { "Network" : "5GC-OAM" } + } + instance_id = each.value.id +} +resource "oci_core_vnic_attachment" "vnic_attachment_5gc_signalling" { + for_each = { for map in local.node_pool_nodes : map.id => map } + create_vnic_details { + display_name = "5GC-Signalling vnic" + private_ip = [for hostnum in range(4, 15) : cidrhost(lookup(local.network_cidrs, "SUBNET-5GC-SIGNALLING-CIDR"), hostnum)][index(local.node_pool_nodes_ids, each.key)] + subnet_id = module.oke-quickstart.subnets["5GC_Signalling_subnet"].subnet_id + defined_tags = {} + freeform_tags = { "Network" : "5GC-Signalling" } + } + instance_id = each.value.id +} +resource "oci_core_vnic_attachment" "vnic_attachment_5g_ran" { + for_each = { for map in local.node_pool_nodes : map.id => map } + create_vnic_details { + display_name = "5G RAN vnic" + private_ip = [for hostnum in range(4, 15) : cidrhost(lookup(local.network_cidrs, "SUBNET-5G-RAN-CIDR"), hostnum)][index(local.node_pool_nodes_ids, each.key)] + subnet_id = module.oke-quickstart.subnets["5G_RAN_subnet"].subnet_id + defined_tags = {} + freeform_tags = { "Network" : "5G RAN" } + } + instance_id = each.value.id +} +resource "oci_core_vnic_attachment" "vnic_attachment_5g_legal_intercept" { + for_each = { for map in local.node_pool_nodes : map.id => map } + create_vnic_details { + display_name = "5G Legal Intercept vnic" + private_ip = [for hostnum in range(4, 15) : cidrhost(lookup(local.network_cidrs, "SUBNET-LEGAL-INTERCEPT-CIDR"), hostnum)][index(local.node_pool_nodes_ids, each.key)] + subnet_id = module.oke-quickstart.subnets["Legal_Intercept_subnet"].subnet_id + defined_tags = {} + freeform_tags = { "Network" : "5G Legal Intercept" } + } + instance_id = each.value.id +} +resource "oci_core_vnic_attachment" "vnic_attachment_5g_epc" { + for_each = { for map in local.node_pool_nodes : map.id => map } + create_vnic_details { + display_name = "5G-EPC vnic" + private_ip = [for hostnum in range(4, 15) : cidrhost(lookup(local.network_cidrs, "SUBNET-5G-EPC-CIDR"), hostnum)][index(local.node_pool_nodes_ids, each.key)] + subnet_id = module.oke-quickstart.subnets["5G_EPC_subnet"].subnet_id + defined_tags = {} + freeform_tags = { "Network" : "5G-EPC" } + } + instance_id = each.value.id +} diff --git a/examples/5G-NF-Infra/oke.tf b/examples/5G-NF-Infra/oke.tf index 553e202..2d35146 100644 --- a/examples/5G-NF-Infra/oke.tf +++ b/examples/5G-NF-Infra/oke.tf @@ -6,7 +6,7 @@ # OKE Cluster ################################################################################ module "oke-quickstart" { - source = "github.com/oracle-quickstart/terraform-oci-oke-quickstart?ref=0.8.9" + source = "github.com/oracle-quickstart/terraform-oci-oke-quickstart?ref=0.8.10" # Oracle Cloud Infrastructure Tenancy and Compartment OCID tenancy_ocid = var.tenancy_ocid From 112b9c72fcce77cb65194ffb043f42262f2771e9 Mon Sep 17 00:00:00 2001 From: junior Date: Tue, 6 Dec 2022 00:14:04 -0600 Subject: [PATCH 3/3] patch version bump Signed-off-by: junior --- .terraform.lock.hcl | 34 +++++++++++++++++----------------- VERSION | 2 +- outputs.tf | 3 +++ 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/.terraform.lock.hcl b/.terraform.lock.hcl index ecca9a9..c99c938 100644 --- a/.terraform.lock.hcl +++ b/.terraform.lock.hcl @@ -26,26 +26,26 @@ provider "registry.terraform.io/hashicorp/helm" { } provider "registry.terraform.io/hashicorp/kubernetes" { - version = "2.16.0" + version = "2.16.1" constraints = "~> 2.0" hashes = [ - "h1:F4f7CCZm3/P8iFlbRJymErXGg5FdqY4FILtwyl6JSO8=", - "h1:GcpVjl1LbyGDGGaR0KDJrdVaTKW2ge9g51Ej4yrai6Q=", - "h1:a5R1sKA7J5RGTBhFmoH1D4jOzsEg0pi18qTV7EKC/Xo=", - "h1:oo9HgPpYIbxhK9L/a+opbQ0BjVZqid+3h5gr0bchhDs=", - "h1:zkcz+e1K0SZljjWDqQ4Cytt/kwp1D6og3m9dqHYp+/Q=", - "zh:172830e270e49b3d6c975383f6c2f1683524ab667e48a481285d535392f29cf4", - "zh:1b2919c66f6bf49a24adb3f0663e198383562829bc1c06c680cf0a2019571d4f", - "zh:2c0b1c6032358c11539d1f99ddd803dc37b06127e8d220e9b9a81a233a290a58", - "zh:2c6b49d0014a4398e35d05ce2303d10482c91b49320555e2389a8b85f28117ea", - "zh:497e76411feb3f79b8eaa3bb29a387c6d89b888f7d9d028142dc5590ff149e45", - "zh:771428ba9ed855743fd7e6b7ee7d3d837e401c787da618a8cff5f6e7375a6245", - "zh:cb15f6d7eaa6aa385215f6d77dcfd5615e40d170800ce9fbee3d73b5c6ad379f", - "zh:e8de8530e27903d4581b4494a267ab84ab3faeaaa598986fea74a99cfa3b37dc", - "zh:efd5d1b02d3b68d0b8913372421d292766ba572e54b60b16bc38b439b9865095", - "zh:f4568bda22c959dc510f9fb8c1ac141ded7c99df4ba430efcd470b13776ce9cb", + "h1:O23HBuu2cPnLfW/lqvMM6eAeVx7eZgjqsK+Nz/FX2Gg=", + "h1:PO4Ye/+lu5hCaUEOtwNOldQYoA0dqL1bcBICIpdlcd8=", + "h1:i+DwtJK82sIWmTcQA9lL0mlET+14/QpUqv10fU2o3As=", + "h1:kO/d+ZMZYM2tNMMFHZqBmVR0MeemoGnI2G2NSN92CrU=", + "h1:lO10r6c/Wl8WZItrDabRqCirMVVuLAl9Yr3v2eRSUlc=", + "zh:06224975f5910d41e73b35a4d5079861da2c24f9353e3ebb015fbb3b3b996b1c", + "zh:2bc400a8d9fe7755cca27c2551564a9e2609cfadc77f526ef855114ee02d446f", + "zh:3a479014187af1d0aec3a1d3d9c09551b801956fe6dd29af1186dec86712731b", + "zh:73fb0a69f1abdb02858b6589f7fab6d989a0f422f7ad95ed662aaa84872d3473", + "zh:a33852cd382cbc8e06d3f6c018b468ad809d24d912d64722e037aed1f9bf39db", + "zh:b533ff2214dca90296b1d22eace7eaa7e3efe5a7ae9da66a112094abc932db4f", + "zh:ddf74d8bb1aeb01dc2c36ef40e2b283d32b2a96db73f6daaf179fa2f10949c80", + "zh:e720f3a15d34e795fa9ff90bc755e838ebb4aef894aa2a423fb16dfa6d6b0667", + "zh:e789ae70a658800cb0a19ef7e4e9b26b5a38a92b43d1f41d64fc8bb46539cefb", + "zh:e8aed7dc0bd8f843d607dee5f72640dbef6835a8b1c6ea12cea5b4ec53e463f7", "zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c", - "zh:fa08fa52d3b4f93d24373a34360855787971532a1f5fe085a4549b04ebf329cc", + "zh:fb3ac4f43c8b0dfc0b0103dd0f062ea72b3a34518d4c8808e3a44c9a3dd5f024", ] } diff --git a/VERSION b/VERSION index 021abec..e6663d4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.8.9 \ No newline at end of file +0.8.10 \ No newline at end of file diff --git a/outputs.tf b/outputs.tf index 5984e61..cdc945f 100755 --- a/outputs.tf +++ b/outputs.tf @@ -34,6 +34,9 @@ output "oke_cluster_ocid" { output "oke_node_pools" { value = module.oke_node_pools } +output "subnets" { + value = module.subnets +} output "dev" { value = module.oke.dev