Skip to content

Commit ad20956

Browse files
committed
switch to optional bool for module implementation
1 parent d6185ae commit ad20956

File tree

24 files changed

+53
-93
lines changed

24 files changed

+53
-93
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ Then perform the following commands on the root folder:
189189
| http\_load\_balancing | Enable httpload balancer addon | `bool` | `true` | no |
190190
| identity\_namespace | The workload pool to attach all Kubernetes service accounts to. (Default value of `enabled` automatically sets project-based pool `[project_id].svc.id.goog`) | `string` | `"enabled"` | no |
191191
| initial\_node\_count | The number of nodes to create in this cluster's default node pool. | `number` | `0` | no |
192-
| insecure\_kubelet\_readonly\_port\_enabled | Whether or not to set `insecure_kubelet_readonly_port_enabled` for node pool defaults and autopilot clusters. Note: this can be set at the node pool level separately within `node_pools`. | `string` | `""` | no |
192+
| insecure\_kubelet\_readonly\_port\_enabled | Whether or not to set `insecure_kubelet_readonly_port_enabled` for node pool defaults and autopilot clusters. Note: this can be set at the node pool level separately within `node_pools`. | `bool` | `null` | no |
193193
| ip\_masq\_link\_local | Whether to masquerade traffic to the link-local prefix (169.254.0.0/16). | `bool` | `false` | no |
194194
| ip\_masq\_resync\_interval | The interval at which the agent attempts to sync its ConfigMap file from the disk. | `string` | `"60s"` | no |
195195
| ip\_range\_pods | The _name_ of the secondary subnet ip range to use for pods | `string` | n/a | yes |
@@ -319,7 +319,7 @@ The node_pools variable takes the following parameters:
319319
| gpu_partition_size | Size of partitions to create on the GPU | null | Optional |
320320
| image_type | The image type to use for this node. Note that changing the image type will delete and recreate all nodes in the node pool | COS_CONTAINERD | Optional |
321321
| initial_node_count | The initial number of nodes for the pool. In regional or multi-zonal clusters, this is the number of nodes per zone. Changing this will force recreation of the resource. Defaults to the value of min_count | " " | Optional |
322-
| insecure_kubelet_readonly_port_enabled | Whether or not to enable the insecure Kubelet readonly port. It's strongly recommended to set this to "FALSE". One of "TRUE", "FALSE". | null | Optional |
322+
| insecure_kubelet_readonly_port_enabled | (boolean) Whether or not to enable the insecure Kubelet readonly port. | null | Optional |
323323
| key | The key required for the taint | | Required |
324324
| logging_variant | 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. | DEFAULT | Optional |
325325
| local_ssd_count | The amount of local SSD disks that will be attached to each cluster node and may be used as a `hostpath` volume or a `local` PersistentVolume. | 0 | Optional |

autogen/main/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ The node_pools variable takes the following parameters:
213213
| gpu_partition_size | Size of partitions to create on the GPU | null | Optional |
214214
| image_type | The image type to use for this node. Note that changing the image type will delete and recreate all nodes in the node pool | COS_CONTAINERD | Optional |
215215
| initial_node_count | The initial number of nodes for the pool. In regional or multi-zonal clusters, this is the number of nodes per zone. Changing this will force recreation of the resource. Defaults to the value of min_count | " " | Optional |
216-
| insecure_kubelet_readonly_port_enabled | Whether or not to enable the insecure Kubelet readonly port. It's strongly recommended to set this to "FALSE". One of "TRUE", "FALSE". | null | Optional |
216+
| insecure_kubelet_readonly_port_enabled | (boolean) Whether or not to enable the insecure Kubelet readonly port. | null | Optional |
217217
| key | The key required for the taint | | Required |
218218
| logging_variant | 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. | DEFAULT | Optional |
219219
| local_ssd_count | The amount of local SSD disks that will be attached to each cluster node and may be used as a `hostpath` volume or a `local` PersistentVolume. | 0 | Optional |

autogen/main/cluster.tf.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ resource "google_container_cluster" "primary" {
678678
enabled = var.enable_gcfs
679679
}
680680
{% endif %}
681-
insecure_kubelet_readonly_port_enabled = var.insecure_kubelet_readonly_port_enabled != "" ? var.insecure_kubelet_readonly_port_enabled : null
681+
insecure_kubelet_readonly_port_enabled = var.insecure_kubelet_readonly_port_enabled != null ? var.insecure_kubelet_readonly_port_enabled : null
682682
{% endif %}
683683
}
684684
}

