Add support for worker pools on google-cloud

* Set defaults for internal worker module's count,
machine_type, and os_image
* Allow "pools" of homogeneous workers to be created
using the google-cloud/kubernetes/workers module
This commit is contained in:
Dalton Hubble
2018-02-26 14:06:18 -08:00
parent 06d40c5b44
commit 160ae34e71
8 changed files with 100 additions and 13 deletions

View File

@ -1,7 +1,6 @@
module "controllers" {
source = "controllers"
cluster_name = "${var.cluster_name}"
ssh_authorized_key = "${var.ssh_authorized_key}"
source = "controllers"
cluster_name = "${var.cluster_name}"
# GCE
network = "${google_compute_network.network.name}"
@ -14,15 +13,15 @@ module "controllers" {
# configuration
networking = "${var.networking}"
kubeconfig = "${module.bootkube.kubeconfig}"
ssh_authorized_key = "${var.ssh_authorized_key}"
service_cidr = "${var.service_cidr}"
cluster_domain_suffix = "${var.cluster_domain_suffix}"
kubeconfig = "${module.bootkube.kubeconfig}"
}
module "workers" {
source = "workers"
cluster_name = "${var.cluster_name}"
ssh_authorized_key = "${var.ssh_authorized_key}"
source = "workers"
cluster_name = "${var.cluster_name}"
# GCE
network = "${google_compute_network.network.name}"
@ -33,7 +32,8 @@ module "workers" {
preemptible = "${var.worker_preemptible}"
# configuration
kubeconfig = "${module.bootkube.kubeconfig}"
ssh_authorized_key = "${var.ssh_authorized_key}"
service_cidr = "${var.service_cidr}"
cluster_domain_suffix = "${var.cluster_domain_suffix}"
kubeconfig = "${module.bootkube.kubeconfig}"
}

View File

@ -13,3 +13,7 @@ output "network_name" {
output "network_self_link" {
value = "${google_compute_network.network.self_link}"
}
output "kubeconfig" {
value = "${module.bootkube.kubeconfig}"
}

View File

@ -17,6 +17,7 @@ variable "network" {
variable "count" {
type = "string"
default = "1"
description = "Number of worker compute instances the instance group should manage"
}
@ -27,11 +28,13 @@ variable "region" {
variable "machine_type" {
type = "string"
default = "n1-standard-1"
description = "Machine type for compute instances (e.g. gcloud compute machine-types list)"
}
variable "os_image" {
type = "string"
default = "coreos-stable"
description = "OS image from which to initialize the disk (e.g. gcloud compute images list)"
}