Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
aminelaabi authored May 17, 2024
2 parents 62081f8 + 11bae67 commit dda7ebe
Show file tree
Hide file tree
Showing 38 changed files with 212 additions and 43 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ module "gke" {
network_policy = false
horizontal_pod_autoscaling = true
filestore_csi_driver = false
dns_cache = false
node_pools = [
{
Expand Down Expand Up @@ -243,6 +244,7 @@ Then perform the following commands on the root folder:
|------|-------------|
| ca\_certificate | Cluster ca certificate (base64 encoded) |
| cluster\_id | Cluster ID |
| dns\_cache\_enabled | Whether DNS Cache enabled |
| endpoint | Cluster endpoint |
| fleet\_membership | Fleet membership (if registered) |
| gateway\_api\_channel | The gateway api channel of this cluster. |
Expand Down Expand Up @@ -324,6 +326,7 @@ The node_pools variable takes the following parameters:
| value | The value for the taint | | Required |
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
| location_policy | [Location policy](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_node_pool#location_policy) specifies the algorithm used when scaling-up the node pool. Location policy is supported only in 1.24.1+ clusters. | " " | Optional |
| secondary_boot_disk | Image of a secondary boot disk to preload container images and data on new nodes. For detail see [documentation](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster#nested_secondary_boot_disks). `gcfs_config` must be `enabled=true` for this feature to work. | | Optional |

## windows_node_pools variable
The windows_node_pools variable takes the same parameters as [node_pools](#node\_pools-variable) but is reserved for provisioning Windows based node pools only. This variable is introduced to satisfy a [specific requirement](https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster-windows#create_a_cluster_and_node_pools) for the presence of at least one linux based node pool in the cluster before a windows based node pool can be created.
Expand Down
3 changes: 2 additions & 1 deletion autogen/main/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ module "gke" {
{% if beta_cluster and autopilot_cluster != true %}
istio = true
cloudrun = true
dns_cache = false
{% endif %}
dns_cache = false
{% if autopilot_cluster != true %}
node_pools = [
Expand Down Expand Up @@ -250,6 +250,7 @@ The node_pools variable takes the following parameters:
| value | The value for the taint | | Required |
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
| location_policy | [Location policy](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_node_pool#location_policy) specifies the algorithm used when scaling-up the node pool. Location policy is supported only in 1.24.1+ clusters. | " " | Optional |
| secondary_boot_disk | Image of a secondary boot disk to preload container images and data on new nodes. For detail see [documentation](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster#nested_secondary_boot_disks). `gcfs_config` must be `enabled=true` for this feature to work. | | Optional |

## windows_node_pools variable
The windows_node_pools variable takes the same parameters as [node_pools](#node\_pools-variable) but is reserved for provisioning Windows based node pools only. This variable is introduced to satisfy a [specific requirement](https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster-windows#create_a_cluster_and_node_pools) for the presence of at least one linux based node pool in the cluster before a windows based node pool can be created.
Expand Down
9 changes: 9 additions & 0 deletions autogen/main/cluster.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,15 @@ resource "google_container_node_pool" "windows_pools" {
}
}

# Supports a single secondary boot disk because `map(any)` must have the same values type.
dynamic "secondary_boot_disks" {
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
content {
disk_image = secondary_boot_disks.value
mode = "CONTAINER_IMAGE_CACHE"
}
}

service_account = lookup(
each.value,
"service_account",
Expand Down
2 changes: 1 addition & 1 deletion autogen/main/main.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ locals {
{% if beta_cluster %}
# BETA features
cluster_istio_enabled = ! local.cluster_output_istio_disabled
cluster_dns_cache_enabled = var.dns_cache
{% if autopilot_cluster != true %}
cluster_telemetry_type_is_set = var.cluster_telemetry_type != null
{% endif %}
Expand All @@ -242,6 +241,7 @@ locals {
# /BETA features
{% endif %}

cluster_dns_cache_enabled = var.dns_cache
cluster_maintenance_window_is_recurring = var.maintenance_recurrence != "" && var.maintenance_end_time != "" ? [1] : []
cluster_maintenance_window_is_daily = length(local.cluster_maintenance_window_is_recurring) > 0 ? [] : [1]
}
Expand Down
10 changes: 5 additions & 5 deletions autogen/main/outputs.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ output "peering_name" {
value = local.cluster_peering_name
}
{% endif %}

output "dns_cache_enabled" {
description = "Whether DNS Cache enabled"
value = local.cluster_dns_cache_enabled
}
{% if beta_cluster %}

output "cloudrun_enabled" {
Expand All @@ -214,11 +219,6 @@ output "istio_enabled" {
value = local.cluster_istio_enabled
}

output "dns_cache_enabled" {
description = "Whether DNS Cache enabled"
value = local.cluster_dns_cache_enabled
}

output "pod_security_policy_enabled" {
description = "Whether pod security policy is enabled"
value = local.cluster_pod_security_policy_enabled
Expand Down
18 changes: 18 additions & 0 deletions cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,15 @@ resource "google_container_node_pool" "pools" {
}
}

# Supports a single secondary boot disk because `map(any)` must have the same values type.
dynamic "secondary_boot_disks" {
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
content {
disk_image = secondary_boot_disks.value
mode = "CONTAINER_IMAGE_CACHE"
}
}

service_account = lookup(
each.value,
"service_account",
Expand Down Expand Up @@ -801,6 +810,15 @@ resource "google_container_node_pool" "windows_pools" {
}
}

# Supports a single secondary boot disk because `map(any)` must have the same values type.
dynamic "secondary_boot_disks" {
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
content {
disk_image = secondary_boot_disks.value
mode = "CONTAINER_IMAGE_CACHE"
}
}

service_account = lookup(
each.value,
"service_account",
Expand Down
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ locals {
}] : []


cluster_dns_cache_enabled = var.dns_cache
cluster_maintenance_window_is_recurring = var.maintenance_recurrence != "" && var.maintenance_end_time != "" ? [1] : []
cluster_maintenance_window_is_daily = length(local.cluster_maintenance_window_is_recurring) > 0 ? [] : [1]
}
Expand Down
1 change: 1 addition & 0 deletions modules/beta-autopilot-private-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ module "gke" {
enable_private_endpoint = true
enable_private_nodes = true
master_ipv4_cidr_block = "10.0.0.0/28"
dns_cache = false
}
```
Expand Down
2 changes: 1 addition & 1 deletion modules/beta-autopilot-private-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@ locals {

# BETA features
cluster_istio_enabled = !local.cluster_output_istio_disabled
cluster_dns_cache_enabled = var.dns_cache
cluster_pod_security_policy_enabled = local.cluster_output_pod_security_policy_enabled
cluster_intranode_visibility_enabled = local.cluster_output_intranode_visbility_enabled

# /BETA features

cluster_dns_cache_enabled = var.dns_cache
cluster_maintenance_window_is_recurring = var.maintenance_recurrence != "" && var.maintenance_end_time != "" ? [1] : []
cluster_maintenance_window_is_daily = length(local.cluster_maintenance_window_is_recurring) > 0 ? [] : [1]
}
Expand Down
10 changes: 5 additions & 5 deletions modules/beta-autopilot-private-cluster/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ output "peering_name" {
value = local.cluster_peering_name
}

output "dns_cache_enabled" {
description = "Whether DNS Cache enabled"
value = local.cluster_dns_cache_enabled
}

output "cloudrun_enabled" {
description = "Whether CloudRun enabled"
value = false
Expand All @@ -169,11 +174,6 @@ output "istio_enabled" {
value = local.cluster_istio_enabled
}

output "dns_cache_enabled" {
description = "Whether DNS Cache enabled"
value = local.cluster_dns_cache_enabled
}

output "pod_security_policy_enabled" {
description = "Whether pod security policy is enabled"
value = local.cluster_pod_security_policy_enabled
Expand Down
1 change: 1 addition & 0 deletions modules/beta-autopilot-public-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ module "gke" {
ip_range_services = "us-central1-01-gke-01-services"
horizontal_pod_autoscaling = true
filestore_csi_driver = false
dns_cache = false
}
```
Expand Down
2 changes: 1 addition & 1 deletion modules/beta-autopilot-public-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ locals {

# BETA features
cluster_istio_enabled = !local.cluster_output_istio_disabled
cluster_dns_cache_enabled = var.dns_cache
cluster_pod_security_policy_enabled = local.cluster_output_pod_security_policy_enabled
cluster_intranode_visibility_enabled = local.cluster_output_intranode_visbility_enabled

# /BETA features

cluster_dns_cache_enabled = var.dns_cache
cluster_maintenance_window_is_recurring = var.maintenance_recurrence != "" && var.maintenance_end_time != "" ? [1] : []
cluster_maintenance_window_is_daily = length(local.cluster_maintenance_window_is_recurring) > 0 ? [] : [1]
}
Expand Down
10 changes: 5 additions & 5 deletions modules/beta-autopilot-public-cluster/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ output "tpu_ipv4_cidr_block" {



output "dns_cache_enabled" {
description = "Whether DNS Cache enabled"
value = local.cluster_dns_cache_enabled
}

output "cloudrun_enabled" {
description = "Whether CloudRun enabled"
value = false
Expand All @@ -159,11 +164,6 @@ output "istio_enabled" {
value = local.cluster_istio_enabled
}

output "dns_cache_enabled" {
description = "Whether DNS Cache enabled"
value = local.cluster_dns_cache_enabled
}

output "pod_security_policy_enabled" {
description = "Whether pod security policy is enabled"
value = local.cluster_pod_security_policy_enabled
Expand Down
1 change: 1 addition & 0 deletions modules/beta-private-cluster-update-variant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ The node_pools variable takes the following parameters:
| value | The value for the taint | | Required |
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
| location_policy | [Location policy](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_node_pool#location_policy) specifies the algorithm used when scaling-up the node pool. Location policy is supported only in 1.24.1+ clusters. | " " | Optional |
| secondary_boot_disk | Image of a secondary boot disk to preload container images and data on new nodes. For detail see [documentation](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster#nested_secondary_boot_disks). `gcfs_config` must be `enabled=true` for this feature to work. | | Optional |

## windows_node_pools variable
The windows_node_pools variable takes the same parameters as [node_pools](#node\_pools-variable) but is reserved for provisioning Windows based node pools only. This variable is introduced to satisfy a [specific requirement](https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster-windows#create_a_cluster_and_node_pools) for the presence of at least one linux based node pool in the cluster before a windows based node pool can be created.
Expand Down
18 changes: 18 additions & 0 deletions modules/beta-private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,15 @@ resource "google_container_node_pool" "pools" {
}
}

# Supports a single secondary boot disk because `map(any)` must have the same values type.
dynamic "secondary_boot_disks" {
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
content {
disk_image = secondary_boot_disks.value
mode = "CONTAINER_IMAGE_CACHE"
}
}

service_account = lookup(
each.value,
"service_account",
Expand Down Expand Up @@ -993,6 +1002,15 @@ resource "google_container_node_pool" "windows_pools" {
}
}

# Supports a single secondary boot disk because `map(any)` must have the same values type.
dynamic "secondary_boot_disks" {
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
content {
disk_image = secondary_boot_disks.value
mode = "CONTAINER_IMAGE_CACHE"
}
}

service_account = lookup(
each.value,
"service_account",
Expand Down
2 changes: 1 addition & 1 deletion modules/beta-private-cluster-update-variant/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,13 @@ locals {

# BETA features
cluster_istio_enabled = !local.cluster_output_istio_disabled
cluster_dns_cache_enabled = var.dns_cache
cluster_telemetry_type_is_set = var.cluster_telemetry_type != null
cluster_pod_security_policy_enabled = local.cluster_output_pod_security_policy_enabled
cluster_intranode_visibility_enabled = local.cluster_output_intranode_visbility_enabled

# /BETA features

cluster_dns_cache_enabled = var.dns_cache
cluster_maintenance_window_is_recurring = var.maintenance_recurrence != "" && var.maintenance_end_time != "" ? [1] : []
cluster_maintenance_window_is_daily = length(local.cluster_maintenance_window_is_recurring) > 0 ? [] : [1]
}
Expand Down
10 changes: 5 additions & 5 deletions modules/beta-private-cluster-update-variant/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ output "peering_name" {
value = local.cluster_peering_name
}

output "dns_cache_enabled" {
description = "Whether DNS Cache enabled"
value = local.cluster_dns_cache_enabled
}

output "cloudrun_enabled" {
description = "Whether CloudRun enabled"
value = local.cluster_cloudrun_enabled
Expand All @@ -195,11 +200,6 @@ output "istio_enabled" {
value = local.cluster_istio_enabled
}

output "dns_cache_enabled" {
description = "Whether DNS Cache enabled"
value = local.cluster_dns_cache_enabled
}

output "pod_security_policy_enabled" {
description = "Whether pod security policy is enabled"
value = local.cluster_pod_security_policy_enabled
Expand Down
1 change: 1 addition & 0 deletions modules/beta-private-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ The node_pools variable takes the following parameters:
| value | The value for the taint | | Required |
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
| location_policy | [Location policy](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_node_pool#location_policy) specifies the algorithm used when scaling-up the node pool. Location policy is supported only in 1.24.1+ clusters. | " " | Optional |
| secondary_boot_disk | Image of a secondary boot disk to preload container images and data on new nodes. For detail see [documentation](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster#nested_secondary_boot_disks). `gcfs_config` must be `enabled=true` for this feature to work. | | Optional |

## windows_node_pools variable
The windows_node_pools variable takes the same parameters as [node_pools](#node\_pools-variable) but is reserved for provisioning Windows based node pools only. This variable is introduced to satisfy a [specific requirement](https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster-windows#create_a_cluster_and_node_pools) for the presence of at least one linux based node pool in the cluster before a windows based node pool can be created.
Expand Down
18 changes: 18 additions & 0 deletions modules/beta-private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,15 @@ resource "google_container_node_pool" "pools" {
}
}

# Supports a single secondary boot disk because `map(any)` must have the same values type.
dynamic "secondary_boot_disks" {
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
content {
disk_image = secondary_boot_disks.value
mode = "CONTAINER_IMAGE_CACHE"
}
}

service_account = lookup(
each.value,
"service_account",
Expand Down Expand Up @@ -917,6 +926,15 @@ resource "google_container_node_pool" "windows_pools" {
}
}

# Supports a single secondary boot disk because `map(any)` must have the same values type.
dynamic "secondary_boot_disks" {
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
content {
disk_image = secondary_boot_disks.value
mode = "CONTAINER_IMAGE_CACHE"
}
}

service_account = lookup(
each.value,
"service_account",
Expand Down
2 changes: 1 addition & 1 deletion modules/beta-private-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,13 @@ locals {

# BETA features
cluster_istio_enabled = !local.cluster_output_istio_disabled
cluster_dns_cache_enabled = var.dns_cache
cluster_telemetry_type_is_set = var.cluster_telemetry_type != null
cluster_pod_security_policy_enabled = local.cluster_output_pod_security_policy_enabled
cluster_intranode_visibility_enabled = local.cluster_output_intranode_visbility_enabled

# /BETA features

cluster_dns_cache_enabled = var.dns_cache
cluster_maintenance_window_is_recurring = var.maintenance_recurrence != "" && var.maintenance_end_time != "" ? [1] : []
cluster_maintenance_window_is_daily = length(local.cluster_maintenance_window_is_recurring) > 0 ? [] : [1]
}
Expand Down
10 changes: 5 additions & 5 deletions modules/beta-private-cluster/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ output "peering_name" {
value = local.cluster_peering_name
}

output "dns_cache_enabled" {
description = "Whether DNS Cache enabled"
value = local.cluster_dns_cache_enabled
}

output "cloudrun_enabled" {
description = "Whether CloudRun enabled"
value = local.cluster_cloudrun_enabled
Expand All @@ -195,11 +200,6 @@ output "istio_enabled" {
value = local.cluster_istio_enabled
}

output "dns_cache_enabled" {
description = "Whether DNS Cache enabled"
value = local.cluster_dns_cache_enabled
}

output "pod_security_policy_enabled" {
description = "Whether pod security policy is enabled"
value = local.cluster_pod_security_policy_enabled
Expand Down
1 change: 1 addition & 0 deletions modules/beta-public-cluster-update-variant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ The node_pools variable takes the following parameters:
| value | The value for the taint | | Required |
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
| location_policy | [Location policy](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_node_pool#location_policy) specifies the algorithm used when scaling-up the node pool. Location policy is supported only in 1.24.1+ clusters. | " " | Optional |
| secondary_boot_disk | Image of a secondary boot disk to preload container images and data on new nodes. For detail see [documentation](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster#nested_secondary_boot_disks). `gcfs_config` must be `enabled=true` for this feature to work. | | Optional |

## windows_node_pools variable
The windows_node_pools variable takes the same parameters as [node_pools](#node\_pools-variable) but is reserved for provisioning Windows based node pools only. This variable is introduced to satisfy a [specific requirement](https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster-windows#create_a_cluster_and_node_pools) for the presence of at least one linux based node pool in the cluster before a windows based node pool can be created.
Expand Down
Loading

0 comments on commit dda7ebe

Please sign in to comment.