autogen/main/variables.tf.tmpl

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,9 @@ variable "service_external_ips" {
104104

105105
{% if autopilot_cluster != true %}
106106
variable "insecure_kubelet_readonly_port_enabled" {
107-
type = string
107+
type = bool
108108
description = "Whether or not to set `insecure_kubelet_readonly_port_enabled` for node pool defaults and autopilot clusters. Note: this can be set at the node pool level separately within `node_pools`."
109-
default = ""
110-
111-
validation {
112-
condition = contains(["FALSE", "TRUE", ""], var.insecure_kubelet_readonly_port_enabled)
113-
error_message = "The node_metadata value must be one of \"TRUE\", \"FALSE\", or empty string (\"\")."
114-
}
109+
default = null
115110
}
116111

117112
variable "datapath_provider" {

cluster.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ resource "google_container_cluster" "primary" {
502502

503503
node_pool_defaults {
504504
node_config_defaults {
505-
insecure_kubelet_readonly_port_enabled = var.insecure_kubelet_readonly_port_enabled != "" ? var.insecure_kubelet_readonly_port_enabled : null
505+
insecure_kubelet_readonly_port_enabled = var.insecure_kubelet_readonly_port_enabled != null ? var.insecure_kubelet_readonly_port_enabled : null
506506
}
507507
}
508508

@@ -752,7 +752,7 @@ resource "google_container_node_pool" "pools" {
752752
cpu_manager_policy = lookup(each.value, "cpu_manager_policy", "static")
753753
cpu_cfs_quota = lookup(each.value, "cpu_cfs_quota", null)
754754
cpu_cfs_quota_period = lookup(each.value, "cpu_cfs_quota_period", null)
755-
insecure_kubelet_readonly_port_enabled = lookup(each.value, "insecure_kubelet_readonly_port_enabled", var.insecure_kubelet_readonly_port_enabled != "" ? var.insecure_kubelet_readonly_port_enabled : null)
755+
insecure_kubelet_readonly_port_enabled = lookup(each.value, "insecure_kubelet_readonly_port_enabled", var.insecure_kubelet_readonly_port_enabled != null ? var.insecure_kubelet_readonly_port_enabled : null)
756756
pod_pids_limit = lookup(each.value, "pod_pids_limit", null)
757757
}
758758
}
@@ -1035,7 +1035,7 @@ resource "google_container_node_pool" "windows_pools" {
10351035
cpu_manager_policy = lookup(each.value, "cpu_manager_policy", "static")
10361036
cpu_cfs_quota = lookup(each.value, "cpu_cfs_quota", null)
10371037
cpu_cfs_quota_period = lookup(each.value, "cpu_cfs_quota_period", null)
1038-
insecure_kubelet_readonly_port_enabled = lookup(each.value, "insecure_kubelet_readonly_port_enabled", var.insecure_kubelet_readonly_port_enabled != "" ? var.insecure_kubelet_readonly_port_enabled : null)
1038+
insecure_kubelet_readonly_port_enabled = lookup(each.value, "insecure_kubelet_readonly_port_enabled", var.insecure_kubelet_readonly_port_enabled != null ? var.insecure_kubelet_readonly_port_enabled : null)
10391039
pod_pids_limit = lookup(each.value, "pod_pids_limit", null)
10401040
}
10411041
}

modules/beta-private-cluster-update-variant/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ Then perform the following commands on the root folder:
232232
| http\_load\_balancing | Enable httpload balancer addon | `bool` | `true` | no |
233233
| identity\_namespace | The workload pool to attach all Kubernetes service accounts to. (Default value of `enabled` automatically sets project-based pool `[project_id].svc.id.goog`) | `string` | `"enabled"` | no |
234234
| initial\_node\_count | The number of nodes to create in this cluster's default node pool. | `number` | `0` | no |
235-
| insecure\_kubelet\_readonly\_port\_enabled | Whether or not to set `insecure_kubelet_readonly_port_enabled` for node pool defaults and autopilot clusters. Note: this can be set at the node pool level separately within `node_pools`. | `string` | `""` | no |
235+
| insecure\_kubelet\_readonly\_port\_enabled | Whether or not to set `insecure_kubelet_readonly_port_enabled` for node pool defaults and autopilot clusters. Note: this can be set at the node pool level separately within `node_pools`. | `bool` | `null` | no |
236236
| ip\_masq\_link\_local | Whether to masquerade traffic to the link-local prefix (169.254.0.0/16). | `bool` | `false` | no |
237237
| ip\_masq\_resync\_interval | The interval at which the agent attempts to sync its ConfigMap file from the disk. | `string` | `"60s"` | no |
238238
| ip\_range\_pods | The _name_ of the secondary subnet ip range to use for pods | `string` | n/a | yes |
@@ -377,7 +377,7 @@ The node_pools variable takes the following parameters:
377377
| gpu_partition_size | Size of partitions to create on the GPU | null | Optional |
378378
| image_type | The image type to use for this node. Note that changing the image type will delete and recreate all nodes in the node pool | COS_CONTAINERD | Optional |
379379
| initial_node_count | The initial number of nodes for the pool. In regional or multi-zonal clusters, this is the number of nodes per zone. Changing this will force recreation of the resource. Defaults to the value of min_count | " " | Optional |
380-
| insecure_kubelet_readonly_port_enabled | Whether or not to enable the insecure Kubelet readonly port. It's strongly recommended to set this to "FALSE". One of "TRUE", "FALSE". | null | Optional |
380+
| insecure_kubelet_readonly_port_enabled | (boolean) Whether or not to enable the insecure Kubelet readonly port. | null | Optional |
381381
| key | The key required for the taint | | Required |
382382
| logging_variant | 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. | DEFAULT | Optional |
383383
| local_ssd_count | The amount of local SSD disks that will be attached to each cluster node and may be used as a `hostpath` volume or a `local` PersistentVolume. | 0 | Optional |

modules/beta-private-cluster-update-variant/cluster.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ resource "google_container_cluster" "primary" {
580580
gcfs_config {
581581
enabled = var.enable_gcfs
582582
}
583-
insecure_kubelet_readonly_port_enabled = var.insecure_kubelet_readonly_port_enabled != "" ? var.insecure_kubelet_readonly_port_enabled : null
583+
insecure_kubelet_readonly_port_enabled = var.insecure_kubelet_readonly_port_enabled != null ? var.insecure_kubelet_readonly_port_enabled : null
584584
}
585585
}
586586

