Skip to content

Commit c046af1

Browse files
genlu2011apeabody
andauthored
feat(TPG>=5.40.0)!: Add support for RayOperator Addon (#2032)
Co-authored-by: Gen Lu <genlu@google.com> Co-authored-by: Andrew Peabody <andrewpeabody@google.com>
1 parent f3dc2aa commit c046af1

File tree

52 files changed

+365
-19
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+365
-19
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ Then perform the following commands on the root folder:
228228
| notification\_config\_topic | The desired Pub/Sub topic to which notifications will be sent by GKE. Format is projects/{project}/topics/{topic}. | `string` | `""` | no |
229229
| notification\_filter\_event\_type | Choose what type of notifications you want to receive. If no filters are applied, you'll receive all notification types. Can be used to filter what notifications are sent. Accepted values are UPGRADE\_AVAILABLE\_EVENT, UPGRADE\_EVENT, and SECURITY\_BULLETIN\_EVENT. | `list(string)` | `[]` | no |
230230
| project\_id | The project ID to host the cluster in (required) | `string` | n/a | yes |
231+
| ray\_operator\_config | The Ray Operator Addon configuration for this cluster. | <pre>object({<br> enabled = bool<br> logging_enabled = optional(bool, false)<br> monitoring_enabled = optional(bool, false)<br> })</pre> | <pre>{<br> "enabled": false,<br> "logging_enabled": false,<br> "monitoring_enabled": false<br>}</pre> | no |
231232
| region | The region to host the cluster in (optional if zonal cluster / required if regional) | `string` | `null` | no |
232233
| regional | Whether is a regional cluster (zonal cluster if set false. WARNING: changing this after cluster creation is destructive!) | `bool` | `true` | no |
233234
| registry\_project\_ids | Projects holding Google Container Registries. If empty, we use the cluster project. If a service account is created and the `grant_registry_access` variable is set to `true`, the `storage.objectViewer` and `artifactregsitry.reader` roles are assigned on these projects. | `list(string)` | `[]` | no |

autogen/main/cluster.tf.tmpl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,23 @@ resource "google_container_cluster" "primary" {
361361
enabled = stateful_ha_config.value.enabled
362362
}
363363
}
364+
365+
dynamic "ray_operator_config" {
366+
for_each = local.ray_operator_config
367+
368+
content {
369+
370+
enabled = ray_operator_config.value.enabled
371+
372+
ray_cluster_logging_config {
373+
enabled = ray_operator_config.value.logging_enabled
374+
}
375+
ray_cluster_monitoring_config {
376+
enabled = ray_operator_config.value.monitoring_enabled
377+
}
378+
}
379+
}
380+
364381
{% if beta_cluster and autopilot_cluster != true %}
365382
istio_config {
366383
disabled = !var.istio

autogen/main/main.tf.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ locals {
111111
gke_backup_agent_config = var.gke_backup_agent_config ? [{ enabled = true }] : [{ enabled = false }]
112112
gcs_fuse_csi_driver_config = var.gcs_fuse_csi_driver ? [{ enabled = true }] : []
113113
stateful_ha_config = var.stateful_ha ? [{ enabled = true }] : []
114+
ray_operator_config = length(var.ray_operator_config) > 0 && lookup(var.ray_operator_config, "enabled", false)? [var.ray_operator_config]: []
114115
{% if beta_cluster and autopilot_cluster != true %}
115116
cluster_cloudrun_config_load_balancer_config = (var.cloudrun && var.cloudrun_load_balancer_type != "") ? {
116117
load_balancer_type = var.cloudrun_load_balancer_type

autogen/main/variables.tf.tmpl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,20 @@ variable "stateful_ha" {
814814
default = false
815815
}
816816

817+
variable "ray_operator_config" {
818+
type = object({
819+
enabled = bool
820+
logging_enabled = optional(bool, false)
821+
monitoring_enabled = optional(bool, false)
822+
})
823+
description = "The Ray Operator Addon configuration for this cluster."
824+
default = {
825+
enabled = false
826+
logging_enabled = false
827+
monitoring_enabled = false
828+
}
829+
}
830+
817831
variable "timeouts" {
818832
type = map(string)
819833
description = "Timeout for cluster operations."

autogen/main/versions.tf.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ terraform {
2424
required_providers {
2525
google = {
2626
source = "hashicorp/google"
27-
version = ">= 5.33.0, < 6"
27+
version = ">= 5.40.0, < 6"
2828
}
2929
google-beta = {
3030
source = "hashicorp/google-beta"
31-
version = ">= 5.33.0, < 6"
31+
version = ">= 5.40.0, < 6"
3232
}
3333
kubernetes = {
3434
source = "hashicorp/kubernetes"
@@ -46,7 +46,7 @@ terraform {
4646
required_providers {
4747
google = {
4848
source = "hashicorp/google"
49-
version = ">= 5.25.0, < 6"
49+
version = ">= 5.40.0, < 6"
5050
}
5151
kubernetes = {
5252
source = "hashicorp/kubernetes"

cluster.tf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,23 @@ resource "google_container_cluster" "primary" {
280280
enabled = stateful_ha_config.value.enabled
281281
}
282282
}
283+
284+
dynamic "ray_operator_config" {
285+
for_each = local.ray_operator_config
286+
287+
content {
288+
289+
enabled = ray_operator_config.value.enabled
290+
291+
ray_cluster_logging_config {
292+
enabled = ray_operator_config.value.logging_enabled
293+
}
294+
ray_cluster_monitoring_config {
295+
enabled = ray_operator_config.value.monitoring_enabled
296+
}
297+
}
298+
}
299+
283300
}
284301

285302
datapath_provider = var.datapath_provider

examples/simple_autopilot_public/main.tf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,17 @@ module "gke" {
4444
subnetwork = local.subnet_names[index(module.gcp-network.subnets_names, local.subnet_name)]
4545
ip_range_pods = local.pods_range_name
4646
ip_range_services = local.svc_range_name
47-
release_channel = "REGULAR"
47+
release_channel = "RAPID"
4848
enable_vertical_pod_autoscaling = true
4949
network_tags = [local.cluster_type]
5050
deletion_protection = false
5151
enable_l4_ilb_subsetting = true
5252
gcs_fuse_csi_driver = true
5353
stateful_ha = false
5454
gke_backup_agent_config = false
55+
ray_operator_config = {
56+
enabled = true
57+
logging_enabled = true
58+
monitoring_enabled = true
59+
}
5560
}

main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ locals {
9595
gke_backup_agent_config = var.gke_backup_agent_config ? [{ enabled = true }] : [{ enabled = false }]
9696
gcs_fuse_csi_driver_config = var.gcs_fuse_csi_driver ? [{ enabled = true }] : []
9797
stateful_ha_config = var.stateful_ha ? [{ enabled = true }] : []
98+
ray_operator_config = length(var.ray_operator_config) > 0 && lookup(var.ray_operator_config, "enabled", false) ? [var.ray_operator_config] : []
9899

99100
cluster_authenticator_security_group = var.authenticator_security_group == null ? [] : [{
100101
security_group = var.authenticator_security_group

modules/beta-autopilot-private-cluster/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ Then perform the following commands on the root folder:
135135
| notification\_filter\_event\_type | Choose what type of notifications you want to receive. If no filters are applied, you'll receive all notification types. Can be used to filter what notifications are sent. Accepted values are UPGRADE\_AVAILABLE\_EVENT, UPGRADE\_EVENT, and SECURITY\_BULLETIN\_EVENT. | `list(string)` | `[]` | no |
136136
| private\_endpoint\_subnetwork | The subnetwork to use for the hosted master network. | `string` | `null` | no |
137137
| project\_id | The project ID to host the cluster in (required) | `string` | n/a | yes |
138+
| ray\_operator\_config | The Ray Operator Addon configuration for this cluster. | <pre>object({<br> enabled = bool<br> logging_enabled = optional(bool, false)<br> monitoring_enabled = optional(bool, false)<br> })</pre> | <pre>{<br> "enabled": false,<br> "logging_enabled": false,<br> "monitoring_enabled": false<br>}</pre> | no |
138139
| region | The region to host the cluster in (optional if zonal cluster / required if regional) | `string` | `null` | no |
139140
| regional | Whether is a regional cluster (zonal cluster if set false. WARNING: changing this after cluster creation is destructive!) | `bool` | `true` | no |
140141
| registry\_project\_ids | Projects holding Google Container Registries. If empty, we use the cluster project. If a service account is created and the `grant_registry_access` variable is set to `true`, the `storage.objectViewer` and `artifactregsitry.reader` roles are assigned on these projects. | `list(string)` | `[]` | no |

modules/beta-autopilot-private-cluster/cluster.tf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,23 @@ resource "google_container_cluster" "primary" {
173173
enabled = stateful_ha_config.value.enabled
174174
}
175175
}
176+
177+
dynamic "ray_operator_config" {
178+
for_each = local.ray_operator_config
179+
180+
content {
181+
182+
enabled = ray_operator_config.value.enabled
183+
184+
ray_cluster_logging_config {
185+
enabled = ray_operator_config.value.logging_enabled
186+
}
187+
ray_cluster_monitoring_config {
188+
enabled = ray_operator_config.value.monitoring_enabled
189+
}
190+
}
191+
}
192+
176193
}
177194

178195
allow_net_admin = var.allow_net_admin

0 commit comments

Comments
 (0)