From 1e64cf57b56f02ba594fe9e0f16a04e18f0e07b7 Mon Sep 17 00:00:00 2001 From: junior Date: Sat, 20 May 2023 22:40:15 -0500 Subject: [PATCH] fmt Signed-off-by: junior --- examples/basic-with-existing-network/oke.tf | 8 +++--- main.tf | 30 ++++++++++----------- modules/oke-node-pool/datasources.tf | 1 + providers.tf.example | 10 ------- 4 files changed, 20 insertions(+), 29 deletions(-) diff --git a/examples/basic-with-existing-network/oke.tf b/examples/basic-with-existing-network/oke.tf index a408671..c21b948 100644 --- a/examples/basic-with-existing-network/oke.tf +++ b/examples/basic-with-existing-network/oke.tf @@ -27,12 +27,12 @@ module "oke-quickstart" { # VCN for OKE arguments create_new_vcn = false existent_vcn_ocid = "" # ocid1.vcn.oc1.... - existent_vcn_compartment_ocid = "" # Optional. Specify if want to create terraform to create the subnets and the VCN is in a different compartment than the OKE cluster + existent_vcn_compartment_ocid = "" # Optional. Specify if want to create terraform to create the subnets and the VCN is in a different compartment than the OKE cluster # Subnet for OKE arguments create_subnets = false existent_oke_k8s_endpoint_subnet_ocid = "" # ocid1.subnet.... - existent_oke_nodes_subnet_ocid = "" # ocid1.subnet.... - existent_oke_load_balancer_subnet_ocid = "" # ocid1.subnet.... - existent_oke_vcn_native_pod_networking_subnet_ocid = "" # Optional. Existent VCN Native POD Networking subnet if the CNI Type is "OCI_VCN_IP_NATIVE" + existent_oke_nodes_subnet_ocid = "" # ocid1.subnet.... + existent_oke_load_balancer_subnet_ocid = "" # ocid1.subnet.... + existent_oke_vcn_native_pod_networking_subnet_ocid = "" # Optional. Existent VCN Native POD Networking subnet if the CNI Type is "OCI_VCN_IP_NATIVE" } diff --git a/main.tf b/main.tf index 0132d92..6bd1a70 100644 --- a/main.tf +++ b/main.tf @@ -110,23 +110,23 @@ module "oke_node_pools" { create_new_node_pool = var.create_new_oke_cluster # OKE Worker Nodes (Compute) - node_pool_name = each.value.node_pool_name - node_pool_min_nodes = each.value.node_pool_min_nodes - node_pool_max_nodes = each.value.node_pool_max_nodes - node_k8s_version = each.value.node_k8s_version + node_pool_name = try(each.value.node_pool_name, "no_pool_name") + node_pool_min_nodes = try(each.value.node_pool_min_nodes, 1) + node_pool_max_nodes = try(each.value.node_pool_max_nodes, 3) + node_k8s_version = try(each.value.node_k8s_version, var.k8s_version) node_pool_shape = each.value.node_pool_shape - node_pool_shape_specific_ad = each.value.node_pool_shape_specific_ad - node_pool_node_shape_config_ocpus = each.value.node_pool_node_shape_config_ocpus - node_pool_node_shape_config_memory_in_gbs = each.value.node_pool_node_shape_config_memory_in_gbs - existent_oke_nodepool_id_for_autoscaler = each.value.existent_oke_nodepool_id_for_autoscaler + node_pool_shape_specific_ad = try(each.value.node_pool_shape_specific_ad, 0) + node_pool_node_shape_config_ocpus = try(each.value.node_pool_node_shape_config_ocpus, 4) + node_pool_node_shape_config_memory_in_gbs = try(each.value.node_pool_node_shape_config_memory_in_gbs, 48) + existent_oke_nodepool_id_for_autoscaler = try(each.value.existent_oke_nodepool_id_for_autoscaler, null) node_pool_autoscaler_enabled = try(each.value.node_pool_autoscaler_enabled, true) - node_pool_oke_init_params = each.value.node_pool_oke_init_params - node_pool_cloud_init_parts = each.value.node_pool_cloud_init_parts - public_ssh_key = local.workers_public_ssh_key - image_operating_system = each.value.image_operating_system - image_operating_system_version = each.value.image_operating_system_version - extra_initial_node_labels = each.value.extra_initial_node_labels - cni_type = each.value.cni_type + node_pool_oke_init_params = try(each.value.node_pool_oke_init_params, "") + node_pool_cloud_init_parts = try(each.value.node_pool_cloud_init_parts, []) + public_ssh_key = try(local.workers_public_ssh_key, "") + image_operating_system = try(each.value.image_operating_system, "Oracle Linux") + image_operating_system_version = try(each.value.image_operating_system_version, "8") + extra_initial_node_labels = try(each.value.extra_initial_node_labels, {}) + cni_type = try(each.value.cni_type, "FLANNEL_OVERLAY") # OKE Network Details # nodes_subnet_id = local.create_subnets ? module.subnets["oke_nodes_subnet"].subnet_id : var.existent_oke_nodes_subnet_ocid diff --git a/modules/oke-node-pool/datasources.tf b/modules/oke-node-pool/datasources.tf index e471763..41e1d80 100644 --- a/modules/oke-node-pool/datasources.tf +++ b/modules/oke-node-pool/datasources.tf @@ -40,6 +40,7 @@ data "cloudinit_config" "nodes" { #!/bin/bash curl --fail -H "Authorization: Bearer Oracle" -L0 http://169.254.169.254/opc/v2/instance/metadata/oke_init_script | base64 --decode >/var/run/oke-init.sh bash /var/run/oke-init.sh ${var.node_pool_oke_init_params} +/usr/libexec/oci-growfs -y EOF } diff --git a/providers.tf.example b/providers.tf.example index f45e398..160758b 100644 --- a/providers.tf.example +++ b/providers.tf.example @@ -17,16 +17,6 @@ provider "oci" { private_key_path = var.private_key_path } -# provider "oci" { -# alias = "current_region" -# tenancy_ocid = var.tenancy_ocid -# region = var.region - -# user_ocid = var.user_ocid -# fingerprint = var.fingerprint -# private_key_path = var.private_key_path -# } - # New configuration to avoid Terraform Kubernetes provider interpolation. https://registry.terraform.io/providers/hashicorp/kubernetes/2.2.0/docs#stacking-with-managed-kubernetes-cluster-resources # Currently need to uncheck to refresh (--refresh=false) when destroying or else the terraform destroy will fail