@@ -919,7 +919,7 @@ resource "google_container_node_pool" "pools" {
919919
cpu_manager_policy = lookup(each.value, "cpu_manager_policy", "static")
920920
cpu_cfs_quota = lookup(each.value, "cpu_cfs_quota", null)
921921
cpu_cfs_quota_period = lookup(each.value, "cpu_cfs_quota_period", null)
922-
insecure_kubelet_readonly_port_enabled = lookup(each.value, "insecure_kubelet_readonly_port_enabled", var.insecure_kubelet_readonly_port_enabled != "" ? var.insecure_kubelet_readonly_port_enabled : null)
922+
insecure_kubelet_readonly_port_enabled = lookup(each.value, "insecure_kubelet_readonly_port_enabled", var.insecure_kubelet_readonly_port_enabled != null ? var.insecure_kubelet_readonly_port_enabled : null)
923923
pod_pids_limit = lookup(each.value, "pod_pids_limit", null)
924924
}
925925
}
@@ -1216,7 +1216,7 @@ resource "google_container_node_pool" "windows_pools" {
12161216
cpu_manager_policy = lookup(each.value, "cpu_manager_policy", "static")
12171217
cpu_cfs_quota = lookup(each.value, "cpu_cfs_quota", null)
12181218
cpu_cfs_quota_period = lookup(each.value, "cpu_cfs_quota_period", null)
1219-
insecure_kubelet_readonly_port_enabled = lookup(each.value, "insecure_kubelet_readonly_port_enabled", var.insecure_kubelet_readonly_port_enabled != "" ? var.insecure_kubelet_readonly_port_enabled : null)
1219+
insecure_kubelet_readonly_port_enabled = lookup(each.value, "insecure_kubelet_readonly_port_enabled", var.insecure_kubelet_readonly_port_enabled != null ? var.insecure_kubelet_readonly_port_enabled : null)
12201220
pod_pids_limit = lookup(each.value, "pod_pids_limit", null)
12211221
}
12221222
}

modules/beta-private-cluster-update-variant/variables.tf

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,9 @@ variable "service_external_ips" {
103103
}
104104

105105
variable "insecure_kubelet_readonly_port_enabled" {
106-
type = string
106+
type = bool
107107
description = "Whether or not to set `insecure_kubelet_readonly_port_enabled` for node pool defaults and autopilot clusters. Note: this can be set at the node pool level separately within `node_pools`."
108-
default = ""
109-
110-
validation {
111-
condition = contains(["FALSE", "TRUE", ""], var.insecure_kubelet_readonly_port_enabled)
112-
error_message = "The node_metadata value must be one of \"TRUE\", \"FALSE\", or empty string (\"\")."
113-
}
108+
default = null
114109
}
115110

