Skip to content

Commit

Permalink
feat(TPG>=6.5.0)!: support gcp_filestore_csi_driver_config for autopi…
Browse files Browse the repository at this point in the history
…lot (#2126)

Signed-off-by: drfaust92 <[email protected]>
  • Loading branch information
DrFaust92 authored Oct 30, 2024
1 parent ef6c1ba commit e3f016e
Show file tree
Hide file tree
Showing 25 changed files with 113 additions and 98 deletions.
8 changes: 4 additions & 4 deletions autogen/main/cluster.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,10 @@ resource "google_container_cluster" "primary" {
disabled = !var.horizontal_pod_autoscaling
}

gcp_filestore_csi_driver_config {
enabled = var.filestore_csi_driver
}

{% if autopilot_cluster != true %}
network_policy_config {
disabled = !var.network_policy
Expand All @@ -322,10 +326,6 @@ resource "google_container_cluster" "primary" {
enabled = var.dns_cache
}

gcp_filestore_csi_driver_config {
enabled = var.filestore_csi_driver
}

dynamic "gce_persistent_disk_csi_driver_config" {
for_each = local.cluster_gce_pd_csi_config

Expand Down
12 changes: 6 additions & 6 deletions autogen/main/variables.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,12 @@ variable "enable_tpu" {
default = false
}

variable "filestore_csi_driver" {
type = bool
description = "The status of the Filestore CSI driver addon, which allows the usage of filestore instance as volumes"
default = false
}

{% if autopilot_cluster != true %}
variable "network_policy" {
type = bool
Expand All @@ -721,12 +727,6 @@ variable "remove_default_node_pool" {
default = false
}

variable "filestore_csi_driver" {
type = bool
description = "The status of the Filestore CSI driver addon, which allows the usage of filestore instance as volumes"
default = false
}

variable "disable_legacy_metadata_endpoints" {
type = bool
description = "Disable the /0.1/ and /v1beta1/ metadata server endpoints on the node. Changing this value will cause all node pools to be recreated."
Expand Down
9 changes: 3 additions & 6 deletions autogen/main/versions.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,11 @@ terraform {
required_providers {
google = {
source = "hashicorp/google"
# Workaround for https://github.com/hashicorp/terraform-provider-google/issues/19428
version = ">= 5.40.0, != 5.44.0, != 6.2.0, != 6.3.0, < 7"
version = ">= 6.5.0, < 7"
}
google-beta = {
source = "hashicorp/google-beta"
# Workaround for https://github.com/hashicorp/terraform-provider-google/issues/19428
version = ">= 5.40.0, != 5.44.0, != 6.2.0, != 6.3.0, < 7"
version = ">= 6.5.0, < 7"
}
kubernetes = {
source = "hashicorp/kubernetes"
Expand All @@ -70,8 +68,7 @@ terraform {
required_providers {
google = {
source = "hashicorp/google"
# Workaround for https://github.com/hashicorp/terraform-provider-google/issues/19428
version = ">= 5.40.0, != 5.44.0, != 6.2.0, != 6.3.0, < 7"
version = ">= 6.5.0, < 7"
}
kubernetes = {
source = "hashicorp/kubernetes"
Expand Down
8 changes: 4 additions & 4 deletions cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@ resource "google_container_cluster" "primary" {
disabled = !var.horizontal_pod_autoscaling
}

gcp_filestore_csi_driver_config {
enabled = var.filestore_csi_driver
}

network_policy_config {
disabled = !var.network_policy
}
Expand All @@ -242,10 +246,6 @@ resource "google_container_cluster" "primary" {
enabled = var.dns_cache
}

gcp_filestore_csi_driver_config {
enabled = var.filestore_csi_driver
}

dynamic "gce_persistent_disk_csi_driver_config" {
for_each = local.cluster_gce_pd_csi_config

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 @@ -102,6 +102,7 @@ Then perform the following commands on the root folder:
| enable\_secret\_manager\_addon | (Beta) Enable the Secret Manager add-on for this cluster | `bool` | `false` | no |
| enable\_tpu | Enable Cloud TPU resources in the cluster. WARNING: changing this after cluster creation is destructive! | `bool` | `false` | no |
| enable\_vertical\_pod\_autoscaling | Vertical Pod Autoscaling automatically adjusts the resources of pods controlled by it | `bool` | `true` | no |
| filestore\_csi\_driver | The status of the Filestore CSI driver addon, which allows the usage of filestore instance as volumes | `bool` | `false` | no |
| firewall\_inbound\_ports | List of TCP ports for admission/webhook controllers. Either flag `add_master_webhook_firewall_rules` or `add_cluster_firewall_rules` (also adds egress rules) must be set to `true` for inbound-ports firewall rules to be applied. | `list(string)` | <pre>[<br> "8443",<br> "9443",<br> "15017"<br>]</pre> | no |
| firewall\_priority | Priority rule for firewall rules | `number` | `1000` | no |
| fleet\_project | (Optional) Register the cluster with the fleet in this project. | `string` | `null` | no |
Expand Down
4 changes: 4 additions & 0 deletions modules/beta-autopilot-private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ resource "google_container_cluster" "primary" {
disabled = !var.horizontal_pod_autoscaling
}

gcp_filestore_csi_driver_config {
enabled = var.filestore_csi_driver
}


dynamic "gke_backup_agent_config" {
for_each = local.gke_backup_agent_config
Expand Down
6 changes: 6 additions & 0 deletions modules/beta-autopilot-private-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,12 @@ variable "enable_tpu" {
default = false
}

variable "filestore_csi_driver" {
type = bool
description = "The status of the Filestore CSI driver addon, which allows the usage of filestore instance as volumes"
default = false
}

variable "database_encryption" {
description = "Application-layer Secrets Encryption settings. The object format is {state = string, key_name = string}. Valid values of state are: \"ENCRYPTED\"; \"DECRYPTED\". key_name is the name of a CloudKMS key."
type = list(object({ state = string, key_name = string }))
Expand Down
10 changes: 4 additions & 6 deletions modules/beta-autopilot-private-cluster/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@ terraform {

required_providers {
google = {
source = "hashicorp/google"
# Workaround for https://github.com/hashicorp/terraform-provider-google/issues/19428
version = ">= 5.40.0, != 5.44.0, != 6.2.0, != 6.3.0, < 7"
source = "hashicorp/google"
version = ">= 6.5.0, < 7"
}
google-beta = {
source = "hashicorp/google-beta"
# Workaround for https://github.com/hashicorp/terraform-provider-google/issues/19428
version = ">= 5.40.0, != 5.44.0, != 6.2.0, != 6.3.0, < 7"
source = "hashicorp/google-beta"
version = ">= 6.5.0, < 7"
}
kubernetes = {
source = "hashicorp/kubernetes"
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 @@ -93,6 +93,7 @@ Then perform the following commands on the root folder:
| enable\_secret\_manager\_addon | (Beta) Enable the Secret Manager add-on for this cluster | `bool` | `false` | no |
| enable\_tpu | Enable Cloud TPU resources in the cluster. WARNING: changing this after cluster creation is destructive! | `bool` | `false` | no |
| enable\_vertical\_pod\_autoscaling | Vertical Pod Autoscaling automatically adjusts the resources of pods controlled by it | `bool` | `true` | no |
| filestore\_csi\_driver | The status of the Filestore CSI driver addon, which allows the usage of filestore instance as volumes | `bool` | `false` | no |
| firewall\_inbound\_ports | List of TCP ports for admission/webhook controllers. Either flag `add_master_webhook_firewall_rules` or `add_cluster_firewall_rules` (also adds egress rules) must be set to `true` for inbound-ports firewall rules to be applied. | `list(string)` | <pre>[<br> "8443",<br> "9443",<br> "15017"<br>]</pre> | no |
| firewall\_priority | Priority rule for firewall rules | `number` | `1000` | no |
| fleet\_project | (Optional) Register the cluster with the fleet in this project. | `string` | `null` | no |
Expand Down
4 changes: 4 additions & 0 deletions modules/beta-autopilot-public-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ resource "google_container_cluster" "primary" {
disabled = !var.horizontal_pod_autoscaling
}

gcp_filestore_csi_driver_config {
enabled = var.filestore_csi_driver
}


dynamic "gke_backup_agent_config" {
for_each = local.gke_backup_agent_config
Expand Down
6 changes: 6 additions & 0 deletions modules/beta-autopilot-public-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,12 @@ variable "enable_tpu" {
default = false
}

variable "filestore_csi_driver" {
type = bool
description = "The status of the Filestore CSI driver addon, which allows the usage of filestore instance as volumes"
default = false
}

variable "database_encryption" {
description = "Application-layer Secrets Encryption settings. The object format is {state = string, key_name = string}. Valid values of state are: \"ENCRYPTED\"; \"DECRYPTED\". key_name is the name of a CloudKMS key."
type = list(object({ state = string, key_name = string }))
Expand Down
10 changes: 4 additions & 6 deletions modules/beta-autopilot-public-cluster/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@ terraform {

required_providers {
google = {
source = "hashicorp/google"
# Workaround for https://github.com/hashicorp/terraform-provider-google/issues/19428
version = ">= 5.40.0, != 5.44.0, != 6.2.0, != 6.3.0, < 7"
source = "hashicorp/google"
version = ">= 6.5.0, < 7"
}
google-beta = {
source = "hashicorp/google-beta"
# Workaround for https://github.com/hashicorp/terraform-provider-google/issues/19428
version = ">= 5.40.0, != 5.44.0, != 6.2.0, != 6.3.0, < 7"
source = "hashicorp/google-beta"
version = ">= 6.5.0, < 7"
}
kubernetes = {
source = "hashicorp/kubernetes"
Expand Down
8 changes: 4 additions & 4 deletions modules/beta-private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@ resource "google_container_cluster" "primary" {
disabled = !var.horizontal_pod_autoscaling
}

gcp_filestore_csi_driver_config {
enabled = var.filestore_csi_driver
}

network_policy_config {
disabled = !var.network_policy
}
Expand All @@ -263,10 +267,6 @@ resource "google_container_cluster" "primary" {
enabled = var.dns_cache
}

gcp_filestore_csi_driver_config {
enabled = var.filestore_csi_driver
}

dynamic "gce_persistent_disk_csi_driver_config" {
for_each = local.cluster_gce_pd_csi_config

Expand Down
12 changes: 6 additions & 6 deletions modules/beta-private-cluster-update-variant/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,12 @@ variable "enable_tpu" {
default = false
}

variable "filestore_csi_driver" {
type = bool
description = "The status of the Filestore CSI driver addon, which allows the usage of filestore instance as volumes"
default = false
}

variable "network_policy" {
type = bool
description = "Enable network policy addon"
Expand All @@ -690,12 +696,6 @@ variable "remove_default_node_pool" {
default = false
}

variable "filestore_csi_driver" {
type = bool
description = "The status of the Filestore CSI driver addon, which allows the usage of filestore instance as volumes"
default = false
}

variable "disable_legacy_metadata_endpoints" {
type = bool
description = "Disable the /0.1/ and /v1beta1/ metadata server endpoints on the node. Changing this value will cause all node pools to be recreated."
Expand Down
8 changes: 4 additions & 4 deletions modules/beta-private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@ resource "google_container_cluster" "primary" {
disabled = !var.horizontal_pod_autoscaling
}

gcp_filestore_csi_driver_config {
enabled = var.filestore_csi_driver
}

network_policy_config {
disabled = !var.network_policy
}
Expand All @@ -263,10 +267,6 @@ resource "google_container_cluster" "primary" {
enabled = var.dns_cache
}

gcp_filestore_csi_driver_config {
enabled = var.filestore_csi_driver
}

dynamic "gce_persistent_disk_csi_driver_config" {
for_each = local.cluster_gce_pd_csi_config

Expand Down
12 changes: 6 additions & 6 deletions modules/beta-private-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,12 @@ variable "enable_tpu" {
default = false
}

variable "filestore_csi_driver" {
type = bool
description = "The status of the Filestore CSI driver addon, which allows the usage of filestore instance as volumes"
default = false
}

variable "network_policy" {
type = bool
description = "Enable network policy addon"
Expand All @@ -690,12 +696,6 @@ variable "remove_default_node_pool" {
default = false
}

variable "filestore_csi_driver" {
type = bool
description = "The status of the Filestore CSI driver addon, which allows the usage of filestore instance as volumes"
default = false
}

variable "disable_legacy_metadata_endpoints" {
type = bool
description = "Disable the /0.1/ and /v1beta1/ metadata server endpoints on the node. Changing this value will cause all node pools to be recreated."
Expand Down
8 changes: 4 additions & 4 deletions modules/beta-public-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@ resource "google_container_cluster" "primary" {
disabled = !var.horizontal_pod_autoscaling
}

gcp_filestore_csi_driver_config {
enabled = var.filestore_csi_driver
}

network_policy_config {
disabled = !var.network_policy
}
Expand All @@ -263,10 +267,6 @@ resource "google_container_cluster" "primary" {
enabled = var.dns_cache
}

gcp_filestore_csi_driver_config {
enabled = var.filestore_csi_driver
}

dynamic "gce_persistent_disk_csi_driver_config" {
for_each = local.cluster_gce_pd_csi_config

Expand Down
12 changes: 6 additions & 6 deletions modules/beta-public-cluster-update-variant/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,12 @@ variable "enable_tpu" {
default = false
}

variable "filestore_csi_driver" {
type = bool
description = "The status of the Filestore CSI driver addon, which allows the usage of filestore instance as volumes"
default = false
}

variable "network_policy" {
type = bool
description = "Enable network policy addon"
Expand All @@ -654,12 +660,6 @@ variable "remove_default_node_pool" {
default = false
}

variable "filestore_csi_driver" {
type = bool
description = "The status of the Filestore CSI driver addon, which allows the usage of filestore instance as volumes"
default = false
}

variable "disable_legacy_metadata_endpoints" {
type = bool
description = "Disable the /0.1/ and /v1beta1/ metadata server endpoints on the node. Changing this value will cause all node pools to be recreated."
Expand Down
8 changes: 4 additions & 4 deletions modules/beta-public-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@ resource "google_container_cluster" "primary" {
disabled = !var.horizontal_pod_autoscaling
}

gcp_filestore_csi_driver_config {
enabled = var.filestore_csi_driver
}

network_policy_config {
disabled = !var.network_policy
}
Expand All @@ -263,10 +267,6 @@ resource "google_container_cluster" "primary" {
enabled = var.dns_cache
}

gcp_filestore_csi_driver_config {
enabled = var.filestore_csi_driver
}

dynamic "gce_persistent_disk_csi_driver_config" {
for_each = local.cluster_gce_pd_csi_config

Expand Down
12 changes: 6 additions & 6 deletions modules/beta-public-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,12 @@ variable "enable_tpu" {
default = false
}

variable "filestore_csi_driver" {
type = bool
description = "The status of the Filestore CSI driver addon, which allows the usage of filestore instance as volumes"
default = false
}

variable "network_policy" {
type = bool
description = "Enable network policy addon"
Expand All @@ -654,12 +660,6 @@ variable "remove_default_node_pool" {
default = false
}

variable "filestore_csi_driver" {
type = bool
description = "The status of the Filestore CSI driver addon, which allows the usage of filestore instance as volumes"
default = false
}

variable "disable_legacy_metadata_endpoints" {
type = bool
description = "Disable the /0.1/ and /v1beta1/ metadata server endpoints on the node. Changing this value will cause all node pools to be recreated."
Expand Down
Loading

0 comments on commit e3f016e

Please sign in to comment.