Skip to content

Commit

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

Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician authored Nov 1, 2024
1 parent 803b5f5 commit 0f3813c
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/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",
}

privateClusterConfigKeys = []string{
Expand Down Expand Up @@ -428,6 +429,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,
},
},
},
},
"config_connector_config": {
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -4388,6 +4405,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"},
}
}

return ac
}

Expand Down Expand Up @@ -5494,6 +5519,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,
},
}
}

return []map[string]interface{}{result}
}
Expand Down
6 changes: 6 additions & 0 deletions google/services/container/resource_container_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5579,6 +5579,9 @@ resource "google_container_cluster" "primary" {
}
ray_operator_config {
enabled = false
}
parallelstore_csi_driver_config {
enabled = false
}
}
network = "%s"
Expand Down Expand Up @@ -5650,6 +5653,9 @@ resource "google_container_cluster" "primary" {
ray_cluster_monitoring_config {
enabled = true
}
}
parallelstore_csi_driver_config {
enabled = true
}
}
network = "%s"
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 0f3813c

Please sign in to comment.