Skip to content

Commit 8e7e6be

Browse files
authored
Merge pull request #5 from SPHTech-Platform/feat/update-module
feat: update efs csi driver module
2 parents fdb1ee6 + 5ed9a21 commit 8e7e6be

File tree

4 files changed

+97
-133
lines changed

4 files changed

+97
-133
lines changed

iam.tf

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@ module "efs_csi_role" {
22
count = var.create_default_irsa ? 1 : 0
33

44
source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"
5-
version = "~> 4.21.1"
5+
version = "~> 5.55"
66

77
role_name_prefix = coalesce(var.iam_role_name, "${var.cluster_name}-efs-csi-")
88
role_description = "EKS Cluster ${var.cluster_name} EFS CSI Driver role"
99

1010
attach_efs_csi_policy = true
1111
oidc_providers = {
1212
main = {
13-
provider_arn = var.oidc_provider_arn
14-
namespace_service_accounts = ["${var.namespace}:${local.service_account_name}"]
13+
provider_arn = var.oidc_provider_arn
14+
namespace_service_accounts = [
15+
"${var.namespace}:${var.controller_service_account_name}",
16+
"${var.namespace}:${var.node_service_account_name}",
17+
]
1518
}
1619
}
1720
}

main.tf

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,30 @@
11
locals {
2-
service_account_name = var.service_account_name
2+
controller_service_account_annotations = var.create_default_irsa ? {
3+
"eks.amazonaws.com/role-arn" = module.efs_csi_role[0].iam_role_arn
4+
} : {}
5+
node_service_account_annotations = var.create_default_irsa ? {
6+
"eks.amazonaws.com/role-arn" = module.efs_csi_role[0].iam_role_arn
7+
} : {}
38

49
values = {
510
image_repository = var.image_repository
611
image_tag = var.image_tag
712

8-
resources_driver = jsonencode(var.resources_driver)
9-
resources_registrar = jsonencode(var.resources_registrar)
10-
resources_liveness = jsonencode(var.resources_liveness)
13+
liveness_probe_image_tag = var.liveness_probe_image_tag
14+
node_driver_registrar_image_tag = var.node_driver_registrar_image_tag
15+
external_provisioner_image_tag = var.external_provisioner_image_tag
1116

17+
controller_service_account_name = var.controller_service_account_name
18+
controller_resources = jsonencode(var.controller_resources)
19+
controller_service_account_annotations = jsonencode(local.controller_service_account_annotations)
20+
21+
node_service_account_name = var.node_service_account_name
22+
node_resources = jsonencode(var.node_resources)
23+
node_service_account_annotations = jsonencode(local.node_service_account_annotations)
24+
25+
storage_classes = jsonencode(var.storage_classess)
26+
27+
enable_helm_hooks_for_csi_driver = var.enable_helm_hooks_for_csi_driver
1228
}
1329

1430
}

templates/values.yaml

Lines changed: 19 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
# Default values for aws-efs-csi-driver.
22
# This is a YAML-formatted file.
33
# Declare variables to be passed into your templates.
4-
5-
nameOverride: ""
6-
fullnameOverride: ""
7-
8-
replicaCount: 2
9-
104
image:
115
repository: ${image_repository}
126
tag: ${image_tag}
@@ -15,113 +9,40 @@ image:
159
sidecars:
1610
livenessProbe:
1711
image:
18-
repository: public.ecr.aws/eks-distro/kubernetes-csi/livenessprobe
19-
tag: v2.2.0-eks-1-18-13
20-
pullPolicy: IfNotPresent
21-
resources: {}
12+
tag: ${liveness_probe_image_tag}
2213
nodeDriverRegistrar:
2314
image:
24-
repository: public.ecr.aws/eks-distro/kubernetes-csi/node-driver-registrar
25-
tag: v2.1.0-eks-1-18-13
26-
pullPolicy: IfNotPresent
27-
resources: {}
15+
tag: ${node_driver_registrar_image_tag}
2816
csiProvisioner:
2917
image:
30-
repository: public.ecr.aws/eks-distro/kubernetes-csi/external-provisioner
31-
tag: v2.1.1-eks-1-18-13
32-
pullPolicy: IfNotPresent
33-
resources: {}
34-
35-
imagePullSecrets: []
36-
37-
## Controller deployment variables
18+
tag: ${external_provisioner_image_tag}
3819

