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

Add spot vm support to beta clusters #1131

Merged
merged 6 commits into from
Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from 5 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
2 changes: 2 additions & 0 deletions autogen/main/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ module "gke" {
max_count = 100
local_ssd_count = 0
{% if beta_cluster %}
spot = false
local_ssd_ephemeral_count = 0
{% endif %}
disk_size_gb = 100
Expand Down Expand Up @@ -212,6 +213,7 @@ The node_pools variable takes the following parameters:
| node_metadata | Options to expose the node metadata to the workload running on the node | | Optional |
| preemptible | A boolean that represents whether or not the underlying node VMs are preemptible | false | Optional |
{% if beta_cluster %}
| spot | A boolean that represents whether the underlying node VMs are spot | false | Optional |
| sandbox_type | Sandbox to use for pods in the node pool | | Required |
{% endif %}
| service_account | The service account to be used by the Node VMs | " " | Optional |
Expand Down
6 changes: 6 additions & 0 deletions autogen/main/cluster.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,9 @@ locals {
"machine_type",
"min_cpu_platform",
"preemptible",
{% if beta_cluster %}
"spot",
{% endif %}
"service_account",
]
}
Expand Down Expand Up @@ -609,6 +612,9 @@ resource "google_container_node_pool" "pools" {
local.service_account,
)
preemptible = lookup(each.value, "preemptible", false)
{% if beta_cluster %}
spot = lookup(each.value, "spot", false)
{% endif %}

