Skip to content

Commit

Permalink
install kubernetes
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsimonemms committed Jun 24, 2024
1 parent c34397c commit 95a959b
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 69 deletions.
20 changes: 0 additions & 20 deletions modules/kubernetes/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions modules/kubernetes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.8.0 |
| <a name="requirement_github"></a> [github](#requirement\_github) | >= 6.2.2, < 7.0.0 |
| <a name="requirement_kubernetes"></a> [kubernetes](#requirement\_kubernetes) | >= 2.31.0, < 3.0.0 |
| <a name="requirement_time"></a> [time](#requirement\_time) | >= 0.11.2, < 1.0.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_github"></a> [github](#provider\_github) | 6.2.2 |
| <a name="provider_kubernetes"></a> [kubernetes](#provider\_kubernetes) | 2.31.0 |
| <a name="provider_time"></a> [time](#provider\_time) | 0.11.2 |

## Modules

Expand All @@ -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 |

Expand All @@ -46,5 +42,7 @@ No modules.

## Outputs

No outputs.
| Name | Description |
|------|-------------|
| <a name="output_csi_version"></a> [csi\_version](#output\_csi\_version) | Version of the CSI driver used |
<!-- END_TF_DOCS -->
21 changes: 1 addition & 20 deletions modules/kubernetes/csi.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
23 changes: 23 additions & 0 deletions modules/kubernetes/output.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2024 Simon Emms <[email protected]>
#
# 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
}
4 changes: 0 additions & 4 deletions modules/kubernetes/terraform.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}

Expand Down
20 changes: 0 additions & 20 deletions stacks/dev/kubernetes/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 95a959b

Please sign in to comment.