Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

terraform/gcp: Allow to change extra disk types #8524

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions contrib/terraform/gcp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,18 @@ ansible-playbook -i contrib/terraform/gcs/inventory.ini cluster.yml -b -v
### Optional

* `prefix`: Prefix to use for all resources, required to be unique for all clusters in the same project *(Defaults to `default`)*
* `master_sa_email`: Service account email to use for the master nodes *(Defaults to `""`, auto generate one)*
* `master_sa_scopes`: Service account email to use for the master nodes *(Defaults to `["https://www.googleapis.com/auth/cloud-platform"]`)*
* `master_sa_email`: Service account email to use for the control plane nodes *(Defaults to `""`, auto generate one)*
* `master_sa_scopes`: Service account email to use for the control plane nodes *(Defaults to `["https://www.googleapis.com/auth/cloud-platform"]`)*
* `master_preemptible`: Enable [preemptible](https://cloud.google.com/compute/docs/instances/preemptible)
for the master nodes *(Defaults to `false`)*
for the control plane nodes *(Defaults to `false`)*
* `master_additional_disk_type`: [Disk type](https://cloud.google.com/compute/docs/disks/#disk-types)
for extra disks added on the control plane nodes *(Defaults to `"pd-ssd"`)*
* `worker_sa_email`: Service account email to use for the worker nodes *(Defaults to `""`, auto generate one)*
* `worker_sa_scopes`: Service account email to use for the worker nodes *(Defaults to `["https://www.googleapis.com/auth/cloud-platform"]`)*
* `worker_preemptible`: Enable [preemptible](https://cloud.google.com/compute/docs/instances/preemptible)
for the worker nodes *(Defaults to `false`)*
* `worker_additional_disk_type`: [Disk type](https://cloud.google.com/compute/docs/disks/#disk-types)
for extra disks added on the worker nodes *(Defaults to `"pd-ssd"`)*

An example variables file can be found `tfvars.json`

Expand Down
2 changes: 2 additions & 0 deletions contrib/terraform/gcp/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ module "kubernetes" {
master_sa_email = var.master_sa_email
master_sa_scopes = var.master_sa_scopes
master_preemptible = var.master_preemptible
master_additional_disk_type = var.master_additional_disk_type
worker_sa_email = var.worker_sa_email
worker_sa_scopes = var.worker_sa_scopes
worker_preemptible = var.worker_preemptible
worker_additional_disk_type = var.worker_additional_disk_type

ssh_whitelist = var.ssh_whitelist
api_server_whitelist = var.api_server_whitelist
Expand Down
4 changes: 2 additions & 2 deletions contrib/terraform/gcp/modules/kubernetes-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ resource "google_compute_disk" "master" {
}

name = "${var.prefix}-${each.key}"
type = "pd-ssd"
type = var.master_additional_disk_type
zone = each.value.machine.zone
size = each.value.disk_size

Expand Down Expand Up @@ -271,7 +271,7 @@ resource "google_compute_disk" "worker" {
}

name = "${var.prefix}-${each.key}"
type = "pd-ssd"
type = var.worker_additional_disk_type
zone = each.value.machine.zone
size = each.value.disk_size

Expand Down
8 changes: 8 additions & 0 deletions contrib/terraform/gcp/modules/kubernetes-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ variable "master_preemptible" {
type = bool
}

variable "master_additional_disk_type" {
type = string
}

variable "worker_sa_email" {
type = string
}
Expand All @@ -43,6 +47,10 @@ variable "worker_preemptible" {
type = bool
}

variable "worker_additional_disk_type" {
type = string
}

variable "ssh_pub_key" {}

variable "ssh_whitelist" {
Expand Down
10 changes: 10 additions & 0 deletions contrib/terraform/gcp/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ variable "master_preemptible" {
default = false
}

variable "master_additional_disk_type" {
type = string
default = "pd-ssd"
}

variable "worker_sa_email" {
type = string
default = ""
Expand All @@ -64,6 +69,11 @@ variable "worker_preemptible" {
default = false
}

variable "worker_additional_disk_type" {
type = string
default = "pd-ssd"
}

variable ssh_pub_key {
description = "Path to public SSH key file which is injected into the VMs."
type = string
Expand Down