diff --git a/modules/kubernetes/.terraform.lock.hcl b/modules/kubernetes/.terraform.lock.hcl index 41e3a68..23f584a 100644 --- a/modules/kubernetes/.terraform.lock.hcl +++ b/modules/kubernetes/.terraform.lock.hcl @@ -21,26 +21,6 @@ provider "registry.terraform.io/hashicorp/kubernetes" { ] } -provider "registry.terraform.io/hashicorp/time" { - version = "0.11.2" - constraints = ">= 0.11.2, < 1.0.0" - hashes = [ - "h1:bC4b7n4g30ciIn5w6b66mXSTIo2CH6XQbp+gBdDvlYs=", - "zh:02588b5b8ba5d31e86d93edc93b306bcbf47c789f576769245968cc157a9e8c5", - "zh:088a30c23796133678d1d6614da5cf5544430570408a17062288b58c0bd67ac8", - "zh:0df5faa072d67616154d38021934d8a8a316533429a3f582df3b4b48c836cf89", - "zh:12edeeaef96c47f694bd1ba7ead6ccdb96028b25df352eea4bc5e40de7a59177", - "zh:1e859504a656a6e988f07b908e6ffe946b28bfb56889417c0a07ea9605a3b7b0", - "zh:64a6ae0320d4956c4fdb05629cfcebd03bcbd2206e2d733f2f18e4a97f4d5c7c", - "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:924d137959193bf7aee6ebf241fbb9aec46d6eef828c5cf8d3c588770acae7b2", - "zh:b3cc76281a4faa9c2293a2460fc6962f6539e900994053f85185304887dddab8", - "zh:cbb40c791d4a1cdba56cffa43a9c0ed8e69930d49aa6bd931546b18c36e3b720", - "zh:d227d43594f8cb3d24f1fdd71382f14502cbe2a6deaddbc74242656bb5b38daf", - "zh:d4840641c46176bb9d70ba3aff09de749282136c779996b546c81e5ff701bbf6", - ] -} - provider "registry.terraform.io/integrations/github" { version = "6.2.2" constraints = ">= 6.2.2, < 7.0.0" diff --git a/modules/kubernetes/README.md b/modules/kubernetes/README.md index 292f8f4..0355fcb 100644 --- a/modules/kubernetes/README.md +++ b/modules/kubernetes/README.md @@ -8,7 +8,6 @@ | [terraform](#requirement\_terraform) | >= 1.8.0 | | [github](#requirement\_github) | >= 6.2.2, < 7.0.0 | | [kubernetes](#requirement\_kubernetes) | >= 2.31.0, < 3.0.0 | -| [time](#requirement\_time) | >= 0.11.2, < 1.0.0 | ## Providers @@ -16,7 +15,6 @@ |------|---------| | [github](#provider\_github) | 6.2.2 | | [kubernetes](#provider\_kubernetes) | 2.31.0 | -| [time](#provider\_time) | 0.11.2 | ## Modules @@ -26,10 +24,8 @@ No modules. | Name | Type | |------|------| -| [kubernetes_annotations.restarts](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/annotations) | resource | | [kubernetes_manifest.csi_driver](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/manifest) | resource | | [kubernetes_secret_v1.hcloud_token](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/secret_v1) | resource | -| [time_static.restarted_at](https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/static) | resource | | [github_release.csi_driver](https://registry.terraform.io/providers/integrations/github/latest/docs/data-sources/release) | data source | | [github_repository_file.csi_driver](https://registry.terraform.io/providers/integrations/github/latest/docs/data-sources/repository_file) | data source | @@ -46,5 +42,7 @@ No modules. ## Outputs -No outputs. +| Name | Description | +|------|-------------| +| [csi\_version](#output\_csi\_version) | Version of the CSI driver used | diff --git a/modules/kubernetes/csi.tf b/modules/kubernetes/csi.tf index 6a365e7..55ab31e 100644 --- a/modules/kubernetes/csi.tf +++ b/modules/kubernetes/csi.tf @@ -54,24 +54,5 @@ resource "kubernetes_manifest" "csi_driver" { "spec.template.spec.containers[4].resources", ] - depends_on = [kubernetes_secret_v1.hcloud_token, kubernetes_annotations.restarts] -} - -// Restart the core-dns pods as the CSI controller may be in a failed state -// @link https://github.com/hetznercloud/csi-driver/issues/465#issuecomment-1649216197 -resource "time_static" "restarted_at" {} - -resource "kubernetes_annotations" "restarts" { - // The order is important - for_each = toset(["coredns"]) - - api_version = "apps/v1" - kind = "Deployment" - metadata { - name = each.key - namespace = "kube-system" - } - template_annotations = { - "kubectl.kubernetes.io/restartedAt" = time_static.restarted_at.rfc3339 - } + depends_on = [kubernetes_secret_v1.hcloud_token] } diff --git a/modules/kubernetes/output.tf b/modules/kubernetes/output.tf new file mode 100644 index 0000000..8a4758b --- /dev/null +++ b/modules/kubernetes/output.tf @@ -0,0 +1,23 @@ +# Copyright 2024 Simon Emms +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# output "csi_driver_yaml" { +# description = "CSI driver YAML to apply with kubectl" +# value = data.github_repository_file.csi_driver.content +# } + +output "csi_version" { + description = "Version of the CSI driver used" + value = data.github_release.csi_driver.release_tag +} diff --git a/modules/kubernetes/terraform.tf b/modules/kubernetes/terraform.tf index 2fc777d..3430b48 100644 --- a/modules/kubernetes/terraform.tf +++ b/modules/kubernetes/terraform.tf @@ -23,10 +23,6 @@ terraform { source = "hashicorp/kubernetes" version = ">= 2.31.0, < 3.0.0" } - time = { - source = "hashicorp/time" - version = ">= 0.11.2, < 1.0.0" - } } } diff --git a/stacks/dev/kubernetes/.terraform.lock.hcl b/stacks/dev/kubernetes/.terraform.lock.hcl index 41e3a68..23f584a 100644 --- a/stacks/dev/kubernetes/.terraform.lock.hcl +++ b/stacks/dev/kubernetes/.terraform.lock.hcl @@ -21,26 +21,6 @@ provider "registry.terraform.io/hashicorp/kubernetes" { ] } -provider "registry.terraform.io/hashicorp/time" { - version = "0.11.2" - constraints = ">= 0.11.2, < 1.0.0" - hashes = [ - "h1:bC4b7n4g30ciIn5w6b66mXSTIo2CH6XQbp+gBdDvlYs=", - "zh:02588b5b8ba5d31e86d93edc93b306bcbf47c789f576769245968cc157a9e8c5", - "zh:088a30c23796133678d1d6614da5cf5544430570408a17062288b58c0bd67ac8", - "zh:0df5faa072d67616154d38021934d8a8a316533429a3f582df3b4b48c836cf89", - "zh:12edeeaef96c47f694bd1ba7ead6ccdb96028b25df352eea4bc5e40de7a59177", - "zh:1e859504a656a6e988f07b908e6ffe946b28bfb56889417c0a07ea9605a3b7b0", - "zh:64a6ae0320d4956c4fdb05629cfcebd03bcbd2206e2d733f2f18e4a97f4d5c7c", - "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:924d137959193bf7aee6ebf241fbb9aec46d6eef828c5cf8d3c588770acae7b2", - "zh:b3cc76281a4faa9c2293a2460fc6962f6539e900994053f85185304887dddab8", - "zh:cbb40c791d4a1cdba56cffa43a9c0ed8e69930d49aa6bd931546b18c36e3b720", - "zh:d227d43594f8cb3d24f1fdd71382f14502cbe2a6deaddbc74242656bb5b38daf", - "zh:d4840641c46176bb9d70ba3aff09de749282136c779996b546c81e5ff701bbf6", - ] -} - provider "registry.terraform.io/integrations/github" { version = "6.2.2" constraints = ">= 6.2.2, < 7.0.0"