Skip to content

Commit f490a88

Browse files
Add support for Ray Operator on GKE (#11145) (#7795)
[upstream:78b6e94c2527e11e0011805e7b61fcd2cd7d427e] Signed-off-by: Modular Magician <[email protected]>
1 parent 2bccac5 commit f490a88

File tree

4 files changed

+119
-0
lines changed

4 files changed

+119
-0
lines changed

.changelog/11145.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
container: added field `ray_operator_config` for `resource_container_cluster`
3+
```

google-beta/services/container/resource_container_cluster.go

+87
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ var (
8787
"addons_config.0.config_connector_config",
8888
"addons_config.0.gcs_fuse_csi_driver_config",
8989
"addons_config.0.stateful_ha_config",
90+
"addons_config.0.ray_operator_config",
9091
"addons_config.0.istio_config",
9192
"addons_config.0.kalm_config",
9293
}
@@ -522,6 +523,52 @@ func ResourceContainerCluster() *schema.Resource {
522523
},
523524
},
524525
},
526+
"ray_operator_config": {
527+
Type: schema.TypeList,
528+
Optional: true,
529+
Computed: true,
530+
AtLeastOneOf: addonsConfigKeys,
531+
MaxItems: 3,
532+
Description: `The status of the Ray Operator addon, which enabled management of Ray AI/ML jobs on GKE. Defaults to disabled; set enabled = true to enable.`,
533+
Elem: &schema.Resource{
534+
Schema: map[string]*schema.Schema{
535+
"enabled": {
536+
Type: schema.TypeBool,
537+
Required: true,
538+
},
539+
"ray_cluster_logging_config": {
540+
Type: schema.TypeList,
541+
Optional: true,
542+
Computed: true,
543+
MaxItems: 1,
544+
Description: `The status of Ray Logging, which scrapes Ray cluster logs to Cloud Logging. Defaults to disabled; set enabled = true to enable.`,
545+
Elem: &schema.Resource{
546+
Schema: map[string]*schema.Schema{
547+
"enabled": {
548+
Type: schema.TypeBool,
549+
Required: true,
550+
},
551+
},
552+
},
553+
},
554+
"ray_cluster_monitoring_config": {
555+
Type: schema.TypeList,
556+
Optional: true,
557+
Computed: true,
558+
MaxItems: 1,
559+
Description: `The status of Ray Cluster monitoring, which shows Ray cluster metrics in Cloud Console. Defaults to disabled; set enabled = true to enable.`,
560+
Elem: &schema.Resource{
561+
Schema: map[string]*schema.Schema{
562+
"enabled": {
563+
Type: schema.TypeBool,
564+
Required: true,
565+
},
566+
},
567+
},
568+
},
569+
},
570+
},
571+
},
525572
},
526573
},
527574
},
@@ -4521,6 +4568,28 @@ func expandClusterAddonsConfig(configured interface{}) *container.AddonsConfig {
45214568
}
45224569
}
45234570

4571+
if v, ok := config["ray_operator_config"]; ok && len(v.([]interface{})) > 0 {
4572+
addon := v.([]interface{})[0].(map[string]interface{})
4573+
ac.RayOperatorConfig = &container.RayOperatorConfig{
4574+
Enabled: addon["enabled"].(bool),
4575+
ForceSendFields: []string{"Enabled"},
4576+
}
4577+
if v, ok := addon["ray_cluster_logging_config"]; ok && len(v.([]interface{})) > 0 {
4578+
loggingConfig := v.([]interface{})[0].(map[string]interface{})
4579+
ac.RayOperatorConfig.RayClusterLoggingConfig = &container.RayClusterLoggingConfig{
4580+
Enabled: loggingConfig["enabled"].(bool),
4581+
ForceSendFields: []string{"Enabled"},
4582+
}
4583+
}
4584+
if v, ok := addon["ray_cluster_monitoring_config"]; ok && len(v.([]interface{})) > 0 {
4585+
loggingConfig := v.([]interface{})[0].(map[string]interface{})
4586+
ac.RayOperatorConfig.RayClusterMonitoringConfig = &container.RayClusterMonitoringConfig{
4587+
Enabled: loggingConfig["enabled"].(bool),
4588+
ForceSendFields: []string{"Enabled"},
4589+
}
4590+
}
4591+
}
4592+
45244593
if v, ok := config["istio_config"]; ok && len(v.([]interface{})) > 0 {
45254594
addon := v.([]interface{})[0].(map[string]interface{})
45264595
ac.IstioConfig = &container.IstioConfig{
@@ -5705,6 +5774,24 @@ func flattenClusterAddonsConfig(c *container.AddonsConfig) []map[string]interfac
57055774
},
57065775
}
57075776
}
5777+
if c.RayOperatorConfig != nil {
5778+
rayConfig := c.RayOperatorConfig
5779+
result["ray_operator_config"] = []map[string]interface{}{
5780+
{
5781+
"enabled": rayConfig.Enabled,
5782+
},
5783+
}
5784+
if rayConfig.RayClusterLoggingConfig != nil {
5785+
result["ray_operator_config"].([]map[string]any)[0]["ray_cluster_logging_config"] = []map[string]interface{}{{
5786+
"enabled": rayConfig.RayClusterLoggingConfig.Enabled,
5787+
}}
5788+
}
5789+
if rayConfig.RayClusterMonitoringConfig != nil {
5790+
result["ray_operator_config"].([]map[string]any)[0]["ray_cluster_monitoring_config"] = []map[string]interface{}{{
5791+
"enabled": rayConfig.RayClusterMonitoringConfig.Enabled,
5792+
}}
5793+
}
5794+
}
57085795

57095796
if c.IstioConfig != nil {
57105797
result["istio_config"] = []map[string]interface{}{

google-beta/services/container/resource_container_cluster_test.go

+15
Original file line numberDiff line numberDiff line change
@@ -5209,6 +5209,9 @@ resource "google_container_cluster" "primary" {
52095209
initial_node_count = 1
52105210
52115211
min_master_version = "latest"
5212+
release_channel {
5213+
channel = "RAPID"
5214+
}
52125215
52135216
workload_identity_config {
52145217
workload_pool = "${data.google_project.project.project_id}.svc.id.goog"
@@ -5248,6 +5251,9 @@ resource "google_container_cluster" "primary" {
52485251
stateful_ha_config {
52495252
enabled = false
52505253
}
5254+
ray_operator_config {
5255+
enabled = false
5256+
}
52515257
istio_config {
52525258
disabled = true
52535259
auth = "AUTH_MUTUAL_TLS"
@@ -5316,6 +5322,15 @@ resource "google_container_cluster" "primary" {
53165322
stateful_ha_config {
53175323
enabled = true
53185324
}
5325+
ray_operator_config {
5326+
enabled = true
5327+
ray_cluster_logging_config {
5328+
enabled = true
5329+
}
5330+
ray_cluster_monitoring_config {
5331+
enabled = true
5332+
}
5333+
}
53195334
istio_config {
53205335
disabled = false
53215336
auth = "AUTH_NONE"

website/docs/r/container_cluster.html.markdown

+14
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,20 @@ Fleet configuration for the cluster. Structure is [documented below](#nested_fle
459459
The status of the Stateful HA addon, which provides automatic configurable failover for stateful applications.
460460
It is disabled by default for Standard clusters. Set `enabled = true` to enable.
461461

462+
* `ray_operator_config` - (Optional). The status of the [Ray Operator
463+
addon](https://cloud.google.com/kubernetes-engine/docs/add-on/ray-on-gke/concepts/overview).
464+
It is disabled by default. Set `enabled = true` to enable. The minimum
465+
cluster version to enable Ray is 1.30.0-gke.1747000.
466+
467+
Ray Operator config has optional subfields
468+
`ray_cluster_logging_config.enabled` and
469+
`ray_cluster_monitoring_config.enabled` which control Ray Cluster logging
470+
and monitoring respectively. See [Collect and view logs and metrics for Ray
471+
clusters on
472+
GKE](https://cloud.google.com/kubernetes-engine/docs/add-on/ray-on-gke/how-to/collect-view-logs-metrics)
473+
for more information.
474+
475+
462476
This example `addons_config` disables two addons:
463477

464478
```hcl

0 commit comments

Comments
 (0)