Skip to content

Commit

Permalink
Enable usage of gcp filestore csi driver (GoogleCloudPlatform#5648)
Browse files Browse the repository at this point in the history
  • Loading branch information
grieshaber authored and lcaggio committed Mar 16, 2022
1 parent 5128700 commit a7691ae
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ var (
"addons_config.0.horizontal_pod_autoscaling",
"addons_config.0.network_policy_config",
"addons_config.0.cloudrun_config",
"addons_config.0.gcp_filestore_csi_driver_config",
<% unless version == 'ga' -%>
"addons_config.0.istio_config",
"addons_config.0.dns_cache_config",
Expand Down Expand Up @@ -259,6 +260,23 @@ func resourceContainerCluster() *schema.Resource {
},
},
},
"gcp_filestore_csi_driver_config": {
Type: schema.TypeList,
Optional: true,
Computed: true,
AtLeastOneOf: addonsConfigKeys,
MaxItems: 1,
Description: `The status of the Filestore CSI driver addon, which allows the usage of filestore instance as volumes. Defaults to disabled; set enabled = true to enable.`,
ConflictsWith: []string{"enable_autopilot"},
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"enabled": {
Type: schema.TypeBool,
Required: true,
},
},
},
},
"cloudrun_config": {
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -3027,6 +3045,14 @@ func expandClusterAddonsConfig(configured interface{}) *container.AddonsConfig {
ForceSendFields: []string{"Disabled"},
}
}

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

if v, ok := config["cloudrun_config"]; ok && len(v.([]interface{})) > 0 {
addon := v.([]interface{})[0].(map[string]interface{})
Expand Down Expand Up @@ -3676,6 +3702,14 @@ func flattenClusterAddonsConfig(c *container.AddonsConfig) []map[string]interfac
},
}
}

if c.GcpFilestoreCsiDriverConfig != nil {
result["gcp_filestore_csi_driver_config"] = []map[string]interface{}{
{
"enabled": c.GcpFilestoreCsiDriverConfig.Enabled,
},
}
}

if c.CloudRunConfig != nil {
cloudRunConfig := map[string]interface{}{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2541,6 +2541,9 @@ resource "google_container_cluster" "primary" {
network_policy_config {
disabled = true
}
gcp_filestore_csi_driver_config {
enabled = false
}
cloudrun_config {
disabled = true
}
Expand Down Expand Up @@ -2594,6 +2597,9 @@ resource "google_container_cluster" "primary" {
network_policy_config {
disabled = false
}
gcp_filestore_csi_driver_config {
enabled = true
}
cloudrun_config {
disabled = false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,10 @@ subnetwork in which the cluster's instances are launched.
It can only be disabled if the nodes already do not have network policies enabled.
Defaults to disabled; set `disabled = false` to enable.

* `gcp_filestore_csi_driver_config` - (Optional) The status of the Filestore CSI driver addon,
which allows the usage of filestore instance as volumes.
It is disbaled by default; set `enabled = true` to enable.

* `cloudrun_config` - (Optional). Structure is [documented below](#nested_cloudrun_config).

* `istio_config` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)).
Expand Down

0 comments on commit a7691ae

Please sign in to comment.