3920
controller:
40-
# Specifies whether a deployment should be created
4121
create: true
42-
# Number for the log level verbosity
43-
logLevel: 2
44-
# If set, add pv/pvc metadata to plugin create requests as parameters.
45-
extraCreateMetadata: true
46-
# Add additional tags to access points
47-
tags:
48-
{}
49-
# environment: prod
50-
# region: us-east-1
51-
# Enable if you want the controller to also delete the
52-
# path on efs when deleteing an access point
53-
deleteAccessPointRootDir: false
54-
volMetricsOptIn: false
55-
podAnnotations: {}
56-
resources:
57-
{}
58-
# We usually recommend not to specify default resources and to leave this as a conscious
59-
# choice for the user. This also increases chances charts run on environments with little
60-
# resources, such as Minikube. If you do want to specify resources, uncomment the following
61-
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
62-
# limits:
63-
# cpu: 100m
64-
# memory: 128Mi
65-
# requests:
66-
# cpu: 100m
67-
# memory: 128Mi
68-
nodeSelector: {}
69-
tolerations: []
70-
affinity: {}
71-
# Specifies whether a service account should be created
22+
resources: ${controller_resources}
7223
serviceAccount:
7324
create: true
74-
name: efs-csi-controller-sa
75-
annotations: {}
25+
name: ${controller_service_account_name}
26+
annotations: ${controller_service_account_annotations}
7627
## Enable if EKS IAM for SA is used
7728
# eks.amazonaws.com/role-arn: arn:aws:iam::111122223333:role/efs-csi-role
78-
healthPort: 9909
79-
regionalStsEndpoints: false
80-
## Node daemonset variables
29+
podDisruptionBudget:
30+
enabled: true
31+
topologySpreadConstraints:
32+
- maxSkew: 1
33+
topologyKey: "topology.kubernetes.io/zone"
34+
whenUnsatisfiable: DoNotSchedule
8135

8236
node:
83-
# Number for the log level verbosity
84-
logLevel: 2
85-
hostAliases:
86-
{}
87-
# For cross VPC EFS, you need to poison or overwrite the DNS for the efs volume as per
88-
# https://docs.aws.amazon.com/efs/latest/ug/efs-different-vpc.html#wt6-efs-utils-step3
89-
# implementing the suggested solution found here:
90-
# https://github.com/kubernetes-sigs/aws-efs-csi-driver/issues/240#issuecomment-676849346
91-
# EFS Vol ID, IP, Region
92-
# "fs-01234567":
93-
# ip: 10.10.2.2
94-
# region: us-east-2
95-
dnsPolicy: ClusterFirst
96-
dnsConfig:
97-
{}
98-
# Example config which uses the AWS nameservers
99-
# dnsPolicy: "None"
100-
# dnsConfig:
101-
# nameservers:
102-
# - 169.254.169.253
103-
podAnnotations: {}
104-
resources:
105-
{}
106-
# limits:
107-
# cpu: 100m
108-
# memory: 128Mi
109-
# requests:
110-
# cpu: 100m
111-
# memory: 128Mi
112-
nodeSelector: {}
113-
tolerations:
114-
- operator: Exists
115-
# Specifies whether a service account should be created
37+
resources: ${node_resources}
11638
serviceAccount:
11739
create: true
118-
name: efs-csi-node-sa
119-
annotations: {}
40+
name: ${node_service_account_name}
41+
annotations: ${node_service_account_annotations}
12042
## Enable if EKS IAM for SA is used
12143
# eks.amazonaws.com/role-arn: arn:aws:iam::111122223333:role/efs-csi-role
122-
healthPort: 9809
12344

124-
storageClasses: []
45+
storageClasses: ${storage_classes}
12546
# Add StorageClass resources like:
12647
# - name: efs-sc
12748
# annotations:
@@ -138,3 +59,6 @@ storageClasses: []
13859
# basePath: "/dynamic_provisioning"
13960
# reclaimPolicy: Delete
14061
# volumeBindingMode: Immediate
62+
63+
# Specifies wether to use helm hooks to apply the CSI driver
64+
useHelmHooksForCSIDriver: ${enable_helm_hooks_for_csi_driver}