116111
variable "datapath_provider" {

modules/beta-private-cluster/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ Then perform the following commands on the root folder:
210210
| http\_load\_balancing | Enable httpload balancer addon | `bool` | `true` | no |
211211
| identity\_namespace | The workload pool to attach all Kubernetes service accounts to. (Default value of `enabled` automatically sets project-based pool `[project_id].svc.id.goog`) | `string` | `"enabled"` | no |
212212
| initial\_node\_count | The number of nodes to create in this cluster's default node pool. | `number` | `0` | no |
213-
| insecure\_kubelet\_readonly\_port\_enabled | Whether or not to set `insecure_kubelet_readonly_port_enabled` for node pool defaults and autopilot clusters. Note: this can be set at the node pool level separately within `node_pools`. | `string` | `""` | no |
213+
| insecure\_kubelet\_readonly\_port\_enabled | Whether or not to set `insecure_kubelet_readonly_port_enabled` for node pool defaults and autopilot clusters. Note: this can be set at the node pool level separately within `node_pools`. | `bool` | `null` | no |
214214
| ip\_masq\_link\_local | Whether to masquerade traffic to the link-local prefix (169.254.0.0/16). | `bool` | `false` | no |
215215
| ip\_masq\_resync\_interval | The interval at which the agent attempts to sync its ConfigMap file from the disk. | `string` | `"60s"` | no |
216216
| ip\_range\_pods | The _name_ of the secondary subnet ip range to use for pods | `string` | n/a | yes |
@@ -355,7 +355,7 @@ The node_pools variable takes the following parameters:
355355
| gpu_partition_size | Size of partitions to create on the GPU | null | Optional |
356356
| image_type | The image type to use for this node. Note that changing the image type will delete and recreate all nodes in the node pool | COS_CONTAINERD | Optional |
357357
| initial_node_count | The initial number of nodes for the pool. In regional or multi-zonal clusters, this is the number of nodes per zone. Changing this will force recreation of the resource. Defaults to the value of min_count | " " | Optional |
358-
| insecure_kubelet_readonly_port_enabled | Whether or not to enable the insecure Kubelet readonly port. It's strongly recommended to set this to "FALSE". One of "TRUE", "FALSE". | null | Optional |
358+
| insecure_kubelet_readonly_port_enabled | (boolean) Whether or not to enable the insecure Kubelet readonly port. | null | Optional |
359359
| key | The key required for the taint | | Required |
360360
| logging_variant | 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. | DEFAULT | Optional |
361361
| local_ssd_count | The amount of local SSD disks that will be attached to each cluster node and may be used as a `hostpath` volume or a `local` PersistentVolume. | 0 | Optional |

modules/beta-private-cluster/cluster.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ resource "google_container_cluster" "primary" {
580580
gcfs_config {
581581
enabled = var.enable_gcfs
582582
}
583-
insecure_kubelet_readonly_port_enabled = var.insecure_kubelet_readonly_port_enabled != "" ? var.insecure_kubelet_readonly_port_enabled : null
583+
insecure_kubelet_readonly_port_enabled = var.insecure_kubelet_readonly_port_enabled != null ? var.insecure_kubelet_readonly_port_enabled : null
584584
}
585585
}
586586

@@ -837,7 +837,7 @@ resource "google_container_node_pool" "pools" {
837837
cpu_manager_policy = lookup(each.value, "cpu_manager_policy", "static")
838838
cpu_cfs_quota = lookup(each.value, "cpu_cfs_quota", null)
839839
cpu_cfs_quota_period = lookup(each.value, "cpu_cfs_quota_period", null)
840-
insecure_kubelet_readonly_port_enabled = lookup(each.value, "insecure_kubelet_readonly_port_enabled", var.insecure_kubelet_readonly_port_enabled != "" ? var.insecure_kubelet_readonly_port_enabled : null)
840+
insecure_kubelet_readonly_port_enabled = lookup(each.value, "insecure_kubelet_readonly_port_enabled", var.insecure_kubelet_readonly_port_enabled != null ? var.insecure_kubelet_readonly_port_enabled : null)
841841
pod_pids_limit = lookup(each.value, "pod_pids_limit", null)
842842
}
843843
}
@@ -1133,7 +1133,7 @@ resource "google_container_node_pool" "windows_pools" {
11331133
cpu_manager_policy = lookup(each.value, "cpu_manager_policy", "static")
11341134
cpu_cfs_quota = lookup(each.value, "cpu_cfs_quota", null)
11351135
cpu_cfs_quota_period = lookup(each.value, "cpu_cfs_quota_period", null)
1136-
insecure_kubelet_readonly_port_enabled = lookup(each.value, "insecure_kubelet_readonly_port_enabled", var.insecure_kubelet_readonly_port_enabled != "" ? var.insecure_kubelet_readonly_port_enabled : null)
1136+
insecure_kubelet_readonly_port_enabled = lookup(each.value, "insecure_kubelet_readonly_port_enabled", var.insecure_kubelet_readonly_port_enabled != null ? var.insecure_kubelet_readonly_port_enabled : null)
11371137
pod_pids_limit = lookup(each.value, "pod_pids_limit", null)
11381138
}
11391139
}

0 commit comments

Comments
 (0)