Skip to content

Commit 77b4fd6

Browse files
authored
Merge pull request #211 from PermanentOrg/manage_ebs_csi_add_on_from_terraform
Manage ebs csi add on from terraform
2 parents 1b14542 + a36ad5c commit 77b4fd6

File tree

3 files changed

+66
-8
lines changed

3 files changed

+66
-8
lines changed

archivematica/prod_cluster/eks-cluster.tf

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,29 @@ module "eks" {
2222
}
2323
}
2424

25+
addons = {
26+
coredns = {
27+
most_recent = true
28+
resolve_conflicts_on_create = "OVERWRITE"
29+
resolve_conflicts = "OVERWRITE"
30+
}
31+
kube-proxy = {
32+
most_recent = true
33+
resolve_conflicts_on_create = "OVERWRITE"
34+
resolve_conflicts = "OVERWRITE"
35+
}
36+
vpc-cni = {
37+
most_recent = true
38+
resolve_conflicts_on_create = "OVERWRITE"
39+
resolve_conflicts = "OVERWRITE"
40+
}
41+
aws-ebs-csi-driver = {
42+
most_recent = true
43+
service_account_role_arn = module.ebs_csi_irsa.iam_role_arn
44+
resolve_conflicts = "OVERWRITE"
45+
}
46+
}
47+
2548
eks_managed_node_groups = {
2649
one = {
2750
name = "node-group-1"
@@ -49,6 +72,21 @@ module "eks" {
4972
}
5073
}
5174

75+
module "ebs_csi_irsa" {
76+
source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"
77+
version = "5.60.0"
78+
79+
role_name_prefix = "${local.cluster_name}-ebs-csi-"
80+
attach_ebs_csi_policy = true
81+
82+
oidc_providers = {
83+
main = {
84+
provider_arn = module.eks.oidc_provider_arn
85+
namespace_service_accounts = ["kube-system:ebs-csi-controller-sa"]
86+
}
87+
}
88+
}
89+
5290
resource "kubernetes_cluster_role_binding" "eks_admins_cluster_admin" {
5391
metadata {
5492
name = "eks-admins-cluster-admin"

archivematica/test_cluster/eks-cluster.tf

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ module "eks" {
3838
resolve_conflicts_on_create = "OVERWRITE"
3939
resolve_conflicts = "OVERWRITE"
4040
}
41+
aws-ebs-csi-driver = {
42+
most_recent = true
43+
service_account_role_arn = module.ebs_csi_irsa.iam_role_arn
44+
resolve_conflicts = "OVERWRITE"
45+
}
4146
}
4247

4348
eks_managed_node_groups = {
@@ -68,6 +73,21 @@ module "eks" {
6873
}
6974
}
7075

76+
module "ebs_csi_irsa" {
77+
source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"
78+
version = "5.60.0"
79+
80+
role_name_prefix = "${local.cluster_name}-ebs-csi-"
81+
attach_ebs_csi_policy = true
82+
83+
oidc_providers = {
84+
main = {
85+
provider_arn = module.eks.oidc_provider_arn
86+
namespace_service_accounts = ["kube-system:ebs-csi-controller-sa"]
87+
}
88+
}
89+
}
90+
7191
resource "kubernetes_storage_class" "gp3" {
7292
metadata {
7393
name = "gp3"

archivematica/test_cluster/staging_archivematica_deployment.tf

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ resource "kubernetes_deployment" "archivematica_staging" {
3131
fs_group_change_policy = "OnRootMismatch"
3232
}
3333
container {
34-
image = "364159549467.dkr.ecr.us-west-2.amazonaws.com/archivematica:storage-service-main-30826d7"
34+
image = local.desired_images["archivematica-storage-service-staging"]
3535
name = "archivematica-storage-service-staging"
3636
env {
3737
name = "SS_GUNICORN_BIND"
@@ -123,7 +123,7 @@ resource "kubernetes_deployment" "archivematica_staging" {
123123
}
124124
}
125125
container {
126-
image = "364159549467.dkr.ecr.us-west-2.amazonaws.com/archivematica:dashboard-main-0025af3"
126+
image = local.desired_images["archivematica-dashboard-staging"]
127127
name = "archivematica-dashboard-staging"
128128
env {
129129
name = "AM_GUNICORN_BIND"
@@ -240,7 +240,7 @@ resource "kubernetes_deployment" "archivematica_staging" {
240240
}
241241
}
242242
container {
243-
image = "364159549467.dkr.ecr.us-west-2.amazonaws.com/archivematica:mcp-server-main-0025af3"
243+
image = local.desired_images["archivematica-mcp-server-staging"]
244244
name = "archivematica-mcp-server-staging"
245245
env {
246246
name = "DJANGO_SECRET_KEY"
@@ -324,7 +324,7 @@ resource "kubernetes_deployment" "archivematica_staging" {
324324
}
325325
}
326326
init_container {
327-
image = "364159549467.dkr.ecr.us-west-2.amazonaws.com/archivematica:storage-service-main-30826d7"
327+
image = local.desired_images["archivematica-storage-service-staging"]
328328
name = "archivematica-storage-service-migrations"
329329
command = ["sh"]
330330
args = ["-c", "python manage.py migrate --noinput"]
@@ -364,7 +364,7 @@ resource "kubernetes_deployment" "archivematica_staging" {
364364
}
365365
}
366366
init_container {
367-
image = "364159549467.dkr.ecr.us-west-2.amazonaws.com/archivematica:storage-service-main-30826d7"
367+
image = local.desired_images["archivematica-storage-service-staging"]
368368
name = "archivematica-storage-service-create-user"
369369
env {
370370
name = "DJANGO_SETTINGS_MODULE"
@@ -432,7 +432,7 @@ resource "kubernetes_deployment" "archivematica_staging" {
432432
args = ["-c", "python manage.py create_user --username=$(AM_SS_USERNAME) --password='$(AM_SS_PASSWORD)' --email=$(AM_SS_EMAIL) --api-key='$(AM_SS_API_KEY)' --superuser"]
433433
}
434434
init_container {
435-
image = "364159549467.dkr.ecr.us-west-2.amazonaws.com/archivematica:dashboard-main-0025af3"
435+
image = local.desired_images["archivematica-dashboard-staging"]
436436
name = "archivematica-dashboard-migration"
437437
command = ["sh"]
438438
args = ["-c", "python /src/src/dashboard/src/manage.py migrate --noinput"]
@@ -494,7 +494,7 @@ resource "kubernetes_deployment" "archivematica_staging" {
494494
}
495495
}
496496
init_container {
497-
image = "364159549467.dkr.ecr.us-west-2.amazonaws.com/archivematica:storage-service-main-30826d7"
497+
image = local.desired_images["archivematica-storage-service-staging"]
498498
name = "archivematica-rclone-configuration"
499499
command = ["sh"]
500500
args = ["-c", "rclone config create permanentb2 b2 account $(BACKBLAZE_KEY_ID) key $(BACKBLAZE_APPLICATION_KEY) --obscure"]
@@ -591,7 +591,7 @@ resource "kubernetes_deployment" "mcp_client_staging" {
591591
}
592592
spec {
593593
container {
594-
image = "364159549467.dkr.ecr.us-west-2.amazonaws.com/archivematica:mcp-client-main-0025af3"
594+
image = local.desired_images["archivematica-mcp-client-staging"]
595595
name = "archivematica-mcp-client-staging"
596596
env {
597597
name = "DJANGO_SECRET_KEY"

0 commit comments

Comments
 (0)