mirror of
https://github.com/puppetmaster/typhoon.git
synced 2024-12-24 04:19:33 +01:00
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" {
|
||||
count = "${var.controller_count}"
|
||||
|
||||
# DNS zone where record should be created
|
||||
domain = "${var.dns_zone}"
|
||||
|
||||
name = "${var.cluster_name}"
|
||||
type = "A"
|
||||
ttl = 300
|
||||
# DNS record (will be prepended to domain)
|
||||
name = "${var.cluster_name}"
|
||||
type = "A"
|
||||
ttl = 300
|
||||
|
||||
# IPv4 addresses of controllers
|
||||
value = "${element(digitalocean_droplet.controllers.*.ipv4_address, count.index)}"
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ variable "worker_count" {
|
||||
|
||||
variable "ssh_fingerprints" {
|
||||
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
|
||||
|
@ -1,16 +1,14 @@
|
||||
# DNS record set to the network load balancer over controllers
|
||||
resource "google_dns_record_set" "k8s_dns" {
|
||||
# Managed DNS Zone name
|
||||
managed_zone = "${var.dns_base_zone_name}"
|
||||
|
||||
# Name of the DNS record
|
||||
#name = "${format("%s.%s.", var.cluster_name, var.dns_base_zone)}"
|
||||
name = "${var.k8s_domain_name}."
|
||||
# Controller Network Load balancer DNS record
|
||||
resource "google_dns_record_set" "controllers" {
|
||||
# DNS Zone name where record should be created
|
||||
managed_zone = "${var.dns_zone_name}"
|
||||
|
||||
# DNS record
|
||||
name = "${format("%s.%s.", var.cluster_name, var.dns_zone)}"
|
||||
type = "A"
|
||||
ttl = 300
|
||||
|
||||
# compute instance public IP
|
||||
# IPv4 address of controllers' network load balancer
|
||||
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"
|
||||
}
|
||||
|
||||
variable "dns_base_zone" {
|
||||
variable "dns_zone" {
|
||||
type = "string"
|
||||
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"
|
||||
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
|
||||
|
||||
variable "count" {
|
||||
|
@ -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}"
|
||||
|
@ -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}"
|
||||
|
@ -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"
|
||||
}
|
||||
|
@ -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" {
|
||||
|
Loading…
Reference in New Issue
Block a user