From c00d873eb58da38bf1e98d77e3f69fd312312948 Mon Sep 17 00:00:00 2001 From: Paolo Mainardi Date: Sat, 29 Oct 2022 18:45:25 +0200 Subject: [PATCH 1/3] refs platform/1753: Create a retain SC by default --- main.tf | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/main.tf b/main.tf index f3bf5fb..08fe43d 100644 --- a/main.tf +++ b/main.tf @@ -340,13 +340,13 @@ module "gke" { remove_default_node_pool = true - # Kube-proxy - eBPF setting + # Kube-proxy - eBPF setting datapath_provider = var.gke_datapath # Google Group for RBAC authenticator_security_group = var.gke_google_group_rbac_mail - # Backup for GKE + # Backup for GKE gke_backup_agent_config = var.gke_enable_backup_agent - # Istio + # Istio istio = var.gke_enable_istio_addon istio_auth = var.gke_istio_auth @@ -419,7 +419,20 @@ resource "kubernetes_storage_class" "storage_class" { storage_provisioner = "kubernetes.io/gce-pd" parameters = { type = var.gke_storage_class - replication-type = var.gke_disk_replication + replication-type = var.gke_disk_replication == "" ? null : var.gke_disk_replication + } + depends_on = [time_sleep.sleep_for_cluster_fix_helm_6361] +} + +resource "kubernetes_storage_class" "storage_class_retain" { + metadata { + name = "$(var.gke_storage_class)_retain" + } + reclaim_policy = "Retain" + storage_provisioner = "kubernetes.io/gce-pd" + parameters = { + type = var.gke_storage_class + replication-type = var.gke_disk_replication == "" ? null : var.gke_disk_replication } depends_on = [time_sleep.sleep_for_cluster_fix_helm_6361] } From 56bfa86594a8c4b81cd39fff20dbc103b1589c98 Mon Sep 17 00:00:00 2001 From: Paolo Mainardi Date: Sat, 29 Oct 2022 18:53:50 +0200 Subject: [PATCH 2/3] refs platform/1753: Create a retain SC by default --- main.tf | 14 +------------- variables.tf | 8 +++++++- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/main.tf b/main.tf index 08fe43d..400a0b6 100644 --- a/main.tf +++ b/main.tf @@ -416,19 +416,7 @@ resource "kubernetes_storage_class" "storage_class" { metadata { name = var.gke_storage_class } - storage_provisioner = "kubernetes.io/gce-pd" - parameters = { - type = var.gke_storage_class - replication-type = var.gke_disk_replication == "" ? null : var.gke_disk_replication - } - depends_on = [time_sleep.sleep_for_cluster_fix_helm_6361] -} - -resource "kubernetes_storage_class" "storage_class_retain" { - metadata { - name = "$(var.gke_storage_class)_retain" - } - reclaim_policy = "Retain" + reclaim_policy = var.gke_storage_class_reclaim_policy storage_provisioner = "kubernetes.io/gce-pd" parameters = { type = var.gke_storage_class diff --git a/variables.tf b/variables.tf index 750ce9d..c47b0d2 100644 --- a/variables.tf +++ b/variables.tf @@ -191,10 +191,16 @@ variable "gke_machine_type" { variable "gke_storage_class" { type = string - description = "Default storage class for GKE Cluster. Default pd-sdd." + description = "Default storage class for GKE Cluster. Default pd-sdd" default = "pd-ssd" } +variable "gke_storage_class_reclaim_policy" { + type = string + description = "Set storage class reclaim policy. Default Retain" + default = "Retain" +} + variable "gke_disk_replication" { type = string description = "Setup replication type for disk persistent volune. Possible values none or regional-pd. Default to none." From 1c5861c609f2c6a3e4ce344b3d6171cf13a4c8a7 Mon Sep 17 00:00:00 2001 From: Paolo Mainardi Date: Sat, 29 Oct 2022 18:54:18 +0200 Subject: [PATCH 3/3] refs platform/1753: Create a retain SC by default --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 400a0b6..7899b80 100644 --- a/main.tf +++ b/main.tf @@ -420,7 +420,7 @@ resource "kubernetes_storage_class" "storage_class" { storage_provisioner = "kubernetes.io/gce-pd" parameters = { type = var.gke_storage_class - replication-type = var.gke_disk_replication == "" ? null : var.gke_disk_replication + replication-type = var.gke_disk_replication } depends_on = [time_sleep.sleep_for_cluster_fix_helm_6361] }