variables.tf

Lines changed: 52 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ variable "chart_repository" {
2424
variable "chart_version" {
2525
description = "Version of Chart to install. Set to empty to install the latest version"
2626
type = string
27-
default = "2.4.3"
27+
default = "3.1.9"
2828
}
2929

3030
variable "chart_namespace" {
@@ -48,7 +48,7 @@ variable "max_history" {
4848
variable "create_namespace" {
4949
description = "Create the namespace if it does not exist"
5050
type = bool
51-
default = false
51+
default = true
5252
}
5353

5454
########################
@@ -58,17 +58,35 @@ variable "create_namespace" {
5858
variable "image_repository" {
5959
description = "Image repository on Dockerhub"
6060
type = string
61-
default = "amazon/aws-efs-csi-driver"
61+
default = "public.ecr.aws/efs-csi-driver/amazon/aws-efs-csi-driver"
6262
}
6363

6464
variable "image_tag" {
6565
description = "Image tag"
6666
type = string
67-
default = "v1.5.5"
67+
default = "v2.1.8"
68+
}
69+
70+
variable "liveness_probe_image_tag" {
71+
description = "Liveness Probe Image Tag"
72+
type = string
73+
default = "v2.14.0-eks-1-32-6"
74+
}
75+
76+
variable "node_driver_registrar_image_tag" {
77+
description = "Node Driver Registrar Image Tag"
78+
type = string
79+
default = "v2.13.0-eks-1-32-6"
80+
}
81+
82+
variable "external_provisioner_image_tag" {
83+
description = "External Provisioner Image Tag"
84+
type = string
85+
default = "v5.2.0-eks-1-32-6"
6886
}
6987

70-
variable "resources_driver" {
71-
description = "Driver Resources"
88+
variable "controller_resources" {
89+
description = "Controller Resources"
7290
type = map(any)
7391
default = {
7492
requests = {
@@ -82,34 +100,43 @@ variable "resources_driver" {
82100
}
83101
}
84102

85-
variable "resources_registrar" {
86-
description = "Registrar Resources"
103+
variable "node_resources" {
104+
description = "Node Resources"
87105
type = map(any)
88106
default = {
89107
requests = {
90-
cpu = "100m"
91-
memory = "100Mi"
108+
cpu = "200m"
109+
memory = "200Mi"
92110
}
93111
limits = {
94-
cpu = "100m"
95-
memory = "100Mi"
112+
cpu = "200m"
113+
memory = "200Mi"
96114
}
97115
}
98116
}
99117

100-
variable "resources_liveness" {
101-
description = "LivenessProbe Resources"
102-
type = map(any)
103-
default = {
104-
requests = {
105-
cpu = "100m"
106-
memory = "100Mi"
107-
}
108-
limits = {
109-
cpu = "100m"
110-
memory = "100Mi"
111-
}
112-
}
118+
variable "storage_classess" {
119+
description = "Storage Classes"
120+
type = any
121+
default = []
122+
}
123+
124+
variable "enable_helm_hooks_for_csi_driver" {
125+
description = "Enable Helm hooks for CSI driver"
126+
type = bool
127+
default = true
128+
}
129+
130+
variable "controller_service_account_name" {
131+
description = "Controller Service Account Name"
132+
type = string
133+
default = "efs-csi-controller-sa"
134+
}
135+
136+
variable "node_service_account_name" {
137+
description = "Node Service Account Name"
138+
type = string
139+
default = "efs-csi-node-sa"
113140
}
114141

115142
########################
@@ -129,12 +156,6 @@ variable "iam_role_name" {
129156
##############
130157
#### IRSA ####
131158
##############
132-
variable "service_account_name" {
133-
description = "Name of service account to create. Not generated"
134-
type = string
135-
default = "efs-csi-controller-sa"
136-
}
137-
138159
variable "create_default_irsa" {
139160
description = "Create default IRSA for service account"
140161
type = bool

0 commit comments

Comments
 (0)