Skip to content

Commit 114b68e

Browse files
committed
switch to optional bool for module implementation
1 parent 086d138 commit 114b68e

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
@@ -190,7 +190,7 @@ Then perform the following commands on the root folder:
190190
| http\_load\_balancing | Enable httpload balancer addon | `bool` | `true` | no |
191191
| 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 |
192192
| initial\_node\_count | The number of nodes to create in this cluster's default node pool. | `number` | `0` | no |
193-
| 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 |
193+
| 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 |
194194
| ip\_masq\_link\_local | Whether to masquerade traffic to the link-local prefix (169.254.0.0/16). | `bool` | `false` | no |
195195
| ip\_masq\_resync\_interval | The interval at which the agent attempts to sync its ConfigMap file from the disk. | `string` | `"60s"` | no |
196196
| ip\_range\_pods | The _name_ of the secondary subnet ip range to use for pods | `string` | n/a | yes |
@@ -320,7 +320,7 @@ The node_pools variable takes the following parameters:
320320
| gpu_partition_size | Size of partitions to create on the GPU | null | Optional |
321321
| 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 |
322322
| 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 |
323-
| 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 |
323+
| insecure_kubelet_readonly_port_enabled | (boolean) Whether or not to enable the insecure Kubelet readonly port. | null | Optional |
324324
| key | The key required for the taint | | Required |
325325
| 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 |
326326
| 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
@@ -679,7 +679,7 @@ resource "google_container_cluster" "primary" {
679679
enabled = var.enable_gcfs
680680
}
681681
{% endif %}
682-
insecure_kubelet_readonly_port_enabled = var.insecure_kubelet_readonly_port_enabled != "" ? var.insecure_kubelet_readonly_port_enabled : null
682+
insecure_kubelet_readonly_port_enabled = var.insecure_kubelet_readonly_port_enabled != null ? var.insecure_kubelet_readonly_port_enabled : null
683683
{% endif %}
684684
}
685685
}

autogen/main/variables.tf.tmpl

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

111111
{% if autopilot_cluster != true %}
112112
variable "insecure_kubelet_readonly_port_enabled" {
113-
type = string
113+
type = bool
114114
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`."
115-
default = ""
116-
117-
validation {
118-
condition = contains(["FALSE", "TRUE", ""], var.insecure_kubelet_readonly_port_enabled)
119-
error_message = "The node_metadata value must be one of \"TRUE\", \"FALSE\", or empty string (\"\")."
120-
}
115+
default = null
121116
}
122117

123118
variable "datapath_provider" {

cluster.tf

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

504504
node_pool_defaults {
505505
node_config_defaults {
506-
insecure_kubelet_readonly_port_enabled = var.insecure_kubelet_readonly_port_enabled != "" ? var.insecure_kubelet_readonly_port_enabled : null
506+
insecure_kubelet_readonly_port_enabled = var.insecure_kubelet_readonly_port_enabled != null ? var.insecure_kubelet_readonly_port_enabled : null
507507
}
508508
}
509509

@@ -753,7 +753,7 @@ resource "google_container_node_pool" "pools" {
753753
cpu_manager_policy = lookup(each.value, "cpu_manager_policy", "static")
754754
cpu_cfs_quota = lookup(each.value, "cpu_cfs_quota", null)
755755
cpu_cfs_quota_period = lookup(each.value, "cpu_cfs_quota_period", null)
756-
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)
756+
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)
757757
pod_pids_limit = lookup(each.value, "pod_pids_limit", null)
758758
}
759759
}
@@ -1044,7 +1044,7 @@ resource "google_container_node_pool" "windows_pools" {
10441044
cpu_manager_policy = lookup(each.value, "cpu_manager_policy", "static")
10451045
cpu_cfs_quota = lookup(each.value, "cpu_cfs_quota", null)
10461046
cpu_cfs_quota_period = lookup(each.value, "cpu_cfs_quota_period", null)
1047-
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)
1047+
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)
10481048
pod_pids_limit = lookup(each.value, "pod_pids_limit", null)
10491049
}
10501050
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ Then perform the following commands on the root folder:
233233
| http\_load\_balancing | Enable httpload balancer addon | `bool` | `true` | no |
234234
| 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 |
235235
| initial\_node\_count | The number of nodes to create in this cluster's default node pool. | `number` | `0` | no |
236-
| 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 |
236+
| 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 |
237237
| ip\_masq\_link\_local | Whether to masquerade traffic to the link-local prefix (169.254.0.0/16). | `bool` | `false` | no |
238238
| ip\_masq\_resync\_interval | The interval at which the agent attempts to sync its ConfigMap file from the disk. | `string` | `"60s"` | no |
239239
| ip\_range\_pods | The _name_ of the secondary subnet ip range to use for pods | `string` | n/a | yes |
@@ -378,7 +378,7 @@ The node_pools variable takes the following parameters:
378378
| gpu_partition_size | Size of partitions to create on the GPU | null | Optional |
379379
| 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 |
380380
| 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 |
381-
| 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 |
381+
| insecure_kubelet_readonly_port_enabled | (boolean) Whether or not to enable the insecure Kubelet readonly port. | null | Optional |
382382
| key | The key required for the taint | | Required |
383383
| 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 |
384384
| 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
@@ -581,7 +581,7 @@ resource "google_container_cluster" "primary" {
581581
gcfs_config {
582582
enabled = var.enable_gcfs
583583
}
584-
insecure_kubelet_readonly_port_enabled = var.insecure_kubelet_readonly_port_enabled != "" ? var.insecure_kubelet_readonly_port_enabled : null
584+
insecure_kubelet_readonly_port_enabled = var.insecure_kubelet_readonly_port_enabled != null ? var.insecure_kubelet_readonly_port_enabled : null
585585
}
586586
}
587587

@@ -921,7 +921,7 @@ resource "google_container_node_pool" "pools" {
921921
cpu_manager_policy = lookup(each.value, "cpu_manager_policy", "static")
922922
cpu_cfs_quota = lookup(each.value, "cpu_cfs_quota", null)
923923
cpu_cfs_quota_period = lookup(each.value, "cpu_cfs_quota_period", null)
924-
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)
924+
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)
925925
pod_pids_limit = lookup(each.value, "pod_pids_limit", null)
926926
}
927927
}
@@ -1226,7 +1226,7 @@ resource "google_container_node_pool" "windows_pools" {
12261226
cpu_manager_policy = lookup(each.value, "cpu_manager_policy", "static")
12271227
cpu_cfs_quota = lookup(each.value, "cpu_cfs_quota", null)
12281228
cpu_cfs_quota_period = lookup(each.value, "cpu_cfs_quota_period", null)
1229-
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)
1229+
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)
12301230
pod_pids_limit = lookup(each.value, "pod_pids_limit", null)
12311231
}
12321232
}

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

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

111111
variable "insecure_kubelet_readonly_port_enabled" {
112-
type = string
112+
type = bool
113113
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`."
114-
default = ""
115-
116-
validation {
117-
condition = contains(["FALSE", "TRUE", ""], var.insecure_kubelet_readonly_port_enabled)
118-
error_message = "The node_metadata value must be one of \"TRUE\", \"FALSE\", or empty string (\"\")."
119-
}
114+
default = null
120115
}
121116

