Create controller instances across zones in the region

* Change controller instances to automatically span zones in a region
* Remove the `zone` required variable
This commit is contained in:
Dalton Hubble 2017-11-05 11:09:03 -08:00
parent 7b38271212
commit 2b0296d671
9 changed files with 15 additions and 16 deletions

View File

@ -9,9 +9,11 @@ Notable changes between versions.
* Add required variable `region` (e.g. "us-central1") * Add required variable `region` (e.g. "us-central1")
* Reduce time to bootstrap a cluster * Reduce time to bootstrap a cluster
* Change etcd to run on-host, across controllers (etcd-member.service) * Change etcd to run on-host, across controllers (etcd-member.service)
* Change worker managed instance group to automatically span zones in a region * Change controller instances to automatically span zones in the region
* Change worker managed instance group to automatically span zones in the region
* Remove support for self-hosted etcd * Remove support for self-hosted etcd
* Remove `controller_preemptible` optional variable * Remove the `zone` required variable
* Remove the `controller_preemptible` optional variable
## v1.8.2 ## v1.8.2

View File

@ -47,7 +47,6 @@ module "google-cloud-yavin" {
# Google Cloud # Google Cloud
region = "us-central1" region = "us-central1"
zone = "us-central1-c"
dns_zone = "example.com" dns_zone = "example.com"
dns_zone_name = "example-zone" dns_zone_name = "example-zone"
os_image = "coreos-stable-1465-6-0-v20170817" os_image = "coreos-stable-1465-6-0-v20170817"

View File

@ -78,7 +78,6 @@ module "google-cloud-yavin" {
# Google Cloud # Google Cloud
region = "us-central1" region = "us-central1"
zone = "us-central1-c"
dns_zone = "example.com" dns_zone = "example.com"
dns_zone_name = "example-zone" dns_zone_name = "example-zone"
os_image = "coreos-stable-1520-6-0-v20171012" os_image = "coreos-stable-1520-6-0-v20171012"
@ -195,7 +194,6 @@ Learn about [version pinning](concepts.md#versioning), maintenance, and [addons]
|:-----|:------------|:--------| |:-----|:------------|:--------|
| cluster_name | Unique cluster name (prepended to dns_zone) | "yavin" | | cluster_name | Unique cluster name (prepended to dns_zone) | "yavin" |
| region | Google Cloud region | "us-central1" | | region | Google Cloud region | "us-central1" |
| zone | Google Cloud zone | "us-central1-f" |
| dns_zone | Google Cloud DNS zone | "google-cloud.example.com" | | dns_zone | Google Cloud DNS zone | "google-cloud.example.com" |
| dns_zone_name | Google Cloud DNS zone name | "example-zone" | | dns_zone_name | Google Cloud DNS zone name | "example-zone" |
| ssh_authorized_key | SSH public key for ~/.ssh_authorized_keys | "ssh-rsa AAAAB3NZ..." | | ssh_authorized_key | SSH public key for ~/.ssh_authorized_keys | "ssh-rsa AAAAB3NZ..." |

View File

@ -47,7 +47,6 @@ module "google-cloud-yavin" {
# Google Cloud # Google Cloud
region = "us-central1" region = "us-central1"
zone = "us-central1-c"
dns_zone = "example.com" dns_zone = "example.com"
dns_zone_name = "example-zone" dns_zone_name = "example-zone"
os_image = "coreos-stable-1465-6-0-v20170817" os_image = "coreos-stable-1465-6-0-v20170817"

View File

@ -6,7 +6,7 @@ module "controllers" {
# GCE # GCE
network = "${google_compute_network.network.name}" network = "${google_compute_network.network.name}"
count = "${var.controller_count}" count = "${var.controller_count}"
zone = "${var.zone}" region = "${var.region}"
dns_zone = "${var.dns_zone}" dns_zone = "${var.dns_zone}"
dns_zone_name = "${var.dns_zone_name}" dns_zone_name = "${var.dns_zone_name}"
machine_type = "${var.machine_type}" machine_type = "${var.machine_type}"

View File

@ -14,12 +14,18 @@ resource "google_dns_record_set" "etcds" {
rrdatas = ["${element(google_compute_instance.controllers.*.network_interface.0.address, count.index)}"] rrdatas = ["${element(google_compute_instance.controllers.*.network_interface.0.address, count.index)}"]
} }
# Zones in the region
data "google_compute_zones" "available" {
region = "${var.region}"
status = "UP"
}
# Controller instances # Controller instances
resource "google_compute_instance" "controllers" { resource "google_compute_instance" "controllers" {
count = "${var.count}" count = "${var.count}"
name = "${var.cluster_name}-controller-${count.index}" name = "${var.cluster_name}-controller-${count.index}"
zone = "${var.zone}" zone = "${element(data.google_compute_zones.available.names, count.index)}"
machine_type = "${var.machine_type}" machine_type = "${var.machine_type}"
metadata { metadata {

View File

@ -30,9 +30,9 @@ variable "count" {
description = "Number of controller compute instances the instance group should manage" description = "Number of controller compute instances the instance group should manage"
} }
variable "zone" { variable "region" {
type = "string" type = "string"
description = "Google zone that compute instances in the group should be created in (e.g. gcloud compute zones list)" description = "Google Cloud region (e.g. us-central1, see `gcloud compute regions list`)."
} }
variable "machine_type" { variable "machine_type" {

View File

@ -8,11 +8,6 @@ variable "region" {
description = "Google Cloud Region (e.g. us-central1, see `gcloud compute regions list`)" description = "Google Cloud Region (e.g. us-central1, see `gcloud compute regions list`)"
} }
variable "zone" {
type = "string"
description = "Google Cloud Zone (e.g. us-central1-f, see `gcloud compute zones list`)"
}
variable "dns_zone" { variable "dns_zone" {
type = "string" type = "string"
description = "Google Cloud DNS Zone (e.g. google-cloud.dghubble.io)" description = "Google Cloud DNS Zone (e.g. google-cloud.dghubble.io)"

View File

@ -22,7 +22,7 @@ variable "count" {
variable "region" { variable "region" {
type = "string" type = "string"
description = "Google Cloud region to create a regional managed group of workers (e.g. us-central1, see `gcloud compute regions list`)." description = "Google Cloud region (e.g. us-central1, see `gcloud compute regions list`)."
} }
variable "machine_type" { variable "machine_type" {