Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update: Updated ACK/Crossplane app re-configuration #1158

Merged
merged 2 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@

logmessage "Deleting resources created by ACK..."

eksctl delete iamserviceaccount --name carts-ack --namespace carts --cluster $EKS_CLUSTER_NAME -v 0
delete-all-if-crd-exists tables.dynamodb.services.k8s.aws
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,22 @@ module "dynamodb_ack_addon" {
tags = var.tags
}

module "iam_assumable_role_carts" {
source = "terraform-aws-modules/iam/aws//modules/iam-assumable-role-with-oidc"
version = "5.44.0"
create_role = true
role_name = "${var.addon_context.eks_cluster_id}-carts-ack"
provider_url = var.addon_context.eks_oidc_issuer_url
role_policy_arns = [aws_iam_policy.carts_dynamo.arn]
oidc_fully_qualified_subjects = ["system:serviceaccount:carts:carts"]

tags = var.tags
}

resource "aws_iam_policy" "carts_dynamo" {
name = "${var.addon_context.eks_cluster_id}-carts-dynamo"
path = "/"
description = "DynamoDB policy for AWS Sample Carts Application"
description = "Dynamo policy for carts application"

policy = <<EOF
{
Expand All @@ -57,7 +69,8 @@ resource "aws_iam_policy" "carts_dynamo" {
"Effect": "Allow",
"Action": "dynamodb:*",
"Resource": [
"arn:aws:dynamodb:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:*"
"arn:aws:dynamodb:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:table/${var.addon_context.eks_cluster_id}-carts-ack",
"arn:aws:dynamodb:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:table/${var.addon_context.eks_cluster_id}-carts-ack/index/*"
]
}
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
output "environment_variables" {
description = "Environment variables to be added to the IDE shell"
value = {
DYNAMODB_POLICY_ARN = aws_iam_policy.carts_dynamo.arn
CARTS_IAM_ROLE = module.iam_assumable_role_carts.iam_role_arn
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: carts
namespace: carts
annotations:
eks.amazonaws.com/role-arn: ${CARTS_IAM_ROLE}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CARTS_DYNAMODB_TABLENAME=${EKS_CLUSTER_NAME}-carts-ack
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../../../../base-application/carts
patches:
- path: carts-serviceAccount.yaml
configMapGenerator:
- name: carts
namespace: carts
env: config.properties
behavior: replace
options:
disableNameSuffixHash: true

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../../../../base-application/carts
- dynamodb-ack-configmap.yaml
- dynamodb-create.yaml
patches:
- path: deployment.yaml

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading