Skip to content

Commit fcf15ac

Browse files
authored
Support cpu platform and disk type configuration (#1123)
1 parent f74d80b commit fcf15ac

File tree

9 files changed

+64
-8
lines changed

9 files changed

+64
-8
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ tf_vars := TF_VAR_environment=$(TERRAFORM_ENVIRONMENT) \
5454
$(call tfvar, GRAFANA_MANAGED) \
5555
$(call tfvar, FILESTORE_CACHE_ENABLED) \
5656
$(call tfvar, FILESTORE_CACHE_TIER) \
57-
$(call tfvar, FILESTORE_CACHE_CAPACITY_GB)
57+
$(call tfvar, FILESTORE_CACHE_CAPACITY_GB) \
58+
$(call tfvar, BUILD_CLUSTER_CACHE_DISK_TYPE) \
59+
$(call tfvar, CLIENT_CLUSTER_CACHE_DISK_TYPE) \
60+
$(call tfvar, MIN_CPU_PLATFORM)
5861

5962
# Login for Packer and Docker (uses gcloud user creds)
6063
# Login for Terraform (uses application default creds)

main.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,10 @@ module "cluster" {
9292

9393
client_cluster_size_max = var.client_cluster_size_max
9494
client_cluster_cache_disk_size_gb = var.client_cluster_cache_disk_size_gb
95+
client_cluster_cache_disk_type = var.client_cluster_cache_disk_type
9596
build_cluster_root_disk_size_gb = var.build_cluster_root_disk_size_gb
9697
build_cluster_cache_disk_size_gb = var.build_cluster_cache_disk_size_gb
98+
build_cluster_cache_disk_type = var.build_cluster_cache_disk_type
9799

98100
api_cluster_size = var.api_cluster_size
99101
build_cluster_size = var.build_cluster_size
@@ -143,6 +145,8 @@ module "cluster" {
143145

144146
labels = var.labels
145147
prefix = var.prefix
148+
149+
min_cpu_platform = var.min_cpu_platform
146150
}
147151

148152
module "api" {

packages/cluster/build-cluster/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ resource "google_compute_instance_template" "build" {
6565

6666
instance_description = var.cluster_description
6767
machine_type = var.machine_type
68-
min_cpu_platform = "Intel Skylake"
68+
min_cpu_platform = var.min_cpu_platform
6969

7070
labels = merge(
7171
var.labels,
@@ -99,7 +99,7 @@ resource "google_compute_instance_template" "build" {
9999
boot = false
100100
type = "PERSISTENT"
101101
disk_size_gb = var.cache_volume_disk_size_gb
102-
disk_type = "pd-ssd"
102+
disk_type = var.cache_volume_disk_type
103103
}
104104

105105
network_interface {

packages/cluster/build-cluster/variables.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,3 +162,11 @@ variable "docker_reverse_proxy_port" {
162162
health_path = string
163163
})
164164
}
165+
166+
variable "min_cpu_platform" {
167+
type = string
168+
}
169+
170+
variable "cache_volume_disk_type" {
171+
type = string
172+
}

packages/cluster/client/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ resource "google_compute_instance_template" "client" {
9696

9797
instance_description = var.cluster_description
9898
machine_type = var.machine_type
99-
min_cpu_platform = "Intel Skylake"
99+
min_cpu_platform = var.min_cpu_platform
100100

101101
labels = merge(
102102
var.labels,
@@ -130,7 +130,7 @@ resource "google_compute_instance_template" "client" {
130130
boot = false
131131
type = "PERSISTENT"
132132
disk_size_gb = var.cache_volume_disk_size_gb
133-
disk_type = "pd-ssd"
133+
disk_type = var.cache_volume_disk_type
134134
}
135135

136136
network_interface {

packages/cluster/client/variables.tf

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,12 @@ variable "cache_volume_disk_size_gb" {
134134
description = "The size, in GB, of the disk for an orchestrator cache."
135135
type = number
136136
}
137-
# Update Policy
138137

138+
variable "cache_volume_disk_type" {
139+
type = string
140+
}
141+
142+
# Update Policy
139143

140144
variable "instance_group_update_policy_minimal_action" {
141145
description = "Minimal action to be taken on an instance. You can specify either 'RESTART' to restart existing instances or 'REPLACE' to delete and create new instances from the target template. If you specify a 'RESTART', the Updater will attempt to perform that action only. However, if the Updater determines that the minimal action you specify is not enough to perform the update, it might perform a more disruptive action."
@@ -181,3 +185,7 @@ variable "logs_health_proxy_port" {
181185
health_path = string
182186
})
183187
}
188+
189+
variable "min_cpu_platform" {
190+
type = string
191+
}

packages/cluster/main.tf

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,14 @@ module "client_cluster" {
156156
cluster_size = var.client_cluster_size
157157
cluster_tag_name = var.cluster_tag_name
158158
cache_volume_disk_size_gb = var.client_cluster_cache_disk_size_gb
159+
cache_volume_disk_type = var.client_cluster_cache_disk_type
159160

160161
gcp_region = var.gcp_region
161162
gcp_zone = var.gcp_zone
162163

163-
machine_type = var.client_machine_type
164-
image_family = var.client_image_family
164+
min_cpu_platform = var.min_cpu_platform
165+
machine_type = var.client_machine_type
166+
image_family = var.client_image_family
165167

166168
network_name = var.network_name
167169

@@ -304,10 +306,12 @@ module "build_cluster" {
304306
cluster_tag_name = var.cluster_tag_name
305307
gcp_zone = var.gcp_zone
306308

309+
min_cpu_platform = var.min_cpu_platform
307310
machine_type = var.build_machine_type
308311
image_family = var.build_image_family
309312
root_volume_disk_size_gb = var.build_cluster_root_disk_size_gb
310313
cache_volume_disk_size_gb = var.build_cluster_cache_disk_size_gb
314+
cache_volume_disk_type = var.build_cluster_cache_disk_type
311315

312316
network_name = var.network_name
313317

packages/cluster/variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ variable "build_cluster_cache_disk_size_gb" {
6969
type = number
7070
}
7171

72+
variable "build_cluster_cache_disk_type" {
73+
type = string
74+
}
75+
7276
variable "edge_api_port" {
7377
type = object({
7478
name = string
@@ -126,6 +130,10 @@ variable "client_cluster_cache_disk_size_gb" {
126130
type = number
127131
}
128132

133+
variable "client_cluster_cache_disk_type" {
134+
type = string
135+
}
136+
129137
variable "gcp_project_id" {
130138
type = string
131139
}
@@ -276,3 +284,7 @@ variable "filestore_cache_capacity_gb" {
276284
type = number
277285
default = 0
278286
}
287+
288+
variable "min_cpu_platform" {
289+
type = string
290+
}

variables.tf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ variable "build_cluster_cache_disk_size_gb" {
6262
default = 200
6363
}
6464

65+
variable "build_cluster_cache_disk_type" {
66+
description = "The GCE cache disk type for the build machines."
67+
type = string
68+
default = "pd-ssd"
69+
}
70+
6571
variable "clickhouse_cluster_size" {
6672
type = number
6773
}
@@ -228,6 +234,12 @@ variable "client_cluster_cache_disk_size_gb" {
228234
default = 500
229235
}
230236

237+
variable "client_cluster_cache_disk_type" {
238+
description = "The GCE cache disk type for the client machines."
239+
type = string
240+
default = "pd-ssd"
241+
}
242+
231243
variable "orchestrator_port" {
232244
type = number
233245
default = 5008
@@ -377,3 +389,8 @@ variable "filestore_cache_capacity_gb" {
377389
description = "The capacity of the Filestore cache in GB"
378390
default = 0
379391
}
392+
393+
variable "min_cpu_platform" {
394+
type = string
395+
default = "Intel Skylake"
396+
}

0 commit comments

Comments
 (0)