Skip to content

Commit

Permalink
update: Updated ACK/Crossplane app re-configuration (aws-samples#1158)
Browse files Browse the repository at this point in the history
  • Loading branch information
niallthomson authored and Yunjian committed Oct 28, 2024
1 parent b58e056 commit 23c41c7
Show file tree
Hide file tree
Showing 59 changed files with 408 additions and 918 deletions.
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 @@ -21,10 +21,22 @@ data "aws_ecrpublic_authorization_token" "token" {



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 @@ -35,7 +47,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

0 comments on commit 23c41c7

Please sign in to comment.