From 253137ae37f5deeb713a76f82c0aeb406dbe16e0 Mon Sep 17 00:00:00 2001 From: drfaust92 Date: Sun, 10 Jul 2022 00:00:32 +0300 Subject: [PATCH 1/5] pre-commit --- .pre-commit-config.yaml | 2 +- README.md | 8 ++++---- examples/simple/README.md | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3497881..3e55fc7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/antonbabenko/pre-commit-terraform - rev: v1.62.3 + rev: v1.73.0 hooks: - id: terraform_fmt - id: terraform_docs diff --git a/README.md b/README.md index d8d0420..3af637b 100644 --- a/README.md +++ b/README.md @@ -55,14 +55,14 @@ module "ebs_csi_driver_controller" { | Name | Version | |------|---------| -| [aws](#provider\_aws) | 4.9.0 | -| [kubernetes](#provider\_kubernetes) | 2.10.0 | +| [aws](#provider\_aws) | 4.22.0 | +| [kubernetes](#provider\_kubernetes) | 2.12.1 | ## Modules | Name | Source | Version | |------|--------|---------| -| [ebs\_controller\_role](#module\_ebs\_controller\_role) | terraform-aws-modules/iam/aws//modules/iam-assumable-role-with-oidc | 4.18.0 | +| [ebs\_controller\_role](#module\_ebs\_controller\_role) | terraform-aws-modules/iam/aws//modules/iam-assumable-role-with-oidc | 4.24.1 | ## Resources @@ -79,7 +79,7 @@ module "ebs_csi_driver_controller" { | [kubernetes_cluster_role_binding.provisioner](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/cluster_role_binding) | resource | | [kubernetes_cluster_role_binding.resizer](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/cluster_role_binding) | resource | | [kubernetes_cluster_role_binding.snapshotter](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/cluster_role_binding) | resource | -| [kubernetes_csi_driver.ebs](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/csi_driver) | resource | +| [kubernetes_csi_driver_v1.ebs](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/csi_driver_v1) | resource | | [kubernetes_daemonset.node](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/daemonset) | resource | | [kubernetes_deployment.ebs_csi_controller](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/deployment) | resource | | [kubernetes_service_account.csi_driver](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/service_account) | resource | diff --git a/examples/simple/README.md b/examples/simple/README.md index a5a0263..d6fdd07 100644 --- a/examples/simple/README.md +++ b/examples/simple/README.md @@ -15,8 +15,8 @@ No requirements. | Name | Version | |------|---------| -| [aws](#provider\_aws) | 4.8.0 | -| [tls](#provider\_tls) | 3.1.0 | +| [aws](#provider\_aws) | n/a | +| [tls](#provider\_tls) | n/a | ## Modules From 8f4443ad7e417119326597db085f26f27e44b143 Mon Sep 17 00:00:00 2001 From: drfaust92 Date: Sun, 10 Jul 2022 00:00:48 +0300 Subject: [PATCH 2/5] add CSI_NODE_NAME env var --- node.tf | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/node.tf b/node.tf index 0bdbe12..0082d01 100644 --- a/node.tf +++ b/node.tf @@ -89,6 +89,15 @@ resource "kubernetes_daemonset" "node" { value = "unix:/csi/csi.sock" } + env { + name = "CSI_NODE_NAME" + value_from { + field_ref { + field_path = "spec.nodeName" + } + } + } + volume_mount { mount_path = "/var/lib/kubelet" name = "kubelet-dir" From 877ed5812fc56d94ead048f3f77632c2b68adfdd Mon Sep 17 00:00:00 2001 From: drfaust92 Date: Sun, 10 Jul 2022 00:09:29 +0300 Subject: [PATCH 3/5] snapshotter permissions --- csi_rbac.tf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/csi_rbac.tf b/csi_rbac.tf index a84d19f..f84a241 100644 --- a/csi_rbac.tf +++ b/csi_rbac.tf @@ -227,6 +227,11 @@ resource "kubernetes_cluster_role" "snapshotter" { labels = var.labels } + rule { + api_groups = [""] + resources = ["events"] + verbs = ["list", "watch", "create", "update", "patch"] + } rule { api_groups = ["snapshot.storage.k8s.io"] @@ -237,7 +242,7 @@ resource "kubernetes_cluster_role" "snapshotter" { rule { api_groups = ["snapshot.storage.k8s.io"] resources = ["volumesnapshotcontents"] - verbs = ["create", "get", "list", "watch", "update", "delete"] + verbs = ["create", "get", "list", "watch", "update", "delete", "patch"] } rule { From 3a98deb0978a396c56f3f3e0c72f2d9b973eb11d Mon Sep 17 00:00:00 2001 From: drfaust92 Date: Sun, 10 Jul 2022 00:20:04 +0300 Subject: [PATCH 4/5] more args changes --- README.md | 3 +++ controller.tf | 27 ++++++++++++++++++++++++--- examples/simple/README.md | 4 ++-- locals.tf | 2 +- variables.tf | 18 ++++++++++++++++++ 5 files changed, 48 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3af637b..983ebba 100644 --- a/README.md +++ b/README.md @@ -93,11 +93,14 @@ module "ebs_csi_driver_controller" { | [controller\_extra\_node\_selectors](#input\_controller\_extra\_node\_selectors) | A map of extra node selectors for controller pods | `map(string)` | `{}` | no | | [csi\_controller\_replica\_count](#input\_csi\_controller\_replica\_count) | Number of EBS CSI driver controller pods | `number` | `2` | no | | [csi\_controller\_tolerations](#input\_csi\_controller\_tolerations) | CSI driver controller tolerations | `list(map(string))` | `[]` | no | +| [csi\_provisioner\_tag\_version](#input\_csi\_provisioner\_tag\_version) | The csi provisioner tag version | `string` | `"v2.2.2"` | no | +| [default\_fstype](#input\_default\_fstype) | The default Filesystem type | `string` | `"ext4"` | no | | [ebs\_csi\_controller\_image](#input\_ebs\_csi\_controller\_image) | The EBS CSI driver controller's image | `string` | `""` | no | | [ebs\_csi\_controller\_role\_name](#input\_ebs\_csi\_controller\_role\_name) | The name of the EBS CSI driver IAM role | `string` | `"ebs-csi-driver-controller"` | no | | [ebs\_csi\_controller\_role\_policy\_name\_prefix](#input\_ebs\_csi\_controller\_role\_policy\_name\_prefix) | The prefix of the EBS CSI driver IAM policy | `string` | `"ebs-csi-driver-policy"` | no | | [ebs\_csi\_driver\_version](#input\_ebs\_csi\_driver\_version) | The EBS CSI driver controller's image version | `string` | `""` | no | | [eks\_cluster\_id](#input\_eks\_cluster\_id) | ID of the Kubernetes cluster used for tagging provisioned EBS volumes | `string` | `""` | no | +| [enable\_default\_fstype](#input\_enable\_default\_fstype) | Wheter to enable default Filesystem type | `bool` | `false` | no | | [enable\_volume\_resizing](#input\_enable\_volume\_resizing) | Whether to enable volume resizing | `bool` | `false` | no | | [enable\_volume\_snapshot](#input\_enable\_volume\_snapshot) | Whether to enable volume snapshotting | `bool` | `false` | no | | [extra\_create\_metadata](#input\_extra\_create\_metadata) | If set, add pv/pvc metadata to plugin create requests as parameters. | `bool` | `false` | no | diff --git a/controller.tf b/controller.tf index fec71e3..83f009d 100644 --- a/controller.tf +++ b/controller.tf @@ -68,6 +68,26 @@ resource "kubernetes_deployment" "ebs_csi_controller" { value = "unix:///var/lib/csi/sockets/pluginproxy/csi.sock" } + env { + name = "CSI_NODE_NAME" + value_from { + field_ref { + field_path = "spec.nodeName" + } + } + } + + env { + name = "AWS_EC2_ENDPOINT" + value_from { + config_map_key_ref { + name = "aws-meta" + key = "endpoint" + optional = true + } + } + } + volume_mount { mount_path = "/var/lib/csi/sockets/pluginproxy/" name = "socket-dir" @@ -106,14 +126,15 @@ resource "kubernetes_deployment" "ebs_csi_controller" { container { name = "csi-provisioner" - image = "k8s.gcr.io/sig-storage/csi-provisioner:v2.2.2" + image = "k8s.gcr.io/sig-storage/csi-provisioner:${var.csi_provisioner_tag_version}" args = compact( [ "--csi-address=$(ADDRESS)", "--v=${tostring(var.log_level)}", "--feature-gates=Topology=true", - "--leader-election", - var.extra_create_metadata ? "--extra-create-metadata" : "" + "--leader-electio==true", + var.extra_create_metadata ? "--extra-create-metadata" : "", + var.enable_default_fstype ? "--default-fstype=${var.default_fstype}" : "", ] ) diff --git a/examples/simple/README.md b/examples/simple/README.md index d6fdd07..bb4eee3 100644 --- a/examples/simple/README.md +++ b/examples/simple/README.md @@ -15,8 +15,8 @@ No requirements. | Name | Version | |------|---------| -| [aws](#provider\_aws) | n/a | -| [tls](#provider\_tls) | n/a | +| [aws](#provider\_aws) | 4.22.0 | +| [tls](#provider\_tls) | 3.4.0 | ## Modules diff --git a/locals.tf b/locals.tf index a273491..5febd0e 100644 --- a/locals.tf +++ b/locals.tf @@ -1,6 +1,6 @@ locals { ebs_csi_driver_version = var.ebs_csi_driver_version == "" ? "v1.6.2" : var.ebs_csi_driver_version - liveness_probe_version = "v2.4.0" + liveness_probe_version = "v2.5.0" controller_name = "ebs-csi-controller" daemonset_name = "ebs-csi-node" csi_volume_tags = join(",", [for key, value in var.tags : "${key}=${value}"]) diff --git a/variables.tf b/variables.tf index 3c4a055..db1c2de 100644 --- a/variables.tf +++ b/variables.tf @@ -122,3 +122,21 @@ variable "additional_iam_policies_arns" { default = [] type = list(string) } + +variable "enable_default_fstype" { + description = "Wheter to enable default Filesystem type" + default = false + type = bool +} + +variable "default_fstype" { + description = "The default Filesystem type" + default = "ext4" + type = string +} + +variable "csi_provisioner_tag_version" { + description = "The csi provisioner tag version" + default = "v2.2.2" + type = string +} \ No newline at end of file From 72eab3131954f3f0f19e8780098a63b2b0a98704 Mon Sep 17 00:00:00 2001 From: drfaust92 Date: Sun, 10 Jul 2022 00:22:48 +0300 Subject: [PATCH 5/5] changes --- README.md | 2 +- variables.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 983ebba..f631c57 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ module "ebs_csi_driver_controller" { | [controller\_extra\_node\_selectors](#input\_controller\_extra\_node\_selectors) | A map of extra node selectors for controller pods | `map(string)` | `{}` | no | | [csi\_controller\_replica\_count](#input\_csi\_controller\_replica\_count) | Number of EBS CSI driver controller pods | `number` | `2` | no | | [csi\_controller\_tolerations](#input\_csi\_controller\_tolerations) | CSI driver controller tolerations | `list(map(string))` | `[]` | no | -| [csi\_provisioner\_tag\_version](#input\_csi\_provisioner\_tag\_version) | The csi provisioner tag version | `string` | `"v2.2.2"` | no | +| [csi\_provisioner\_tag\_version](#input\_csi\_provisioner\_tag\_version) | The csi provisioner tag version | `string` | `"v3.2.1"` | no | | [default\_fstype](#input\_default\_fstype) | The default Filesystem type | `string` | `"ext4"` | no | | [ebs\_csi\_controller\_image](#input\_ebs\_csi\_controller\_image) | The EBS CSI driver controller's image | `string` | `""` | no | | [ebs\_csi\_controller\_role\_name](#input\_ebs\_csi\_controller\_role\_name) | The name of the EBS CSI driver IAM role | `string` | `"ebs-csi-driver-controller"` | no | diff --git a/variables.tf b/variables.tf index db1c2de..159cdc3 100644 --- a/variables.tf +++ b/variables.tf @@ -137,6 +137,6 @@ variable "default_fstype" { variable "csi_provisioner_tag_version" { description = "The csi provisioner tag version" - default = "v2.2.2" + default = "v3.2.1" type = string } \ No newline at end of file