Skip to content

Commit

Permalink
Add field node_pool_defaults to resource_container_cluster. (#6488)…
Browse files Browse the repository at this point in the history
… (#12452)

* Support enabling GKE image streaming at the cluster level. See #10509

* minor fix to schemaGcfsConfig method.

* Support update node pool default configuration at the cluster level.

* Address comments from GoogleCloudPlatform/magic-modules#6488.

Signed-off-by: Modular Magician <[email protected]>

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Sep 1, 2022
1 parent 4100a1e commit a5fa09d
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 17 deletions.
4 changes: 4 additions & 0 deletions .changelog/6488.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```release-note:enhancement
container: added field `node_pool_defaults` to `resource_container_cluster`.

```
38 changes: 21 additions & 17 deletions google/node_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,26 @@ var defaultOauthScopes = []string{
"https://www.googleapis.com/auth/trace.append",
}

func schemaGcfsConfig(forceNew bool) *schema.Schema {
return &schema.Schema{
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Description: `GCFS configuration for this node.`,
ForceNew: forceNew,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"enabled": {
Type: schema.TypeBool,
Required: true,
ForceNew: forceNew,
Description: `Whether or not GCFS is enabled`,
},
},
},
}
}

func schemaNodeConfig() *schema.Schema {
return &schema.Schema{
Type: schema.TypeList,
Expand Down Expand Up @@ -104,23 +124,7 @@ func schemaNodeConfig() *schema.Schema {
Description: `The number of local SSD disks to be attached to the node.`,
},

"gcfs_config": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Description: `GCFS configuration for this node.`,
ForceNew: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"enabled": {
Type: schema.TypeBool,
Required: true,
ForceNew: true,
Description: `Whether or not GCFS is enabled`,
},
},
},
},
"gcfs_config": schemaGcfsConfig(true),

"gvnic": {
Type: schema.TypeList,
Expand Down
9 changes: 9 additions & 0 deletions website/docs/r/container_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ region are guaranteed to support the same version.
[autopilot](https://cloud.google.com/kubernetes-engine/docs/concepts/autopilot-overview#comparison) clusters and
[node auto-provisioning](https://cloud.google.com/kubernetes-engine/docs/how-to/node-auto-provisioning)-enabled clusters. Structure is [documented below](#nested_node_pool_auto_config).

* `node_pool_defaults` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) Default NodePool settings for the entire cluster. These settings are overridden if specified on the specific NodePool object. Structure is [documented below](#nested_node_pool_defaults).

* `node_version` - (Optional) The Kubernetes version on the nodes. Must either be unset
or set to the same value as `min_master_version` on create. Defaults to the default
version set by GKE which is not necessarily the latest version. This only affects
Expand Down Expand Up @@ -867,6 +869,13 @@ node_pool_auto_config {
}
```

<a name="nested_node_pool_defaults"></a>The `node_pool_defaults` block supports:
* `node_config_defaults` (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) - Subset of NodeConfig message that has defaults.

The `node_config_defaults` block supports:

* `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:

* `pubsub` (Required) - The pubsub config for the cluster's upgrade notifications.
Expand Down

0 comments on commit a5fa09d

Please sign in to comment.