Skip to content

Commit

Permalink
container: bump gcsfs to GA
Browse files Browse the repository at this point in the history
  • Loading branch information
DrFaust92 committed Aug 24, 2024
1 parent d5c7458 commit c4d683e
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -788,15 +788,15 @@ func expandNodeConfigDefaults(configured interface{}) *container.NodeConfigDefau
},
}
}
{{- if ne $.TargetVersionName "ga" }}
if v, ok := config["gcfs_config"]; ok && len(v.([]interface{})) > 0 {
gcfsConfig := v.([]interface{})[0].(map[string]interface{})

if v, ok := config["gcfs_config"]; ok && len(v.([]interface{})) > 0 {
gcfsConfig := v.([]interface{})[0].(map[string]interface{})
nodeConfigDefaults.GcfsConfig = &container.GcfsConfig{
Enabled: gcfsConfig["enabled"].(bool),
}
}
{{- end }}
return nodeConfigDefaults

return nodeConfigDefaults
}

func expandNodeConfig(v interface{}) *container.NodeConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,7 @@ func clusterSchemaNodePoolDefaults() *schema.Schema {
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"containerd_config": schemaContainerdConfig(),
{{- if ne $.TargetVersionName "ga" }}
"gcfs_config": schemaGcfsConfig(false),
{{- end }}
"logging_variant": schemaLoggingVariant(),
},
},
Expand Down Expand Up @@ -4275,7 +4273,6 @@ func resourceContainerClusterUpdate(d *schema.ResourceData, meta interface{}) er
}
}

{{ if ne $.TargetVersionName `ga` -}}
if d.HasChange("node_pool_defaults") && d.HasChange("node_pool_defaults.0.node_config_defaults.0.gcfs_config") {
if v, ok := d.GetOk("node_pool_defaults.0.node_config_defaults.0.gcfs_config"); ok {
gcfsConfig := v.([]interface{})[0].(map[string]interface{})
Expand All @@ -4296,7 +4293,6 @@ func resourceContainerClusterUpdate(d *schema.ResourceData, meta interface{}) er
log.Printf("[INFO] GKE cluster %s default gcfs config has been updated", d.Id())
}
}
{{- end }}

if d.HasChange("security_posture_config") {
req := &container.UpdateClusterRequest{
Expand Down
13 changes: 6 additions & 7 deletions mmv1/third_party/terraform/services/container/node_config.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -784,15 +784,15 @@ func expandNodeConfigDefaults(configured interface{}) *container.NodeConfigDefau
},
}
}
<% unless version == "ga" -%>
if v, ok := config["gcfs_config"]; ok && len(v.([]interface{})) > 0 {
gcfsConfig := v.([]interface{})[0].(map[string]interface{})

if v, ok := config["gcfs_config"]; ok && len(v.([]interface{})) > 0 {
gcfsConfig := v.([]interface{})[0].(map[string]interface{})
nodeConfigDefaults.GcfsConfig = &container.GcfsConfig{
Enabled: gcfsConfig["enabled"].(bool),
}
}
<% end -%>
return nodeConfigDefaults

return nodeConfigDefaults
}

func expandNodeConfig(v interface{}) *container.NodeConfig {
Expand Down Expand Up @@ -1360,9 +1360,8 @@ func flattenNodeConfigDefaults(c *container.NodeConfigDefaults) []map[string]int

result[0]["logging_variant"] = flattenLoggingVariant(c.LoggingConfig)

<% unless version == 'ga' -%>
result[0]["gcfs_config"] = flattenGcfsConfig(c.GcfsConfig)
<% end -%>

return result
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,7 @@ func clusterSchemaNodePoolDefaults() *schema.Schema {
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"containerd_config": schemaContainerdConfig(),
<% unless version == 'ga' -%>
"gcfs_config": schemaGcfsConfig(false),
<% end -%>
"logging_variant": schemaLoggingVariant(),
},
},
Expand Down Expand Up @@ -4282,7 +4280,6 @@ func resourceContainerClusterUpdate(d *schema.ResourceData, meta interface{}) er
}
}

<% unless version == 'ga' -%>
if d.HasChange("node_pool_defaults") && d.HasChange("node_pool_defaults.0.node_config_defaults.0.gcfs_config") {
if v, ok := d.GetOk("node_pool_defaults.0.node_config_defaults.0.gcfs_config"); ok {
gcfsConfig := v.([]interface{})[0].(map[string]interface{})
Expand All @@ -4303,7 +4300,6 @@ func resourceContainerClusterUpdate(d *schema.ResourceData, meta interface{}) er
log.Printf("[INFO] GKE cluster %s default gcfs config has been updated", d.Id())
}
}
<% end -%>

if d.HasChange("security_posture_config") {
req := &container.UpdateClusterRequest{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1655,7 +1655,6 @@ func TestAccContainerCluster_withAdvancedMachineFeaturesInNodePool(t *testing.T)
})
}

<% unless version == 'ga' -%>
func TestAccContainerCluster_withNodePoolDefaults(t *testing.T) {
t.Parallel()
clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10))
Expand Down Expand Up @@ -1713,7 +1712,6 @@ func TestAccContainerCluster_withNodePoolDefaults(t *testing.T) {
},
})
}
<% end -%>

func TestAccContainerCluster_withNodeConfigScopeAlias(t *testing.T) {
t.Parallel()
Expand Down Expand Up @@ -6558,7 +6556,6 @@ resource "google_container_cluster" "with_advanced_machine_features_in_node_pool
`, clusterName, nodePoolName, nvEnabled, networkName, subnetworkName)
}

<% unless version == 'ga' -%>
func testAccContainerCluster_withNodePoolDefaults(clusterName, enabled, networkName, subnetworkName string) string {
return fmt.Sprintf(`
resource "google_container_cluster" "with_node_pool_defaults" {
Expand All @@ -6579,7 +6576,6 @@ resource "google_container_cluster" "with_node_pool_defaults" {
}
`, clusterName, enabled, networkName, subnetworkName)
}
<% end -%>

func testAccContainerCluster_withNodeConfigUpdate(clusterName, networkName, subnetworkName string) string {
return fmt.Sprintf(`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,7 @@ The `node_config_defaults` block supports:

* `logging_variant` (Optional) The type of logging agent that is deployed by default for newly created node pools in the cluster. Valid values include DEFAULT and MAX_THROUGHPUT. See [Increasing logging agent throughput](https://cloud.google.com/stackdriver/docs/solutions/gke/managing-logs#throughput) for more information.

* `gcfs_config` (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) The default Google Container Filesystem (GCFS) configuration at the cluster level. e.g. enable [image streaming](https://cloud.google.com/kubernetes-engine/docs/how-to/image-streaming) across all the node pools within the cluster. Structure is [documented below](#nested_gcfs_config).
* `gcfs_config` (Optional) The default Google Container Filesystem (GCFS) configuration at the cluster level. e.g. enable [image streaming](https://cloud.google.com/kubernetes-engine/docs/how-to/image-streaming) across all the node pools within the cluster. Structure is [documented below](#nested_gcfs_config).

<a name="nested_notification_config"></a>The `notification_config` block supports:

Expand Down

0 comments on commit c4d683e

Please sign in to comment.