Skip to content

Commit a5fa09d

Browse files
Add field node_pool_defaults to resource_container_cluster. (#6488) (#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]>
1 parent 4100a1e commit a5fa09d

File tree

3 files changed

+34
-17
lines changed

3 files changed

+34
-17
lines changed

.changelog/6488.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
```release-note:enhancement
2+
container: added field `node_pool_defaults` to `resource_container_cluster`.
3+
4+
```

google/node_config.go

+21-17
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,26 @@ var defaultOauthScopes = []string{
1616
"https://www.googleapis.com/auth/trace.append",
1717
}
1818

19+
func schemaGcfsConfig(forceNew bool) *schema.Schema {
20+
return &schema.Schema{
21+
Type: schema.TypeList,
22+
Optional: true,
23+
MaxItems: 1,
24+
Description: `GCFS configuration for this node.`,
25+
ForceNew: forceNew,
26+
Elem: &schema.Resource{
27+
Schema: map[string]*schema.Schema{
28+
"enabled": {
29+
Type: schema.TypeBool,
30+
Required: true,
31+
ForceNew: forceNew,
32+
Description: `Whether or not GCFS is enabled`,
33+
},
34+
},
35+
},
36+
}
37+
}
38+
1939
func schemaNodeConfig() *schema.Schema {
2040
return &schema.Schema{
2141
Type: schema.TypeList,
@@ -104,23 +124,7 @@ func schemaNodeConfig() *schema.Schema {
104124
Description: `The number of local SSD disks to be attached to the node.`,
105125
},
106126

107-
"gcfs_config": {
108-
Type: schema.TypeList,
109-
Optional: true,
110-
MaxItems: 1,
111-
Description: `GCFS configuration for this node.`,
112-
ForceNew: true,
113-
Elem: &schema.Resource{
114-
Schema: map[string]*schema.Schema{
115-
"enabled": {
116-
Type: schema.TypeBool,
117-
Required: true,
118-
ForceNew: true,
119-
Description: `Whether or not GCFS is enabled`,
120-
},
121-
},
122-
},
123-
},
127+
"gcfs_config": schemaGcfsConfig(true),
124128

125129
"gvnic": {
126130
Type: schema.TypeList,

website/docs/r/container_cluster.html.markdown

+9
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,8 @@ region are guaranteed to support the same version.
269269
[autopilot](https://cloud.google.com/kubernetes-engine/docs/concepts/autopilot-overview#comparison) clusters and
270270
[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).
271271

272+
* `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).
273+
272274
* `node_version` - (Optional) The Kubernetes version on the nodes. Must either be unset
273275
or set to the same value as `min_master_version` on create. Defaults to the default
274276
version set by GKE which is not necessarily the latest version. This only affects
@@ -867,6 +869,13 @@ node_pool_auto_config {
867869
}
868870
```
869871

872+
<a name="nested_node_pool_defaults"></a>The `node_pool_defaults` block supports:
873+
* `node_config_defaults` (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) - Subset of NodeConfig message that has defaults.
874+
875+
The `node_config_defaults` block supports:
876+
877+
* `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).
878+
870879
<a name="nested_notification_config"></a>The `notification_config` block supports:
871880

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

0 commit comments

Comments
 (0)