This repository was archived by the owner on Oct 31, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 118
This allows the user to specify an existing VCN instead of it being created #171
Open
garthy
wants to merge
10
commits into
master
Choose a base branch
from
gb/optional-vcn
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
965a2f8
Allow overriding of the DNS labels for the subnets
garthy eef22a8
Add Documentation
garthy 2c59b46
Use the correct path
garthy d01a12d
Add prefix to bash source
garthy 24b396f
Temporarily disable master LB in test cluster.
jlamillan 0d860d8
Allow passing in VCN instead of creating
garthy 8519170
Add example
garthy c357277
Document VCN input variables
garthy 428f84a
Update docs with review comments and make outputs consistant
garthy bb494f1
Fix example to use correct name
garthy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,4 @@ | ||
|
|
||
| locals { | ||
| master_lb_ip = "${var.master_oci_lb_enabled == "true" ? element(concat(flatten(module.k8smaster-public-lb.ip_addresses), list("")), 0) : "127.0.0.1"}" | ||
| master_lb_address = "${format("https://%s:%s", local.master_lb_ip, var.master_oci_lb_enabled == "true" ? "443" : "6443")}" | ||
|
|
||
| reverse_proxy_clount_init = "${var.master_oci_lb_enabled == "true" ? "" : module.reverse-proxy.clount_init}" | ||
| reverse_proxy_setup = "${var.master_oci_lb_enabled == "true" ? "" : module.reverse-proxy.setup}" | ||
|
|
||
| etcd_endpoints = "${var.etcd_lb_enabled == "true" ? | ||
| join(",",formatlist("http://%s:2379", module.etcd-lb.ip_addresses)) : | ||
| join(",",formatlist("http://%s:2379", compact(concat( | ||
| module.instances-etcd-ad1.private_ips, | ||
| module.instances-etcd-ad2.private_ips, | ||
| module.instances-etcd-ad3.private_ips)))) }" | ||
| } | ||
|
|
||
| ### CA and Cluster Certificates | ||
|
|
||
| module "k8s-tls" { | ||
|
|
@@ -31,10 +16,29 @@ module "k8s-tls" { | |
| ### Virtual Cloud Network | ||
|
|
||
| module "vcn" { | ||
| create_vcn = "${var.vcn_id == "" ? 1 : 0}" | ||
|
||
| source = "./network/vcn" | ||
| compartment_ocid = "${var.compartment_ocid}" | ||
| label_prefix = "${var.label_prefix}" | ||
| vcn_dns_name = "${var.vcn_dns_name}" | ||
| vcn_cidr = "${var.vcn_cidr}" | ||
| } | ||
|
|
||
|
|
||
| module "subnets" { | ||
| source = "./network/subnets" | ||
| compartment_ocid = "${var.compartment_ocid}" | ||
| label_prefix = "${var.label_prefix}" | ||
| tenancy_ocid = "${var.tenancy_ocid}" | ||
|
|
||
| # Use a existing VCN and public route table and dhcp options | ||
| vcn_id = "${var.vcn_id == "" ? join(" ",module.vcn.vcn_id) : var.vcn_id}" | ||
| dhcp_options_id = "${var.vcn_id == "" ? join(" ",module.vcn.dhcp_options_id) : var.dhcp_options_id}" | ||
| public_routetable_id = "${var.vcn_id == "" ? join(" ",module.vcn.public_routetable_id) : var.public_routetable_id}" | ||
| #vcn_id = "${module.vcn.vcn_id}" | ||
| #dhcp_options_id = "${module.vcn.dhcp_options_id}" | ||
| #public_routetable_id = "${module.vcn.public_routetable_id}" | ||
|
|
||
| vcn_dns_name = "${var.vcn_dns_name}" | ||
| additional_etcd_security_lists_ids = "${var.additional_etcd_security_lists_ids}" | ||
| additional_k8smaster_security_lists_ids = "${var.additional_k8s_master_security_lists_ids}" | ||
|
|
@@ -61,6 +65,7 @@ module "vcn" { | |
| master_nodeport_ingress = "${var.master_nodeport_ingress}" | ||
| external_icmp_ingress = "${var.external_icmp_ingress}" | ||
| internal_icmp_ingress = "${var.internal_icmp_ingress}" | ||
| network_subnet_dns = "${var.network_subnet_dns}" | ||
| } | ||
|
|
||
| module "oci-cloud-controller" { | ||
|
|
@@ -77,14 +82,14 @@ module "oci-cloud-controller" { | |
| // var.cloud_controller_user_private_key_path has been provided but has an empty password | ||
| cloud_controller_user_private_key_password = "${var.cloud_controller_user_private_key_path == "" ? var.private_key_password : var.cloud_controller_user_private_key_password}" | ||
|
|
||
| subnet1 = "${element(module.vcn.ccmlb_subnet_ad1_id,0)}" | ||
| subnet2 = "${element(module.vcn.ccmlb_subnet_ad2_id,0)}" | ||
| subnet1 = "${element(module.subnets.ccmlb_subnet_ad1_id,0)}" | ||
| subnet2 = "${element(module.subnets.ccmlb_subnet_ad2_id,0)}" | ||
| } | ||
|
|
||
| module "oci-flexvolume-driver" { | ||
| source = "./kubernetes/oci-flexvolume-driver" | ||
| tenancy = "${var.tenancy_ocid}" | ||
| vcn = "${module.vcn.id}" | ||
| vcn = "${module.subnets.id}" | ||
|
|
||
| flexvolume_driver_user_ocid = "${var.flexvolume_driver_user_ocid == "" ? var.user_ocid : var.flexvolume_driver_user_ocid}" | ||
| flexvolume_driver_user_fingerprint = "${var.flexvolume_driver_user_fingerprint == "" ? var.fingerprint : var.flexvolume_driver_user_fingerprint}" | ||
|
|
@@ -128,7 +133,7 @@ module "instances-etcd-ad1" { | |
| shape = "${var.etcdShape}" | ||
| ssh_public_key_openssh = "${module.k8s-tls.ssh_public_key_openssh}" | ||
| network_cidrs = "${var.network_cidrs}" | ||
| subnet_id = "${module.vcn.etcd_subnet_ad1_id}" | ||
| subnet_id = "${module.subnets.etcd_subnet_ad1_id}" | ||
| subnet_name = "etcdSubnetAD1" | ||
| tenancy_ocid = "${var.compartment_ocid}" | ||
| etcd_docker_max_log_size = "${var.etcd_docker_max_log_size}" | ||
|
|
@@ -156,7 +161,7 @@ module "instances-etcd-ad2" { | |
| shape = "${var.etcdShape}" | ||
| ssh_public_key_openssh = "${module.k8s-tls.ssh_public_key_openssh}" | ||
| network_cidrs = "${var.network_cidrs}" | ||
| subnet_id = "${module.vcn.etcd_subnet_ad2_id}" | ||
| subnet_id = "${module.subnets.etcd_subnet_ad2_id}" | ||
| subnet_name = "etcdSubnetAD2" | ||
| tenancy_ocid = "${var.compartment_ocid}" | ||
| etcd_docker_max_log_size = "${var.etcd_docker_max_log_size}" | ||
|
|
@@ -186,7 +191,7 @@ module "instances-etcd-ad3" { | |
| shape = "${var.etcdShape}" | ||
| ssh_public_key_openssh = "${module.k8s-tls.ssh_public_key_openssh}" | ||
| network_cidrs = "${var.network_cidrs}" | ||
| subnet_id = "${module.vcn.etcd_subnet_ad3_id}" | ||
| subnet_id = "${module.subnets.etcd_subnet_ad3_id}" | ||
| subnet_name = "etcdSubnetAD3" | ||
| tenancy_ocid = "${var.compartment_ocid}" | ||
| etcd_docker_max_log_size = "${var.etcd_docker_max_log_size}" | ||
|
|
@@ -225,7 +230,7 @@ module "instances-k8smaster-ad1" { | |
| ssh_private_key = "${module.k8s-tls.ssh_private_key}" | ||
| ssh_public_key_openssh = "${module.k8s-tls.ssh_public_key_openssh}" | ||
| network_cidrs = "${var.network_cidrs}" | ||
| subnet_id = "${module.vcn.k8smaster_subnet_ad1_id}" | ||
| subnet_id = "${module.subnets.k8smaster_subnet_ad1_id}" | ||
| subnet_name = "masterSubnetAD1" | ||
| tenancy_ocid = "${var.compartment_ocid}" | ||
| cloud_controller_version = "${var.cloud_controller_version}" | ||
|
|
@@ -267,7 +272,7 @@ module "instances-k8smaster-ad2" { | |
| ssh_private_key = "${module.k8s-tls.ssh_private_key}" | ||
| ssh_public_key_openssh = "${module.k8s-tls.ssh_public_key_openssh}" | ||
| network_cidrs = "${var.network_cidrs}" | ||
| subnet_id = "${module.vcn.k8smaster_subnet_ad2_id}" | ||
| subnet_id = "${module.subnets.k8smaster_subnet_ad2_id}" | ||
| subnet_name = "masterSubnetAD2" | ||
| tenancy_ocid = "${var.compartment_ocid}" | ||
| cloud_controller_version = "${var.cloud_controller_version}" | ||
|
|
@@ -309,7 +314,7 @@ module "instances-k8smaster-ad3" { | |
| ssh_private_key = "${module.k8s-tls.ssh_private_key}" | ||
| ssh_public_key_openssh = "${module.k8s-tls.ssh_public_key_openssh}" | ||
| network_cidrs = "${var.network_cidrs}" | ||
| subnet_id = "${module.vcn.k8smaster_subnet_ad3_id}" | ||
| subnet_id = "${module.subnets.k8smaster_subnet_ad3_id}" | ||
| subnet_name = "masterSubnetAD3" | ||
| tenancy_ocid = "${var.compartment_ocid}" | ||
| cloud_controller_version = "${var.cloud_controller_version}" | ||
|
|
@@ -350,7 +355,7 @@ module "instances-k8sworker-ad1" { | |
| shape = "${var.k8sWorkerShape}" | ||
| ssh_private_key = "${module.k8s-tls.ssh_private_key}" | ||
| ssh_public_key_openssh = "${module.k8s-tls.ssh_public_key_openssh}" | ||
| subnet_id = "${module.vcn.k8worker_subnet_ad1_id}" | ||
| subnet_id = "${module.subnets.k8worker_subnet_ad1_id}" | ||
| tenancy_ocid = "${var.compartment_ocid}" | ||
| flexvolume_driver_version = "${var.flexvolume_driver_version}" | ||
| etcd_endpoints = "${local.etcd_endpoints}" | ||
|
|
@@ -387,7 +392,7 @@ module "instances-k8sworker-ad2" { | |
| shape = "${var.k8sWorkerShape}" | ||
| ssh_private_key = "${module.k8s-tls.ssh_private_key}" | ||
| ssh_public_key_openssh = "${module.k8s-tls.ssh_public_key_openssh}" | ||
| subnet_id = "${module.vcn.k8worker_subnet_ad2_id}" | ||
| subnet_id = "${module.subnets.k8worker_subnet_ad2_id}" | ||
| tenancy_ocid = "${var.compartment_ocid}" | ||
| flexvolume_driver_version = "${var.flexvolume_driver_version}" | ||
| etcd_endpoints = "${local.etcd_endpoints}" | ||
|
|
@@ -424,7 +429,7 @@ module "instances-k8sworker-ad3" { | |
| shape = "${var.k8sWorkerShape}" | ||
| ssh_private_key = "${module.k8s-tls.ssh_private_key}" | ||
| ssh_public_key_openssh = "${module.k8s-tls.ssh_public_key_openssh}" | ||
| subnet_id = "${module.vcn.k8worker_subnet_ad3_id}" | ||
| subnet_id = "${module.subnets.k8worker_subnet_ad3_id}" | ||
| tenancy_ocid = "${var.compartment_ocid}" | ||
| flexvolume_driver_version = "${var.flexvolume_driver_version}" | ||
| etcd_endpoints = "${local.etcd_endpoints}" | ||
|
|
@@ -442,8 +447,8 @@ module "etcd-lb" { | |
| is_private = "${var.etcd_lb_access == "private" ? "true": "false"}" | ||
|
|
||
| # Handle case where var.etcd_lb_access=public, but var.control_plane_subnet_access=private | ||
| etcd_subnet_0_id = "${var.etcd_lb_access == "private" ? module.vcn.etcd_subnet_ad1_id: coalesce(join(" ", module.vcn.public_subnet_ad1_id), join(" ", list(module.vcn.etcd_subnet_ad1_id)))}" | ||
| etcd_subnet_1_id = "${var.etcd_lb_access == "private" ? "": coalesce(join(" ", module.vcn.public_subnet_ad2_id), join(" ", list(module.vcn.etcd_subnet_ad2_id)))}" | ||
| etcd_subnet_0_id = "${var.etcd_lb_access == "private" ? module.subnets.etcd_subnet_ad1_id: coalesce(join(" ", module.subnets.public_subnet_ad1_id), join(" ", list(module.subnets.etcd_subnet_ad1_id)))}" | ||
| etcd_subnet_1_id = "${var.etcd_lb_access == "private" ? "": coalesce(join(" ", module.subnets.public_subnet_ad2_id), join(" ", list(module.subnets.etcd_subnet_ad2_id)))}" | ||
| etcd_ad1_private_ips = "${module.instances-etcd-ad1.private_ips}" | ||
| etcd_ad2_private_ips = "${module.instances-etcd-ad2.private_ips}" | ||
| etcd_ad3_private_ips = "${module.instances-etcd-ad3.private_ips}" | ||
|
|
@@ -461,8 +466,8 @@ module "k8smaster-public-lb" { | |
| is_private = "${var.k8s_master_lb_access == "private" ? "true": "false"}" | ||
|
|
||
| # Handle case where var.k8s_master_lb_access=public, but var.control_plane_subnet_access=private | ||
| k8smaster_subnet_0_id = "${var.k8s_master_lb_access == "private" ? module.vcn.k8smaster_subnet_ad1_id: coalesce(join(" ", module.vcn.public_subnet_ad1_id), join(" ", list(module.vcn.k8smaster_subnet_ad1_id)))}" | ||
| k8smaster_subnet_1_id = "${var.k8s_master_lb_access == "private" ? "": coalesce(join(" ", module.vcn.public_subnet_ad2_id), join(" ", list(module.vcn.k8smaster_subnet_ad2_id)))}" | ||
| k8smaster_subnet_0_id = "${var.k8s_master_lb_access == "private" ? module.subnets.k8smaster_subnet_ad1_id: coalesce(join(" ", module.subnets.public_subnet_ad1_id), join(" ", list(module.subnets.k8smaster_subnet_ad1_id)))}" | ||
| k8smaster_subnet_1_id = "${var.k8s_master_lb_access == "private" ? "": coalesce(join(" ", module.subnets.public_subnet_ad2_id), join(" ", list(module.subnets.k8smaster_subnet_ad2_id)))}" | ||
| k8smaster_ad1_private_ips = "${module.instances-k8smaster-ad1.private_ips}" | ||
| k8smaster_ad2_private_ips = "${module.instances-k8smaster-ad2.private_ips}" | ||
| k8smaster_ad3_private_ips = "${module.instances-k8smaster-ad3.private_ips}" | ||
|
|
@@ -484,3 +489,20 @@ module "kubeconfig" { | |
| api_server_cert_pem = "${module.k8s-tls.api_server_cert_pem}" | ||
| k8s_master = "${var.master_oci_lb_enabled == "true" ? local.master_lb_address : format("https://%s:%s", element(coalescelist(module.instances-k8smaster-ad1.public_ips, module.instances-k8smaster-ad2.public_ips, module.instances-k8smaster-ad3.public_ips), 0), "443")}" | ||
| } | ||
|
|
||
|
|
||
|
|
||
| locals { | ||
| master_lb_ip = "${var.master_oci_lb_enabled == "true" ? element(concat(flatten(module.k8smaster-public-lb.ip_addresses), list("")), 0) : "127.0.0.1"}" | ||
| master_lb_address = "${format("https://%s:%s", local.master_lb_ip, var.master_oci_lb_enabled == "true" ? "443" : "6443")}" | ||
|
|
||
| reverse_proxy_clount_init = "${var.master_oci_lb_enabled == "true" ? "" : module.reverse-proxy.clount_init}" | ||
| reverse_proxy_setup = "${var.master_oci_lb_enabled == "true" ? "" : module.reverse-proxy.setup}" | ||
|
|
||
| etcd_endpoints = "${var.etcd_lb_enabled == "true" ? | ||
| join(",",formatlist("http://%s:2379", module.etcd-lb.ip_addresses)) : | ||
| join(",",formatlist("http://%s:2379", compact(concat( | ||
| module.instances-etcd-ad1.private_ips, | ||
| module.instances-etcd-ad2.private_ips, | ||
| module.instances-etcd-ad3.private_ips)))) }" | ||
| } | ||
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A DNS label for each of the subnet in the VCN => A DNS label for each of the subnets in the VCN