Skip to content

Commit

Permalink
GKE Parallelstore CSI Driver Terraform Integration (#12147) (#8607)
Browse files Browse the repository at this point in the history
[upstream:2c0d6eb23d5c498c9611412b038df5628e64d1db]

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Nov 1, 2024
1 parent 9796692 commit eff8ef7
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/12147.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:note
container: added `parallelstore_csi_driver_config` field to `google_container_cluster` resource.
```
32 changes: 32 additions & 0 deletions google-beta/services/container/resource_container_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ var (
"addons_config.0.gcs_fuse_csi_driver_config",
"addons_config.0.stateful_ha_config",
"addons_config.0.ray_operator_config",
"addons_config.0.parallelstore_csi_driver_config",
"addons_config.0.istio_config",
"addons_config.0.kalm_config",
}
Expand Down Expand Up @@ -431,6 +432,22 @@ func ResourceContainerCluster() *schema.Resource {
},
},
},
"parallelstore_csi_driver_config": {
Type: schema.TypeList,
Optional: true,
Computed: true,
AtLeastOneOf: addonsConfigKeys,
MaxItems: 1,
Description: `The status of the Parallelstore CSI driver addon, which allows the usage of Parallelstore instances as volumes. Defaults to disabled; set enabled = true to enable.`,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"enabled": {
Type: schema.TypeBool,
Required: true,
},
},
},
},
"istio_config": {
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -4698,6 +4715,14 @@ func expandClusterAddonsConfig(configured interface{}) *container.AddonsConfig {
}
}

if v, ok := config["parallelstore_csi_driver_config"]; ok && len(v.([]interface{})) > 0 {
addon := v.([]interface{})[0].(map[string]interface{})
ac.ParallelstoreCsiDriverConfig = &container.ParallelstoreCsiDriverConfig{
Enabled: addon["enabled"].(bool),
ForceSendFields: []string{"Enabled"},
}
}

if v, ok := config["istio_config"]; ok && len(v.([]interface{})) > 0 {
addon := v.([]interface{})[0].(map[string]interface{})
ac.IstioConfig = &container.IstioConfig{
Expand Down Expand Up @@ -5921,6 +5946,13 @@ func flattenClusterAddonsConfig(c *container.AddonsConfig) []map[string]interfac
}}
}
}
if c.ParallelstoreCsiDriverConfig != nil {
result["parallelstore_csi_driver_config"] = []map[string]interface{}{
{
"enabled": c.ParallelstoreCsiDriverConfig.Enabled,
},
}
}

if c.IstioConfig != nil {
result["istio_config"] = []map[string]interface{}{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6083,6 +6083,9 @@ resource "google_container_cluster" "primary" {
}
ray_operator_config {
enabled = false
}
parallelstore_csi_driver_config {
enabled = false
}
istio_config {
disabled = true
Expand Down Expand Up @@ -6161,6 +6164,9 @@ resource "google_container_cluster" "primary" {
ray_cluster_monitoring_config {
enabled = true
}
}
parallelstore_csi_driver_config {
enabled = true
}
istio_config {
disabled = false
Expand Down
5 changes: 5 additions & 0 deletions website/docs/r/container_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,11 @@ Fleet configuration for the cluster. Structure is [documented below](#nested_fle
GKE](https://cloud.google.com/kubernetes-engine/docs/add-on/ray-on-gke/how-to/collect-view-logs-metrics)
for more information.

* `parallelstore_csi_driver_config` - (Optional) The status of the Parallelstore CSI driver addon,
which allows the usage of a Parallelstore instances as volumes.
It is disabled by default for Standard clusters; set `enabled = true` to enable.
It is enabled by default for Autopilot clusters with version 1.29 or later; set `enabled = true` to enable it explicitly.
See [Enable the Parallelstore CSI driver](https://cloud.google.com/kubernetes-engine/docs/how-to/persistent-volumes/parallelstore-csi-new-volume#enable) for more information.

This example `addons_config` disables two addons:

Expand Down

0 comments on commit eff8ef7

Please sign in to comment.