Skip to content
This repository was archived by the owner on Oct 31, 2019. It is now read-only.

optionally use ip as node name #193

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/input-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ worker_iscsi_volume_size | unset | optional size of
worker_iscsi_volume_mount | /var/lib/docker | optional mount path of iSCSI volume when worker_iscsi_volume_size is set
etcd_iscsi_volume_create | false | boolean flag indicating whether or not to attach an iSCSI volume to attach to each etcd node
etcd_iscsi_volume_size | 50 | size in GBs of volume when etcd_iscsi_volume_create is set
use_hostname_as_nodename | true | use the hostname for the node name, otherwise use just the ip

### TLS Certificates & SSH key pair
name | default | description
Expand Down
1 change: 1 addition & 0 deletions instances/k8smaster/datasources.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ data "template_file" "setup-template" {
cloud_controller_version = "${var.cloud_controller_version}"
flexvolume_driver_version = "${var.flexvolume_driver_version}"
volume_provisioner_version = "${var.volume_provisioner_version}"
use_hostname_as_nodename = "${var.use_hostname_as_nodename ? "true" : "false"}"
}
}

Expand Down
8 changes: 7 additions & 1 deletion instances/k8smaster/scripts/setup.template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

EXTERNAL_IP=$(curl -s -m 10 http://whatismyip.akamai.com/)
NAMESPACE=$(echo -n "${domain_name}" | sed "s/\.oraclevcn\.com//g")
FQDN_HOSTNAME=$(getent hosts $(ip route get 1 | awk '{print $NF;exit}') | awk '{print $2}')
FQDN_HOSTNAME=$(ip route get 1 | awk '{print $NF;exit}')

## Should we even use Terraform anymore?
if [[ "${use_hostname_as_nodename}" = "true" ]];
then
FQDN_HOSTNAME=$(getent hosts $FQDN_HOSTNAME | awk '{print $2}')
fi

# Pull instance metadata
curl -sL --retry 3 http://169.254.169.254/opc/v1/instance/ | tee /tmp/instance_meta.json
Expand Down
4 changes: 4 additions & 0 deletions instances/k8smaster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,7 @@ variable "assign_private_ip" {
description = "Assign a static private ip based on CIDR block for that AD"
default = false
}

variable "use_hostname_as_nodename" {
default = true
}
1 change: 1 addition & 0 deletions instances/k8sworker/datasources.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ data "template_file" "setup-template" {
worker_iscsi_volume_mount = "${var.worker_iscsi_volume_mount}"
flexvolume_driver_version = "${var.flexvolume_driver_version}"
reverse_proxy_setup = "${var.reverse_proxy_setup}"
use_hostname_as_nodename = "${var.use_hostname_as_nodename ? "true" : "false"}"
}
}

Expand Down
8 changes: 7 additions & 1 deletion instances/k8sworker/scripts/setup.template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

EXTERNAL_IP=$(curl -s -m 10 http://whatismyip.akamai.com/)
NAMESPACE=$(echo -n "${domain_name}" | sed "s/\.oraclevcn\.com//g")
FQDN_HOSTNAME=$(getent hosts $(ip route get 1 | awk '{print $NF;exit}') | awk '{print $2}')
FQDN_HOSTNAME=$(ip route get 1 | awk '{print $NF;exit}')

## Should we even use Terraform anymore?
if [[ "${use_hostname_as_nodename}" = "true" ]];
then
FQDN_HOSTNAME=$(getent hosts $FQDN_HOSTNAME | awk '{print $2}')
fi

# Pull instance metadata
curl -sL --retry 3 http://169.254.169.254/opc/v1/instance/ | tee /tmp/instance_meta.json
Expand Down
4 changes: 4 additions & 0 deletions instances/k8sworker/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,7 @@ variable "flexvolume_driver_version" {}
variable "reverse_proxy_setup" {}

variable "reverse_proxy_clount_init" {}

variable "use_hostname_as_nodename" {
default = true
}
6 changes: 6 additions & 0 deletions k8s-oci.tf
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ module "instances-k8smaster-ad1" {
volume_provisioner_secret = "${module.oci-volume-provisioner.volume-provisioner-yaml}"
assign_private_ip = "${var.master_maintain_private_ip}"
etcd_endpoints = "${local.etcd_endpoints}"
use_hostname_as_nodename = "${var.use_hostname_as_nodename}"
}

module "instances-k8smaster-ad2" {
Expand Down Expand Up @@ -280,6 +281,7 @@ module "instances-k8smaster-ad2" {
volume_provisioner_secret = "${module.oci-volume-provisioner.volume-provisioner-yaml}"
assign_private_ip = "${var.master_maintain_private_ip}"
etcd_endpoints = "${local.etcd_endpoints}"
use_hostname_as_nodename = "${var.use_hostname_as_nodename}"
}

module "instances-k8smaster-ad3" {
Expand Down Expand Up @@ -323,6 +325,7 @@ module "instances-k8smaster-ad3" {
volume_provisioner_secret = "${module.oci-volume-provisioner.volume-provisioner-yaml}"
assign_private_ip = "${var.master_maintain_private_ip}"
etcd_endpoints = "${local.etcd_endpoints}"
use_hostname_as_nodename = "${var.use_hostname_as_nodename}"
}

module "instances-k8sworker-ad1" {
Expand Down Expand Up @@ -360,6 +363,7 @@ module "instances-k8sworker-ad1" {
worker_iscsi_volume_create = "${var.worker_iscsi_volume_create}"
worker_iscsi_volume_size = "${var.worker_iscsi_volume_size}"
worker_iscsi_volume_mount = "${var.worker_iscsi_volume_mount}"
use_hostname_as_nodename = "${var.use_hostname_as_nodename}"
}

module "instances-k8sworker-ad2" {
Expand Down Expand Up @@ -397,6 +401,7 @@ module "instances-k8sworker-ad2" {
worker_iscsi_volume_create = "${var.worker_iscsi_volume_create}"
worker_iscsi_volume_size = "${var.worker_iscsi_volume_size}"
worker_iscsi_volume_mount = "${var.worker_iscsi_volume_mount}"
use_hostname_as_nodename = "${var.use_hostname_as_nodename}"
}

module "instances-k8sworker-ad3" {
Expand Down Expand Up @@ -434,6 +439,7 @@ module "instances-k8sworker-ad3" {
worker_iscsi_volume_create = "${var.worker_iscsi_volume_create}"
worker_iscsi_volume_size = "${var.worker_iscsi_volume_size}"
worker_iscsi_volume_mount = "${var.worker_iscsi_volume_mount}"
use_hostname_as_nodename = "${var.use_hostname_as_nodename}"
}

### Load Balancers
Expand Down
4 changes: 4 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -480,3 +480,7 @@ variable "volume_provisioner_user_private_key_path" {
variable "volume_provisioner_user_private_key_password" {
default = ""
}

variable "use_hostname_as_nodename" {
default = true
}