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:
parent
40bd338eab
commit
bac968d3eb
|
@ -1,13 +1,16 @@
|
||||||
# Controller DNS records
|
# Controller Instance DNS records
|
||||||
resource "digitalocean_record" "controllers" {
|
resource "digitalocean_record" "controllers" {
|
||||||
count = "${var.controller_count}"
|
count = "${var.controller_count}"
|
||||||
|
|
||||||
# DNS zone where record should be created
|
# DNS zone where record should be created
|
||||||
domain = "${var.dns_zone}"
|
domain = "${var.dns_zone}"
|
||||||
|
|
||||||
|
# DNS record (will be prepended to domain)
|
||||||
name = "${var.cluster_name}"
|
name = "${var.cluster_name}"
|
||||||
type = "A"
|
type = "A"
|
||||||
ttl = 300
|
ttl = 300
|
||||||
|
|
||||||
|
# IPv4 addresses of controllers
|
||||||
value = "${element(digitalocean_droplet.controllers.*.ipv4_address, count.index)}"
|
value = "${element(digitalocean_droplet.controllers.*.ipv4_address, count.index)}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ variable "worker_count" {
|
||||||
|
|
||||||
variable "ssh_fingerprints" {
|
variable "ssh_fingerprints" {
|
||||||
type = "list"
|
type = "list"
|
||||||
description = "SSH public key fingerprints. Use ssh-add -l -E md5."
|
description = "SSH public key fingerprints. (e.g. see `ssh-add -l -E md5`)"
|
||||||
}
|
}
|
||||||
|
|
||||||
# bootkube assets
|
# bootkube assets
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
# DNS record set to the network load balancer over controllers
|
# Controller Network Load balancer DNS record
|
||||||
resource "google_dns_record_set" "k8s_dns" {
|
resource "google_dns_record_set" "controllers" {
|
||||||
# Managed DNS Zone name
|
# DNS Zone name where record should be created
|
||||||
managed_zone = "${var.dns_base_zone_name}"
|
managed_zone = "${var.dns_zone_name}"
|
||||||
|
|
||||||
# Name of the DNS record
|
|
||||||
#name = "${format("%s.%s.", var.cluster_name, var.dns_base_zone)}"
|
|
||||||
name = "${var.k8s_domain_name}."
|
|
||||||
|
|
||||||
|
# DNS record
|
||||||
|
name = "${format("%s.%s.", var.cluster_name, var.dns_zone)}"
|
||||||
type = "A"
|
type = "A"
|
||||||
ttl = 300
|
ttl = 300
|
||||||
|
|
||||||
# compute instance public IP
|
# IPv4 address of controllers' network load balancer
|
||||||
rrdatas = ["${google_compute_address.controllers-ip.address}"]
|
rrdatas = ["${google_compute_address.controllers-ip.address}"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,21 +13,16 @@ variable "network" {
|
||||||
description = "Name of the network to attach to the compute instance interfaces"
|
description = "Name of the network to attach to the compute instance interfaces"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "dns_base_zone" {
|
variable "dns_zone" {
|
||||||
type = "string"
|
type = "string"
|
||||||
description = "Google Cloud DNS Zone value to create etcd/k8s subdomains (e.g. dghubble.io)"
|
description = "Google Cloud DNS Zone value to create etcd/k8s subdomains (e.g. dghubble.io)"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "dns_base_zone_name" {
|
variable "dns_zone_name" {
|
||||||
type = "string"
|
type = "string"
|
||||||
description = "Google Cloud DNS Zone name to create etcd/k8s subdomains (e.g. dghubble-io)"
|
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."
|
|
||||||
}
|
|
||||||
|
|
||||||
# instances
|
# instances
|
||||||
|
|
||||||
variable "count" {
|
variable "count" {
|
||||||
|
|
|
@ -3,7 +3,7 @@ module "bootkube" {
|
||||||
source = "git::https://github.com/purenetes/bootkube-terraform.git?ref=v0.6.0"
|
source = "git::https://github.com/purenetes/bootkube-terraform.git?ref=v0.6.0"
|
||||||
|
|
||||||
cluster_name = "${var.cluster_name}"
|
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"]
|
etcd_servers = ["http://127.0.0.1:2379"]
|
||||||
asset_dir = "${var.asset_dir}"
|
asset_dir = "${var.asset_dir}"
|
||||||
pod_cidr = "${var.pod_cidr}"
|
pod_cidr = "${var.pod_cidr}"
|
||||||
|
|
|
@ -6,10 +6,9 @@ module "controllers" {
|
||||||
# GCE
|
# GCE
|
||||||
network = "${google_compute_network.network.name}"
|
network = "${google_compute_network.network.name}"
|
||||||
count = "${var.controller_count}"
|
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}"
|
zone = "${var.zone}"
|
||||||
|
dns_zone = "${var.dns_zone}"
|
||||||
|
dns_zone_name = "${var.dns_zone_name}"
|
||||||
machine_type = "${var.machine_type}"
|
machine_type = "${var.machine_type}"
|
||||||
os_image = "${var.os_image}"
|
os_image = "${var.os_image}"
|
||||||
preemptible = "${var.controller_preemptible}"
|
preemptible = "${var.controller_preemptible}"
|
||||||
|
|
|
@ -6,7 +6,7 @@ resource "null_resource" "bootkube-start" {
|
||||||
# TODO: SSH to a controller's IP instead of waiting on DNS resolution
|
# TODO: SSH to a controller's IP instead of waiting on DNS resolution
|
||||||
connection {
|
connection {
|
||||||
type = "ssh"
|
type = "ssh"
|
||||||
host = "${var.k8s_domain_name}"
|
host = "${format("%s.%s", var.cluster_name, var.dns_zone)}"
|
||||||
user = "core"
|
user = "core"
|
||||||
timeout = "15m"
|
timeout = "15m"
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,40 +3,35 @@ variable "cluster_name" {
|
||||||
description = "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" {
|
variable "zone" {
|
||||||
type = "string"
|
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" {
|
variable "machine_type" {
|
||||||
type = "string"
|
type = "string"
|
||||||
default = "n1-standard-1"
|
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" {
|
variable "os_image" {
|
||||||
type = "string"
|
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" {
|
variable "controller_count" {
|
||||||
|
|
Loading…
Reference in New Issue