Simplify google-cloud cluster variables

* Remove k8s_domain_name input variable, the controller DNS
record will be "${var.cluster_name}.${dns_zone}"
* Rename dns_base_zone to dns_zone
* Rename dns_base_zone_name to dns_zone_name
This commit is contained in:
Dalton Hubble
2017-08-13 13:02:52 -07:00
parent 40bd338eab
commit bac968d3eb
8 changed files with 45 additions and 55 deletions

View File

@ -3,7 +3,7 @@ module "bootkube" {
source = "git::https://github.com/purenetes/bootkube-terraform.git?ref=v0.6.0"
cluster_name = "${var.cluster_name}"
api_servers = ["${var.k8s_domain_name}"]
api_servers = ["${format("%s.%s", var.cluster_name, var.dns_zone)}"]
etcd_servers = ["http://127.0.0.1:2379"]
asset_dir = "${var.asset_dir}"
pod_cidr = "${var.pod_cidr}"

View File

@ -4,15 +4,14 @@ module "controllers" {
ssh_authorized_key = "${var.ssh_authorized_key}"
# GCE
network = "${google_compute_network.network.name}"
count = "${var.controller_count}"
dns_base_zone = "${var.dns_base_zone}"
dns_base_zone_name = "${var.dns_base_zone_name}"
k8s_domain_name = "${var.k8s_domain_name}"
zone = "${var.zone}"
machine_type = "${var.machine_type}"
os_image = "${var.os_image}"
preemptible = "${var.controller_preemptible}"
network = "${google_compute_network.network.name}"
count = "${var.controller_count}"
zone = "${var.zone}"
dns_zone = "${var.dns_zone}"
dns_zone_name = "${var.dns_zone_name}"
machine_type = "${var.machine_type}"
os_image = "${var.os_image}"
preemptible = "${var.controller_preemptible}"
# configuration
service_cidr = "${var.service_cidr}"

View File

@ -6,7 +6,7 @@ resource "null_resource" "bootkube-start" {
# TODO: SSH to a controller's IP instead of waiting on DNS resolution
connection {
type = "ssh"
host = "${var.k8s_domain_name}"
host = "${format("%s.%s", var.cluster_name, var.dns_zone)}"
user = "core"
timeout = "15m"
}

View File

@ -3,40 +3,35 @@ variable "cluster_name" {
description = "Cluster name"
}
variable "ssh_authorized_key" {
type = "string"
description = "SSH public key for logging in as user 'core'"
}
variable "dns_base_zone" {
type = "string"
description = "Google Cloud DNS Zone value to create etcd/k8s subdomains (e.g. dghubble.io)"
}
variable "dns_base_zone_name" {
type = "string"
description = "Google Cloud DNS Zone name to create etcd/k8s subdomains (e.g. dghubble-io)"
}
variable "k8s_domain_name" {
type = "string"
description = "Controller DNS name which resolves to the controller instance. Kubectl and workers use TLS client credentials to communicate via this endpoint."
}
variable "zone" {
type = "string"
description = "Google zone that compute instances should be created in (e.g. gcloud compute zones list)"
description = "Google Cloud zone (e.g. us-central1-f, see `gcloud compute zones list`)"
}
variable "dns_zone" {
type = "string"
description = "Google Cloud DNS Zone (e.g. google-cloud.dghubble.io)"
}
variable "dns_zone_name" {
type = "string"
description = "Google Cloud DNS Zone name (e.g. google-cloud-prod-zone)"
}
variable "ssh_authorized_key" {
type = "string"
description = "SSH public key for user 'core'"
}
variable "machine_type" {
type = "string"
default = "n1-standard-1"
description = "Machine type for compute instances (e.g. gcloud compute machine-types list)"
description = "Machine type for compute instances (see `gcloud compute machine-types list`)"
}
variable "os_image" {
type = "string"
description = "OS image from which to initialize the disk (e.g. gcloud compute images list)"
description = "OS image from which to initialize the disk (see `gcloud compute images list`)"
}
variable "controller_count" {