122117
variable "datapath_provider" {

modules/beta-private-cluster/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ Then perform the following commands on the root folder:
211211
| http\_load\_balancing | Enable httpload balancer addon | `bool` | `true` | no |
212212
| 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 |
213213
| initial\_node\_count | The number of nodes to create in this cluster's default node pool. | `number` | `0` | no |
214-
| 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 |
214+
| 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 |
215215
| ip\_masq\_link\_local | Whether to masquerade traffic to the link-local prefix (169.254.0.0/16). | `bool` | `false` | no |
216216
| ip\_masq\_resync\_interval | The interval at which the agent attempts to sync its ConfigMap file from the disk. | `string` | `"60s"` | no |
217217
| ip\_range\_pods | The _name_ of the secondary subnet ip range to use for pods | `string` | n/a | yes |
@@ -356,7 +356,7 @@ The node_pools variable takes the following parameters:
356356
| gpu_partition_size | Size of partitions to create on the GPU | null | Optional |
357357
| 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 |
358358
| 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 |
359-
| 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 |
359+
| insecure_kubelet_readonly_port_enabled | (boolean) Whether or not to enable the insecure Kubelet readonly port. | null | Optional |
360360
| key | The key required for the taint | | Required |
361361
| 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 |
362362
| 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
@@ -581,7 +581,7 @@ resource "google_container_cluster" "primary" {
581581
gcfs_config {
582582
enabled = var.enable_gcfs
583583
}
584-
insecure_kubelet_readonly_port_enabled = var.insecure_kubelet_readonly_port_enabled != "" ? var.insecure_kubelet_readonly_port_enabled : null
584+
insecure_kubelet_readonly_port_enabled = var.insecure_kubelet_readonly_port_enabled != null ? var.insecure_kubelet_readonly_port_enabled : null
585585
}
586586
}
587587

@@ -838,7 +838,7 @@ resource "google_container_node_pool" "pools" {
838838
cpu_manager_policy = lookup(each.value, "cpu_manager_policy", "static")
839839
cpu_cfs_quota = lookup(each.value, "cpu_cfs_quota", null)
840840
cpu_cfs_quota_period = lookup(each.value, "cpu_cfs_quota_period", null)
841-
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)
841+
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)
842842
pod_pids_limit = lookup(each.value, "pod_pids_limit", null)
843843
}
844844
}
@@ -1142,7 +1142,7 @@ resource "google_container_node_pool" "windows_pools" {
11421142
cpu_manager_policy = lookup(each.value, "cpu_manager_policy", "static")
11431143
cpu_cfs_quota = lookup(each.value, "cpu_cfs_quota", null)
11441144
cpu_cfs_quota_period = lookup(each.value, "cpu_cfs_quota_period", null)
1145-
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)
1145+
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)
11461146
pod_pids_limit = lookup(each.value, "pod_pids_limit", null)
11471147
}
11481148
}

modules/beta-private-cluster/variables.tf

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

111111
variable "insecure_kubelet_readonly_port_enabled" {
112-
type = string
112+
type = bool
113113
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`."
114-
default = ""
115-
116-
validation {
117-
condition = contains(["FALSE", "TRUE", ""], var.insecure_kubelet_readonly_port_enabled)
118-
error_message = "The node_metadata value must be one of \"TRUE\", \"FALSE\", or empty string (\"\")."
119-
}
114+
default = null
120115
}
121116

122117
variable "datapath_provider" {

0 commit comments

Comments
 (0)