oauth_scopes = concat(
local.node_pools_oauth_scopes["all"],
Expand Down
2 changes: 1 addition & 1 deletion autogen/main/versions.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ terraform {
required_providers {
google-beta = {
source = "hashicorp/google-beta"
version = ">= 4.0.0, < 5.0"
version = ">= 4.3.0, < 5.0"
}
kubernetes = {
source = "hashicorp/kubernetes"
Expand Down
2 changes: 2 additions & 0 deletions modules/beta-private-cluster-update-variant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ module "gke" {
min_count = 1
max_count = 100
local_ssd_count = 0
spot = false
local_ssd_ephemeral_count = 0
disk_size_gb = 100
disk_type = "pd-standard"
Expand Down Expand Up @@ -327,6 +328,7 @@ The node_pools variable takes the following parameters:
| node_locations | The list of zones in which the cluster's nodes are located. Nodes must be in the region of their regional cluster or in the same region as their cluster's zone for zonal clusters. Defaults to cluster level node locations if nothing is specified | " " | Optional |
| node_metadata | Options to expose the node metadata to the workload running on the node | | Optional |
| preemptible | A boolean that represents whether or not the underlying node VMs are preemptible | false | Optional |
| spot | A boolean that represents whether the underlying node VMs are spot | false | Optional |
| sandbox_type | Sandbox to use for pods in the node pool | | Required |
| service_account | The service account to be used by the Node VMs | " " | Optional |
| tags | The list of instance tags applied to all nodes | | Required |
Expand Down
2 changes: 2 additions & 0 deletions modules/beta-private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ locals {
"machine_type",
"min_cpu_platform",
"preemptible",
"spot",
"service_account",
]
}
Expand Down Expand Up @@ -548,6 +549,7 @@ resource "google_container_node_pool" "pools" {
local.service_account,
)
preemptible = lookup(each.value, "preemptible", false)
spot = lookup(each.value, "spot", false)

oauth_scopes = concat(
local.node_pools_oauth_scopes["all"],
Expand Down
2 changes: 1 addition & 1 deletion modules/beta-private-cluster-update-variant/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ terraform {
required_providers {
google-beta = {
source = "hashicorp/google-beta"
version = ">= 4.0.0, < 5.0"
version = ">= 4.3.0, < 5.0"
}
kubernetes = {
source = "hashicorp/kubernetes"
Expand Down
2 changes: 2 additions & 0 deletions modules/beta-private-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ module "gke" {
min_count = 1
max_count = 100
local_ssd_count = 0
spot = false
local_ssd_ephemeral_count = 0
disk_size_gb = 100
disk_type = "pd-standard"
Expand Down Expand Up @@ -305,6 +306,7 @@ The node_pools variable takes the following parameters:
| node_locations | The list of zones in which the cluster's nodes are located. Nodes must be in the region of their regional cluster or in the same region as their cluster's zone for zonal clusters. Defaults to cluster level node locations if nothing is specified | " " | Optional |
| node_metadata | Options to expose the node metadata to the workload running on the node | | Optional |
| preemptible | A boolean that represents whether or not the underlying node VMs are preemptible | false | Optional |
| spot | A boolean that represents whether the underlying node VMs are spot | false | Optional |
| sandbox_type | Sandbox to use for pods in the node pool | | Required |
| service_account | The service account to be used by the Node VMs | " " | Optional |
| tags | The list of instance tags applied to all nodes | | Required |
Expand Down
1 change: 1 addition & 0 deletions modules/beta-private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ resource "google_container_node_pool" "pools" {
local.service_account,
)
preemptible = lookup(each.value, "preemptible", false)
spot = lookup(each.value, "spot", false)

oauth_scopes = concat(
local.node_pools_oauth_scopes["all"],
Expand Down
2 changes: 1 addition & 1 deletion modules/beta-private-cluster/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ terraform {
required_providers {
google-beta = {
source = "hashicorp/google-beta"
version = ">= 4.0.0, < 5.0"
version = ">= 4.3.0, < 5.0"
}
kubernetes = {
source = "hashicorp/kubernetes"
Expand Down
2 changes: 2 additions & 0 deletions modules/beta-public-cluster-update-variant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ module "gke" {
min_count = 1
max_count = 100
local_ssd_count = 0
spot = false
local_ssd_ephemeral_count = 0
disk_size_gb = 100
disk_type = "pd-standard"
Expand Down Expand Up @@ -314,6 +315,7 @@ The node_pools variable takes the following parameters:
| node_locations | The list of zones in which the cluster's nodes are located. Nodes must be in the region of their regional cluster or in the same region as their cluster's zone for zonal clusters. Defaults to cluster level node locations if nothing is specified | " " | Optional |
| node_metadata | Options to expose the node metadata to the workload running on the node | | Optional |
| preemptible | A boolean that represents whether or not the underlying node VMs are preemptible | false | Optional |
| spot | A boolean that represents whether the underlying node VMs are spot | false | Optional |
| sandbox_type | Sandbox to use for pods in the node pool | | Required |
| service_account | The service account to be used by the Node VMs | " " | Optional |
| tags | The list of instance tags applied to all nodes | | Required |
Expand Down
2 changes: 2 additions & 0 deletions modules/beta-public-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ locals {
"machine_type",
"min_cpu_platform",
"preemptible",
"spot",
"service_account",
]
}
Expand Down Expand Up @@ -529,6 +530,7 @@ resource "google_container_node_pool" "pools" {
local.service_account,
)
preemptible = lookup(each.value, "preemptible", false)
spot = lookup(each.value, "spot", false)

oauth_scopes = concat(
local.node_pools_oauth_scopes["all"],
Expand Down
2 changes: 1 addition & 1 deletion modules/beta-public-cluster-update-variant/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ terraform {
required_providers {
google-beta = {
source = "hashicorp/google-beta"
version = ">= 4.0.0, < 5.0"
version = ">= 4.3.0, < 5.0"
}
kubernetes = {
source = "hashicorp/kubernetes"
Expand Down
2 changes: 2 additions & 0 deletions modules/beta-public-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ module "gke" {
min_count = 1
max_count = 100
local_ssd_count = 0
spot = false
local_ssd_ephemeral_count = 0
disk_size_gb = 100
disk_type = "pd-standard"
Expand Down Expand Up @@ -292,6 +293,7 @@ The node_pools variable takes the following parameters:
| node_locations | The list of zones in which the cluster's nodes are located. Nodes must be in the region of their regional cluster or in the same region as their cluster's zone for zonal clusters. Defaults to cluster level node locations if nothing is specified | " " | Optional |
| node_metadata | Options to expose the node metadata to the workload running on the node | | Optional |
| preemptible | A boolean that represents whether or not the underlying node VMs are preemptible | false | Optional |
| spot | A boolean that represents whether the underlying node VMs are spot | false | Optional |
| sandbox_type | Sandbox to use for pods in the node pool | | Required |
| service_account | The service account to be used by the Node VMs | " " | Optional |
| tags | The list of instance tags applied to all nodes | | Required |
Expand Down
1 change: 1 addition & 0 deletions modules/beta-public-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ resource "google_container_node_pool" "pools" {
local.service_account,
)
preemptible = lookup(each.value, "preemptible", false)
spot = lookup(each.value, "spot", false)

oauth_scopes = concat(
local.node_pools_oauth_scopes["all"],
Expand Down
2 changes: 1 addition & 1 deletion modules/beta-public-cluster/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ terraform {
required_providers {
google-beta = {
source = "hashicorp/google-beta"
version = ">= 4.0.0, < 5.0"
version = ">= 4.3.0, < 5.0"
}
kubernetes = {
source = "hashicorp/kubernetes"
Expand Down
2 changes: 1 addition & 1 deletion test/setup/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ terraform {
}
google-beta = {
source = "hashicorp/google-beta"
version = "4.1.0"
version = "4.3.0"
}
random = {
source = "hashicorp/random"
Expand Down