From 2ffc594982200b594a96181067a068699b7dc48e Mon Sep 17 00:00:00 2001 From: Vladyslav Klokun Date: Tue, 24 Sep 2024 22:14:19 +0300 Subject: [PATCH 1/2] feat: add the `castai-pod-pinner-ext` subchart improvement Upstream separated some RBAC resources for better control. This commit incorporates these improvements. --- README.md | 3 +++ main.tf | 27 ++++++++++++++++++++++++++- variables.tf | 12 ++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4ab285a..fa2955b 100644 --- a/README.md +++ b/README.md @@ -335,6 +335,7 @@ No modules. | [helm_release.castai_kvisor](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | | [helm_release.castai_kvisor_self_managed](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | | [helm_release.castai_pod_pinner](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | +| [helm_release.castai_pod_pinner_ext](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | | [helm_release.castai_pod_pinner_self_managed](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | | [helm_release.castai_spot_handler](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | | [helm_release.castai_workload_autoscaler](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | @@ -373,6 +374,8 @@ No modules. | [kvisor\_version](#input\_kvisor\_version) | Version of kvisor chart. If not provided, latest version will be used. | `string` | `null` | no | | [node\_configurations](#input\_node\_configurations) | Map of GKE node configurations to create | `any` | `{}` | no | | [node\_templates](#input\_node\_templates) | Map of node templates to create | `any` | `{}` | no | +| [pod\_pinner\_ext\_values](#input\_pod\_pinner\_ext\_values) | List of YAML formatted string with pod-pinner-ext values | `list(string)` | `[]` | no | +| [pod\_pinner\_ext\_version](#input\_pod\_pinner\_ext\_version) | Version of castai-pod-pinner-ext chart. Default latest | `string` | `null` | no | | [pod\_pinner\_values](#input\_pod\_pinner\_values) | List of YAML formatted string values for agent helm chart | `list(string)` | `[]` | no | | [pod\_pinner\_version](#input\_pod\_pinner\_version) | Version of pod-pinner helm chart. Default latest | `string` | `null` | no | | [project\_id](#input\_project\_id) | The project id from GCP | `string` | n/a | yes | diff --git a/main.tf b/main.tf index 72aafaf..64acac9 100644 --- a/main.tf +++ b/main.tf @@ -468,6 +468,11 @@ resource "helm_release" "castai_pod_pinner" { value = "0" } + set { + name = "castai-pod-pinner-ext.enabled" + value = "false" + } + depends_on = [helm_release.castai_agent] lifecycle { @@ -494,6 +499,11 @@ resource "helm_release" "castai_pod_pinner_self_managed" { value = castai_gke_cluster.castai_cluster.id } + set { + name = "castai-pod-pinner-ext.enabled" + value = "false" + } + dynamic "set" { for_each = var.api_url != "" ? [var.api_url] : [] content { @@ -526,6 +536,21 @@ resource "helm_release" "castai_pod_pinner_self_managed" { depends_on = [helm_release.castai_agent] } +resource "helm_release" "castai_pod_pinner_ext" { + name = "castai-pod-pinner-ext" + repository = "https://castai.github.io/helm-charts" + chart = "castai-pod-pinner-ext" + namespace = "castai-agent" + create_namespace = false + cleanup_on_fail = true + wait = true + + version = var.pod_pinner_ext_version + values = var.pod_pinner_ext_values + + depends_on = [helm_release.castai_pod_pinner] +} + resource "helm_release" "castai_spot_handler" { name = "castai-spot-handler" repository = "https://castai.github.io/helm-charts" @@ -865,5 +890,5 @@ resource "castai_autoscaler" "castai_autoscaler_policies" { } } - depends_on = [helm_release.castai_agent, helm_release.castai_evictor] + depends_on = [helm_release.castai_agent, helm_release.castai_evictor, helm_release.castai_pod_pinner] } diff --git a/variables.tf b/variables.tf index 035fb74..72f4068 100644 --- a/variables.tf +++ b/variables.tf @@ -144,6 +144,12 @@ variable "pod_pinner_version" { default = null } +variable "pod_pinner_ext_version" { + description = "Version of castai-pod-pinner-ext chart. Default latest" + type = string + default = null +} + variable "spot_handler_version" { description = "Version of castai-spot-handler helm chart. Default latest" type = string @@ -192,6 +198,12 @@ variable "pod_pinner_values" { default = [] } +variable "pod_pinner_ext_values" { + description = "List of YAML formatted string with pod-pinner-ext values" + type = list(string) + default = [] +} + variable "kvisor_values" { description = "List of YAML formatted string values for kvisor helm chart" type = list(string) From 6c42b7b450352f0d35b61505544d6ce4e75ffda2 Mon Sep 17 00:00:00 2001 From: Vladyslav Klokun Date: Wed, 25 Sep 2024 22:11:27 +0300 Subject: [PATCH 2/2] fix: do not deploy pod-pinner-ext subchart separately --- README.md | 3 --- main.tf | 27 +-------------------------- variables.tf | 12 ------------ 3 files changed, 1 insertion(+), 41 deletions(-) diff --git a/README.md b/README.md index fa2955b..4ab285a 100644 --- a/README.md +++ b/README.md @@ -335,7 +335,6 @@ No modules. | [helm_release.castai_kvisor](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | | [helm_release.castai_kvisor_self_managed](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | | [helm_release.castai_pod_pinner](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | -| [helm_release.castai_pod_pinner_ext](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | | [helm_release.castai_pod_pinner_self_managed](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | | [helm_release.castai_spot_handler](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | | [helm_release.castai_workload_autoscaler](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | @@ -374,8 +373,6 @@ No modules. | [kvisor\_version](#input\_kvisor\_version) | Version of kvisor chart. If not provided, latest version will be used. | `string` | `null` | no | | [node\_configurations](#input\_node\_configurations) | Map of GKE node configurations to create | `any` | `{}` | no | | [node\_templates](#input\_node\_templates) | Map of node templates to create | `any` | `{}` | no | -| [pod\_pinner\_ext\_values](#input\_pod\_pinner\_ext\_values) | List of YAML formatted string with pod-pinner-ext values | `list(string)` | `[]` | no | -| [pod\_pinner\_ext\_version](#input\_pod\_pinner\_ext\_version) | Version of castai-pod-pinner-ext chart. Default latest | `string` | `null` | no | | [pod\_pinner\_values](#input\_pod\_pinner\_values) | List of YAML formatted string values for agent helm chart | `list(string)` | `[]` | no | | [pod\_pinner\_version](#input\_pod\_pinner\_version) | Version of pod-pinner helm chart. Default latest | `string` | `null` | no | | [project\_id](#input\_project\_id) | The project id from GCP | `string` | n/a | yes | diff --git a/main.tf b/main.tf index 64acac9..0f32b04 100644 --- a/main.tf +++ b/main.tf @@ -468,15 +468,10 @@ resource "helm_release" "castai_pod_pinner" { value = "0" } - set { - name = "castai-pod-pinner-ext.enabled" - value = "false" - } - depends_on = [helm_release.castai_agent] lifecycle { - ignore_changes = [set, version] + ignore_changes = [version] } } @@ -499,11 +494,6 @@ resource "helm_release" "castai_pod_pinner_self_managed" { value = castai_gke_cluster.castai_cluster.id } - set { - name = "castai-pod-pinner-ext.enabled" - value = "false" - } - dynamic "set" { for_each = var.api_url != "" ? [var.api_url] : [] content { @@ -536,21 +526,6 @@ resource "helm_release" "castai_pod_pinner_self_managed" { depends_on = [helm_release.castai_agent] } -resource "helm_release" "castai_pod_pinner_ext" { - name = "castai-pod-pinner-ext" - repository = "https://castai.github.io/helm-charts" - chart = "castai-pod-pinner-ext" - namespace = "castai-agent" - create_namespace = false - cleanup_on_fail = true - wait = true - - version = var.pod_pinner_ext_version - values = var.pod_pinner_ext_values - - depends_on = [helm_release.castai_pod_pinner] -} - resource "helm_release" "castai_spot_handler" { name = "castai-spot-handler" repository = "https://castai.github.io/helm-charts" diff --git a/variables.tf b/variables.tf index 72f4068..035fb74 100644 --- a/variables.tf +++ b/variables.tf @@ -144,12 +144,6 @@ variable "pod_pinner_version" { default = null } -variable "pod_pinner_ext_version" { - description = "Version of castai-pod-pinner-ext chart. Default latest" - type = string - default = null -} - variable "spot_handler_version" { description = "Version of castai-spot-handler helm chart. Default latest" type = string @@ -198,12 +192,6 @@ variable "pod_pinner_values" { default = [] } -variable "pod_pinner_ext_values" { - description = "List of YAML formatted string with pod-pinner-ext values" - type = list(string) - default = [] -} - variable "kvisor_values" { description = "List of YAML formatted string values for kvisor helm chart" type = list(string)