From 2592a0aad47da801821a9d2cf3349635c0eddccc Mon Sep 17 00:00:00 2001 From: Dalton Hubble Date: Fri, 2 Mar 2018 17:26:51 -0800 Subject: [PATCH] Allow Google accelerators (i.e. GPUs) on workers --- CHANGES.md | 2 ++ google-cloud/container-linux/kubernetes/require.tf | 2 +- .../kubernetes/workers/variables.tf | 14 ++++++++++++++ .../container-linux/kubernetes/workers/workers.tf | 6 +++++- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 0b6abcb5..62273308 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -36,6 +36,8 @@ Notable changes between versions. * Add kubelet `--volume-plugin-dir` flag to allow flexvolume plugins ([#142](https://github.com/poseidon/typhoon/pull/142)) * Add `kubeconfig` variable to `controllers` and `workers` submodules ([#147](https://github.com/poseidon/typhoon/pull/147)) * Remove `kubeconfig_*` variables from `controllers` and `workers` submodules ([#147](https://github.com/poseidon/typhoon/pull/147)) +* Allow initial experimentation with accelerators (i.e. GPUs) on workers ([#161](https://github.com/poseidon/typhoon/pull/161)) (unofficial) + * Require `terraform-provider-google` v1.6.0 #### Addons diff --git a/google-cloud/container-linux/kubernetes/require.tf b/google-cloud/container-linux/kubernetes/require.tf index f30094d5..9e540074 100644 --- a/google-cloud/container-linux/kubernetes/require.tf +++ b/google-cloud/container-linux/kubernetes/require.tf @@ -5,7 +5,7 @@ terraform { } provider "google" { - version = "~> 1.2" + version = "~> 1.6" } provider "local" { diff --git a/google-cloud/container-linux/kubernetes/workers/variables.tf b/google-cloud/container-linux/kubernetes/workers/variables.tf index 1e68b7a0..8cafc4d8 100644 --- a/google-cloud/container-linux/kubernetes/workers/variables.tf +++ b/google-cloud/container-linux/kubernetes/workers/variables.tf @@ -77,3 +77,17 @@ variable "cluster_domain_suffix" { type = "string" default = "cluster.local" } + +# unofficial, undocumented, unsupported, temporary + +variable "accelerator_type" { + type = "string" + default = "" + description = "Google Compute Engine accelerator type (e.g. nvidia-tesla-k80, see gcloud compute accelerator-types list)" +} + +variable "accelerator_count" { + type = "string" + default = "0" + description = "Number of compute engine accelerators" +} diff --git a/google-cloud/container-linux/kubernetes/workers/workers.tf b/google-cloud/container-linux/kubernetes/workers/workers.tf index 6682fec2..d1bf82ec 100644 --- a/google-cloud/container-linux/kubernetes/workers/workers.tf +++ b/google-cloud/container-linux/kubernetes/workers/workers.tf @@ -63,9 +63,13 @@ resource "google_compute_instance_template" "worker" { } can_ip_forward = true - tags = ["worker", "${var.cluster_name}-worker", "${var.name}-worker"] + guest_accelerator { + count = "${var.accelerator_count}" + type = "${var.accelerator_type}" + } + lifecycle { # To update an Instance Template, Terraform should replace the existing resource create_before_destroy = true