Skip to content

Commit 9335262

Browse files
jeremyrcampbJeremy Campbell
and
Jeremy Campbell
authored
feat: Add use local_ssd_ephemeral_count attribute in node_pool config on beta clusters (#902)
Co-authored-by: Jeremy Campbell <jcampbell@spins.com>
1 parent 9172b3e commit 9335262

File tree

16 files changed

+174
-120
lines changed

16 files changed

+174
-120
lines changed

Diff for: README.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,20 @@ module "gke" {
4646
4747
node_pools = [
4848
{
49-
name = "default-node-pool"
50-
machine_type = "e2-medium"
51-
node_locations = "us-central1-b,us-central1-c"
52-
min_count = 1
53-
max_count = 100
54-
local_ssd_count = 0
55-
disk_size_gb = 100
56-
disk_type = "pd-standard"
57-
image_type = "COS"
58-
auto_repair = true
59-
auto_upgrade = true
60-
service_account = "project-service-account@<PROJECT ID>.iam.gserviceaccount.com"
61-
preemptible = false
62-
initial_node_count = 80
49+
name = "default-node-pool"
50+
machine_type = "e2-medium"
51+
node_locations = "us-central1-b,us-central1-c"
52+
min_count = 1
53+
max_count = 100
54+
local_ssd_count = 0
55+
disk_size_gb = 100
56+
disk_type = "pd-standard"
57+
image_type = "COS"
58+
auto_repair = true
59+
auto_upgrade = true
60+
service_account = "project-service-account@<PROJECT ID>.iam.gserviceaccount.com"
61+
preemptible = false
62+
initial_node_count = 80
6363
},
6464
]
6565
@@ -236,7 +236,7 @@ The node_pools variable takes the following parameters:
236236
| image_type | The image type to use for this node. Note that changing the image type will delete and recreate all nodes in the node pool | COS | Optional |
237237
| initial_node_count | The initial number of nodes for the pool. In regional or multi-zonal clusters, this is the number of nodes per zone. Changing this will force recreation of the resource. Defaults to the value of min_count | " " | Optional |
238238
| key | The key required for the taint | | Required |
239-
| local_ssd_count | The amount of local SSD disks that will be attached to each cluster node | 0 | Optional |
239+
| local_ssd_count | The amount of local SSD disks that will be attached to each cluster node and may be used as a `hostpath` volume or a `local` PersistentVolume. | 0 | Optional |
240240
| machine_type | The name of a Google Compute Engine machine type | e2-medium | Optional |
241241
| max_count | Maximum number of nodes in the NodePool. Must be >= min_count | 100 | Optional |
242242
| min_count | Minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true | 1 | Optional |

Diff for: autogen/main/README.md

+21-15
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,23 @@ module "gke" {
8686
8787
node_pools = [
8888
{
89-
name = "default-node-pool"
90-
machine_type = "e2-medium"
91-
node_locations = "us-central1-b,us-central1-c"
92-
min_count = 1
93-
max_count = 100
94-
local_ssd_count = 0
95-
disk_size_gb = 100
96-
disk_type = "pd-standard"
97-
image_type = "COS"
98-
auto_repair = true
99-
auto_upgrade = true
100-
service_account = "project-service-account@<PROJECT ID>.iam.gserviceaccount.com"
101-
preemptible = false
102-
initial_node_count = 80
89+
name = "default-node-pool"
90+
machine_type = "e2-medium"
91+
node_locations = "us-central1-b,us-central1-c"
92+
min_count = 1
93+
max_count = 100
94+
local_ssd_count = 0
95+
{% if beta_cluster %}
96+
local_ssd_ephemeral_count = 0
97+
{% endif %}
98+
disk_size_gb = 100
99+
disk_type = "pd-standard"
100+
image_type = "COS"
101+
auto_repair = true
102+
auto_upgrade = true
103+
service_account = "project-service-account@<PROJECT ID>.iam.gserviceaccount.com"
104+
preemptible = false
105+
initial_node_count = 80
103106
},
104107
]
105108
@@ -181,7 +184,10 @@ The node_pools variable takes the following parameters:
181184
| image_type | The image type to use for this node. Note that changing the image type will delete and recreate all nodes in the node pool | COS | Optional |
182185
| initial_node_count | The initial number of nodes for the pool. In regional or multi-zonal clusters, this is the number of nodes per zone. Changing this will force recreation of the resource. Defaults to the value of min_count | " " | Optional |
183186
| key | The key required for the taint | | Required |
184-
| local_ssd_count | The amount of local SSD disks that will be attached to each cluster node | 0 | Optional |
187+
| local_ssd_count | The amount of local SSD disks that will be attached to each cluster node and may be used as a `hostpath` volume or a `local` PersistentVolume. | 0 | Optional |
188+
{% if beta_cluster %}
189+
| local_ssd_ephemeral_count | The amount of local SSD disks that will be attached to each cluster node and assigned as scratch space as an `emptyDir` volume. If unspecified, ephemeral storage is backed by the cluster node boot disk. | 0 | Optional |
190+
{% endif %}
185191
| machine_type | The name of a Google Compute Engine machine type | e2-medium | Optional |
186192
| max_count | Maximum number of nodes in the NodePool. Must be >= min_count | 100 | Optional |
187193
{% if beta_cluster %}

Diff for: autogen/main/cluster.tf.tmpl

+9
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,15 @@ resource "google_container_node_pool" "pools" {
528528
disk_size_gb = lookup(each.value, "disk_size_gb", 100)
529529
disk_type = lookup(each.value, "disk_type", "pd-standard")
530530

531+
{% if beta_cluster %}
532+
dynamic "ephemeral_storage_config" {
533+
for_each = lookup(each.value, "local_ssd_ephemeral_count",0) > 0 ? [each.value.local_ssd_ephemeral_count] : []
534+
content {
535+
local_ssd_count = ephemeral_storage_config.value
536+
}
537+
}
538+
{% endif %}
539+
531540
service_account = lookup(
532541
each.value,
533542
"service_account",

Diff for: cluster.tf

+1
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ resource "google_container_node_pool" "pools" {
272272
disk_size_gb = lookup(each.value, "disk_size_gb", 100)
273273
disk_type = lookup(each.value, "disk_type", "pd-standard")
274274

275+
275276
service_account = lookup(
276277
each.value,
277278
"service_account",

Diff for: modules/beta-private-cluster-update-variant/README.md

+17-15
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,21 @@ module "gke" {
7777
7878
node_pools = [
7979
{
80-
name = "default-node-pool"
81-
machine_type = "e2-medium"
82-
node_locations = "us-central1-b,us-central1-c"
83-
min_count = 1
84-
max_count = 100
85-
local_ssd_count = 0
86-
disk_size_gb = 100
87-
disk_type = "pd-standard"
88-
image_type = "COS"
89-
auto_repair = true
90-
auto_upgrade = true
91-
service_account = "project-service-account@<PROJECT ID>.iam.gserviceaccount.com"
92-
preemptible = false
93-
initial_node_count = 80
80+
name = "default-node-pool"
81+
machine_type = "e2-medium"
82+
node_locations = "us-central1-b,us-central1-c"
83+
min_count = 1
84+
max_count = 100
85+
local_ssd_count = 0
86+
local_ssd_ephemeral_count = 0
87+
disk_size_gb = 100
88+
disk_type = "pd-standard"
89+
image_type = "COS"
90+
auto_repair = true
91+
auto_upgrade = true
92+
service_account = "project-service-account@<PROJECT ID>.iam.gserviceaccount.com"
93+
preemptible = false
94+
initial_node_count = 80
9495
},
9596
]
9697
@@ -304,7 +305,8 @@ The node_pools variable takes the following parameters:
304305
| image_type | The image type to use for this node. Note that changing the image type will delete and recreate all nodes in the node pool | COS | Optional |
305306
| initial_node_count | The initial number of nodes for the pool. In regional or multi-zonal clusters, this is the number of nodes per zone. Changing this will force recreation of the resource. Defaults to the value of min_count | " " | Optional |
306307
| key | The key required for the taint | | Required |
307-
| local_ssd_count | The amount of local SSD disks that will be attached to each cluster node | 0 | Optional |
308+
| local_ssd_count | The amount of local SSD disks that will be attached to each cluster node and may be used as a `hostpath` volume or a `local` PersistentVolume. | 0 | Optional |
309+
| local_ssd_ephemeral_count | The amount of local SSD disks that will be attached to each cluster node and assigned as scratch space as an `emptyDir` volume. If unspecified, ephemeral storage is backed by the cluster node boot disk. | 0 | Optional |
308310
| machine_type | The name of a Google Compute Engine machine type | e2-medium | Optional |
309311
| max_count | Maximum number of nodes in the NodePool. Must be >= min_count | 100 | Optional |
310312
| max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional |

Diff for: modules/beta-private-cluster-update-variant/cluster.tf

+7
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,13 @@ resource "google_container_node_pool" "pools" {
479479
disk_size_gb = lookup(each.value, "disk_size_gb", 100)
480480
disk_type = lookup(each.value, "disk_type", "pd-standard")
481481

482+
dynamic "ephemeral_storage_config" {
483+
for_each = lookup(each.value, "local_ssd_ephemeral_count", 0) > 0 ? [each.value.local_ssd_ephemeral_count] : []
484+
content {
485+
local_ssd_count = ephemeral_storage_config.value
486+
}
487+
}
488+
482489
service_account = lookup(
483490
each.value,
484491
"service_account",

Diff for: modules/beta-private-cluster/README.md

+17-15
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,21 @@ module "gke" {
5555
5656
node_pools = [
5757
{
58-
name = "default-node-pool"
59-
machine_type = "e2-medium"
60-
node_locations = "us-central1-b,us-central1-c"
61-
min_count = 1
62-
max_count = 100
63-
local_ssd_count = 0
64-
disk_size_gb = 100
65-
disk_type = "pd-standard"
66-
image_type = "COS"
67-
auto_repair = true
68-
auto_upgrade = true
69-
service_account = "project-service-account@<PROJECT ID>.iam.gserviceaccount.com"
70-
preemptible = false
71-
initial_node_count = 80
58+
name = "default-node-pool"
59+
machine_type = "e2-medium"
60+
node_locations = "us-central1-b,us-central1-c"
61+
min_count = 1
62+
max_count = 100
63+
local_ssd_count = 0
64+
local_ssd_ephemeral_count = 0
65+
disk_size_gb = 100
66+
disk_type = "pd-standard"
67+
image_type = "COS"
68+
auto_repair = true
69+
auto_upgrade = true
70+
service_account = "project-service-account@<PROJECT ID>.iam.gserviceaccount.com"
71+
preemptible = false
72+
initial_node_count = 80
7273
},
7374
]
7475
@@ -282,7 +283,8 @@ The node_pools variable takes the following parameters:
282283
| image_type | The image type to use for this node. Note that changing the image type will delete and recreate all nodes in the node pool | COS | Optional |
283284
| initial_node_count | The initial number of nodes for the pool. In regional or multi-zonal clusters, this is the number of nodes per zone. Changing this will force recreation of the resource. Defaults to the value of min_count | " " | Optional |
284285
| key | The key required for the taint | | Required |
285-
| local_ssd_count | The amount of local SSD disks that will be attached to each cluster node | 0 | Optional |
286+
| local_ssd_count | The amount of local SSD disks that will be attached to each cluster node and may be used as a `hostpath` volume or a `local` PersistentVolume. | 0 | Optional |
287+
| local_ssd_ephemeral_count | The amount of local SSD disks that will be attached to each cluster node and assigned as scratch space as an `emptyDir` volume. If unspecified, ephemeral storage is backed by the cluster node boot disk. | 0 | Optional |
286288
| machine_type | The name of a Google Compute Engine machine type | e2-medium | Optional |
287289
| max_count | Maximum number of nodes in the NodePool. Must be >= min_count | 100 | Optional |
288290
| max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional |

Diff for: modules/beta-private-cluster/cluster.tf

+7
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,13 @@ resource "google_container_node_pool" "pools" {
395395
disk_size_gb = lookup(each.value, "disk_size_gb", 100)
396396
disk_type = lookup(each.value, "disk_type", "pd-standard")
397397

398+
dynamic "ephemeral_storage_config" {
399+
for_each = lookup(each.value, "local_ssd_ephemeral_count", 0) > 0 ? [each.value.local_ssd_ephemeral_count] : []
400+
content {
401+
local_ssd_count = ephemeral_storage_config.value
402+
}
403+
}
404+
398405
service_account = lookup(
399406
each.value,
400407
"service_account",

Diff for: modules/beta-public-cluster-update-variant/README.md

+17-15
Original file line numberDiff line numberDiff line change
@@ -71,20 +71,21 @@ module "gke" {
7171
7272
node_pools = [
7373
{
74-
name = "default-node-pool"
75-
machine_type = "e2-medium"
76-
node_locations = "us-central1-b,us-central1-c"
77-
min_count = 1
78-
max_count = 100
79-
local_ssd_count = 0
80-
disk_size_gb = 100
81-
disk_type = "pd-standard"
82-
image_type = "COS"
83-
auto_repair = true
84-
auto_upgrade = true
85-
service_account = "project-service-account@<PROJECT ID>.iam.gserviceaccount.com"
86-
preemptible = false
87-
initial_node_count = 80
74+
name = "default-node-pool"
75+
machine_type = "e2-medium"
76+
node_locations = "us-central1-b,us-central1-c"
77+
min_count = 1
78+
max_count = 100
79+
local_ssd_count = 0
80+
local_ssd_ephemeral_count = 0
81+
disk_size_gb = 100
82+
disk_type = "pd-standard"
83+
image_type = "COS"
84+
auto_repair = true
85+
auto_upgrade = true
86+
service_account = "project-service-account@<PROJECT ID>.iam.gserviceaccount.com"
87+
preemptible = false
88+
initial_node_count = 80
8889
},
8990
]
9091
@@ -291,7 +292,8 @@ The node_pools variable takes the following parameters:
291292
| image_type | The image type to use for this node. Note that changing the image type will delete and recreate all nodes in the node pool | COS | Optional |
292293
| initial_node_count | The initial number of nodes for the pool. In regional or multi-zonal clusters, this is the number of nodes per zone. Changing this will force recreation of the resource. Defaults to the value of min_count | " " | Optional |
293294
| key | The key required for the taint | | Required |
294-
| local_ssd_count | The amount of local SSD disks that will be attached to each cluster node | 0 | Optional |
295+
| local_ssd_count | The amount of local SSD disks that will be attached to each cluster node and may be used as a `hostpath` volume or a `local` PersistentVolume. | 0 | Optional |
296+
| local_ssd_ephemeral_count | The amount of local SSD disks that will be attached to each cluster node and assigned as scratch space as an `emptyDir` volume. If unspecified, ephemeral storage is backed by the cluster node boot disk. | 0 | Optional |
295297
| machine_type | The name of a Google Compute Engine machine type | e2-medium | Optional |
296298
| max_count | Maximum number of nodes in the NodePool. Must be >= min_count | 100 | Optional |
297299
| max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional |

Diff for: modules/beta-public-cluster-update-variant/cluster.tf

+7
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,13 @@ resource "google_container_node_pool" "pools" {
460460
disk_size_gb = lookup(each.value, "disk_size_gb", 100)
461461
disk_type = lookup(each.value, "disk_type", "pd-standard")
462462

463+
dynamic "ephemeral_storage_config" {
464+
for_each = lookup(each.value, "local_ssd_ephemeral_count", 0) > 0 ? [each.value.local_ssd_ephemeral_count] : []
465+
content {
466+
local_ssd_count = ephemeral_storage_config.value
467+
}
468+
}
469+
463470
service_account = lookup(
464471
each.value,
465472
"service_account",

Diff for: modules/beta-public-cluster/README.md

+17-15
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,21 @@ module "gke" {
4949
5050
node_pools = [
5151
{
52-
name = "default-node-pool"
53-
machine_type = "e2-medium"
54-
node_locations = "us-central1-b,us-central1-c"
55-
min_count = 1
56-
max_count = 100
57-
local_ssd_count = 0
58-
disk_size_gb = 100
59-
disk_type = "pd-standard"
60-
image_type = "COS"
61-
auto_repair = true
62-
auto_upgrade = true
63-
service_account = "project-service-account@<PROJECT ID>.iam.gserviceaccount.com"
64-
preemptible = false
65-
initial_node_count = 80
52+
name = "default-node-pool"
53+
machine_type = "e2-medium"
54+
node_locations = "us-central1-b,us-central1-c"
55+
min_count = 1
56+
max_count = 100
57+
local_ssd_count = 0
58+
local_ssd_ephemeral_count = 0
59+
disk_size_gb = 100
60+
disk_type = "pd-standard"
61+
image_type = "COS"
62+
auto_repair = true
63+
auto_upgrade = true
64+
service_account = "project-service-account@<PROJECT ID>.iam.gserviceaccount.com"
65+
preemptible = false
66+
initial_node_count = 80
6667
},
6768
]
6869
@@ -269,7 +270,8 @@ The node_pools variable takes the following parameters:
269270
| image_type | The image type to use for this node. Note that changing the image type will delete and recreate all nodes in the node pool | COS | Optional |
270271
| initial_node_count | The initial number of nodes for the pool. In regional or multi-zonal clusters, this is the number of nodes per zone. Changing this will force recreation of the resource. Defaults to the value of min_count | " " | Optional |
271272
| key | The key required for the taint | | Required |
272-
| local_ssd_count | The amount of local SSD disks that will be attached to each cluster node | 0 | Optional |
273+
| local_ssd_count | The amount of local SSD disks that will be attached to each cluster node and may be used as a `hostpath` volume or a `local` PersistentVolume. | 0 | Optional |
274+
| local_ssd_ephemeral_count | The amount of local SSD disks that will be attached to each cluster node and assigned as scratch space as an `emptyDir` volume. If unspecified, ephemeral storage is backed by the cluster node boot disk. | 0 | Optional |
273275
| machine_type | The name of a Google Compute Engine machine type | e2-medium | Optional |
274276
| max_count | Maximum number of nodes in the NodePool. Must be >= min_count | 100 | Optional |
275277
| max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional |

Diff for: modules/beta-public-cluster/cluster.tf

+7
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,13 @@ resource "google_container_node_pool" "pools" {
376376
disk_size_gb = lookup(each.value, "disk_size_gb", 100)
377377
disk_type = lookup(each.value, "disk_type", "pd-standard")
378378

379+
dynamic "ephemeral_storage_config" {
380+
for_each = lookup(each.value, "local_ssd_ephemeral_count", 0) > 0 ? [each.value.local_ssd_ephemeral_count] : []
381+
content {
382+
local_ssd_count = ephemeral_storage_config.value
383+
}
384+
}
385+
379386
service_account = lookup(
380387
each.value,
381388
"service_account",

0 commit comments

Comments
 (0)