From 2128f2d2a4611ab44a908a13cef4d4f8f54406dc Mon Sep 17 00:00:00 2001 From: Vlad Klokun Date: Fri, 27 Sep 2024 11:12:16 +0300 Subject: [PATCH] feat: add Pod Pinner (#85) * feat: add Pod Pinner --- README.md | 7 ++++--- main.tf | 12 ++++++++++-- versions.tf | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e51063c..cbb756d 100644 --- a/README.md +++ b/README.md @@ -293,7 +293,7 @@ Usage examples are located in [terraform provider repo](https://github.com/casta | [terraform](#requirement\_terraform) | >= 0.13 | | [azuread](#requirement\_azuread) | >= 2.22.0 | | [azurerm](#requirement\_azurerm) | >= 3.7.0 | -| [castai](#requirement\_castai) | ~> 7.11 | +| [castai](#requirement\_castai) | ~> 7.14 | | [helm](#requirement\_helm) | >= 2.0.0 | ## Providers @@ -302,7 +302,7 @@ Usage examples are located in [terraform provider repo](https://github.com/casta |------|---------| | [azuread](#provider\_azuread) | >= 2.22.0 | | [azurerm](#provider\_azurerm) | >= 3.7.0 | -| [castai](#provider\_castai) | ~> 7.11 | +| [castai](#provider\_castai) | ~> 7.14 | | [helm](#provider\_helm) | >= 2.0.0 | | [null](#provider\_null) | n/a | @@ -361,7 +361,8 @@ No modules. | [castai\_components\_sets](#input\_castai\_components\_sets) | Optional additional 'set' configurations for helm resources. | `map(string)` | `{}` | no | | [cluster\_controller\_values](#input\_cluster\_controller\_values) | List of YAML formatted string values for cluster-controller helm chart | `list(string)` | `[]` | no | | [cluster\_controller\_version](#input\_cluster\_controller\_version) | Version of castai-cluster-controller helm chart. If not provided, latest version will be used. | `string` | `null` | no | -| [default\_node\_configuration](#input\_default\_node\_configuration) | ID of the default node configuration | `string` | n/a | yes | +| [default\_node\_configuration](#input\_default\_node\_configuration) | ID of the default node configuration | `string` | `""` | no | +| [default\_node\_configuration\_name](#input\_default\_node\_configuration\_name) | Name of the default node configuration | `string` | `""` | no | | [delete\_nodes\_on\_disconnect](#input\_delete\_nodes\_on\_disconnect) | Optionally delete Cast AI created nodes when the cluster is destroyed | `bool` | `false` | no | | [evictor\_ext\_values](#input\_evictor\_ext\_values) | List of YAML formatted string with evictor-ext values | `list(string)` | `[]` | no | | [evictor\_ext\_version](#input\_evictor\_ext\_version) | Version of castai-evictor-ext chart. Default latest | `string` | `null` | no | diff --git a/main.tf b/main.tf index 7d195f9..524211e 100644 --- a/main.tf +++ b/main.tf @@ -525,7 +525,7 @@ resource "helm_release" "castai_pod_pinner" { depends_on = [helm_release.castai_agent] lifecycle { - ignore_changes = [set, version] + ignore_changes = [version] } } @@ -859,6 +859,14 @@ resource "castai_autoscaler" "castai_autoscaler_policies" { max_ram_mib = try(node_constraints.value.max_ram_mib, null) } } + + dynamic "pod_pinner" { + for_each = try([unschedulable_pods.value.pod_pinner], []) + + content { + enabled = try(pod_pinner.value.enabled, null) + } + } } } @@ -943,5 +951,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/versions.tf b/versions.tf index ea2cb8a..7a563e5 100644 --- a/versions.tf +++ b/versions.tf @@ -12,7 +12,7 @@ terraform { } castai = { source = "castai/castai" - version = "~> 7.13" + version = "~> 7.14" } helm = { source = "hashicorp/helm"