@@ -37,142 +37,142 @@ spec:
3737 groupname : string | default="eks-workshop"
3838
3939 resources :
40- - id : podIdentityAssociation
41- template :
42- apiVersion : eks.services.k8s.aws/v1alpha1
43- kind : PodIdentityAssociation
44- metadata :
45- name : ${schema.spec.appName}
46- namespace : ${schema.spec.appName}
47- spec :
48- clusterName : " eks-workshop"
49- namespace : ${schema.spec.appName}
50- serviceAccount : ${schema.spec.appName}
51- roleARN : ${itemsTableIAMRole.status.ackResourceMetadata.arn}
40+ - id : podIdentityAssociation
41+ template :
42+ apiVersion : eks.services.k8s.aws/v1alpha1
43+ kind : PodIdentityAssociation
44+ metadata :
45+ name : ${schema.spec.appName}
46+ namespace : ${schema.spec.appName}
47+ spec :
48+ clusterName : " eks-workshop"
49+ namespace : ${schema.spec.appName}
50+ serviceAccount : ${schema.spec.appName}
51+ roleARN : ${itemsTableIAMRole.status.ackResourceMetadata.arn}
5252
53- - id : webApplication
54- template :
55- apiVersion : kro.run/v1alpha1
56- kind : WebApplication
57- metadata :
58- name : ${schema.spec.appName}
59- namespace : ${schema.spec.appName}
60- spec :
61- appName : ${schema.spec.appName}
62- replicas : 1
63- image : ${schema.spec.image}
64- port : 8080
65- healthcheck :
66- readinessPath : ${schema.spec.healthcheck.readinessPath}
67- readinessPort : ${schema.spec.healthcheck.readinessPort}
68- livenessPath : ${schema.spec.healthcheck.livenessPath}
69- livenessPort : ${schema.spec.healthcheck.livenessPort}
53+ - id : webApplication
54+ template :
55+ apiVersion : kro.run/v1alpha1
56+ kind : WebApplication
57+ metadata :
58+ name : ${schema.spec.appName}
59+ namespace : ${schema.spec.appName}
60+ spec :
61+ appName : ${schema.spec.appName}
62+ replicas : 1
63+ image : ${schema.spec.image}
64+ port : 8080
65+ healthcheck :
66+ readinessPath : ${schema.spec.healthcheck.readinessPath}
67+ readinessPort : ${schema.spec.healthcheck.readinessPort}
68+ livenessPath : ${schema.spec.healthcheck.livenessPath}
69+ livenessPort : ${schema.spec.healthcheck.livenessPort}
7070
71- service :
72- enabled : ${schema.spec.service.enabled}
73- iamRole : ${podIdentityAssociation.status.ackResourceMetadata.arn}
71+ service :
72+ enabled : ${schema.spec.service.enabled}
73+ iamRole : ${podIdentityAssociation.status.ackResourceMetadata.arn}
7474
75- env : ${schema.spec.env}
75+ env : ${schema.spec.env}
7676
77- ingress :
78- enabled : ${schema.spec.ingress.enabled}
79- path : ${schema.spec.ingress.path}
80- healthcheckPath : ${schema.spec.ingress.healthcheckPath}
81- groupname : ${schema.spec.ingress.groupname}
77+ ingress :
78+ enabled : ${schema.spec.ingress.enabled}
79+ path : ${schema.spec.ingress.path}
80+ healthcheckPath : ${schema.spec.ingress.healthcheckPath}
81+ groupname : ${schema.spec.ingress.groupname}
8282
83- - id : serviceDDB
84- template :
85- apiVersion : v1
86- kind : Service
87- metadata :
88- name : carts-dynamodb
89- labels :
90- app.kubernetes.io/created-by : eks-workshop
91- spec :
92- type : ClusterIP
93- ports :
94- - port : 8000
95- targetPort : dynamodb
96- protocol : TCP
97- name : dynamodb
98- selector :
99- app.kubernetes.io/name : ${schema.spec.appName}
100- app.kubernetes.io/instance : ${schema.spec.appName}
101- app.kubernetes.io/component : dynamodb
83+ - id : serviceDDB
84+ template :
85+ apiVersion : v1
86+ kind : Service
87+ metadata :
88+ name : carts-dynamodb
89+ labels :
90+ app.kubernetes.io/created-by : eks-workshop
91+ spec :
92+ type : ClusterIP
93+ ports :
94+ - port : 8000
95+ targetPort : dynamodb
96+ protocol : TCP
97+ name : dynamodb
98+ selector :
99+ app.kubernetes.io/name : ${schema.spec.appName}
100+ app.kubernetes.io/instance : ${schema.spec.appName}
101+ app.kubernetes.io/component : dynamodb
102102
103- - id : itemsTable
104- template :
105- apiVersion : dynamodb.services.k8s.aws/v1alpha1
106- kind : Table
107- metadata :
108- name : items
109- namespace : ${schema.spec.appName}
110- spec :
111- keySchema :
112- - attributeName : id
113- keyType : HASH
114- attributeDefinitions :
115- - attributeName : id
116- attributeType : " S"
117- - attributeName : customerId
118- attributeType : " S"
119- billingMode : PAY_PER_REQUEST
120- tableName : ${schema.spec.dynamodb.tableName}
121- globalSecondaryIndexes :
122- - indexName : idx_global_customerId
103+ - id : itemsTable
104+ template :
105+ apiVersion : dynamodb.services.k8s.aws/v1alpha1
106+ kind : Table
107+ metadata :
108+ name : items
109+ namespace : ${schema.spec.appName}
110+ spec :
123111 keySchema :
124- - attributeName : customerId
125- keyType : HASH
126- - attributeName : id
127- keyType : RANGE
128- projection :
129- projectionType : " ALL"
130- - id : itemsTableIamPolicy
131- template :
132- apiVersion : iam.services.k8s.aws/v1alpha1
133- kind : Policy
134- metadata :
135- name : ${itemsTable.spec.tableName}-iam-policy
136- spec :
137- name : ${itemsTable.spec.tableName}-iam-policy
138- description : " EKS Workshop Carts DynamoDB Policy"
139- policyDocument : >
140- {
141- "Version": "2012-10-17",
142- "Statement": [
143- {
144- "Sid": "AllAPIActionsOnCart",
145- "Effect": "Allow",
146- "Action": "dynamodb:*",
147- "Resource": [
148- "arn:aws:dynamodb:${schema.spec.aws.region}:${schema.spec.aws.accountID}:table/${itemsTable.spec.tableName}",
149- "arn:aws:dynamodb:${schema.spec.aws.region}:${schema.spec.aws.accountID}:table/${itemsTable.spec.tableName}/index/*"
150- ]
151- }
152- ]
153- }
154- - id : itemsTableIAMRole
155- template :
156- apiVersion : iam.services.k8s.aws/v1alpha1
157- kind : Role
158- metadata :
159- name : ${itemsTable.spec.tableName}-iam-role
160- namespace : ${schema.spec.appName}
161- spec :
162- name : ${itemsTable.spec.tableName}-iam-role
163- description : " EKS Workshop Carts DynamoDB Role"
164- maxSessionDuration : 3600
165- policies :
166- - ${itemsTableIamPolicy.status.ackResourceMetadata.arn}
167- assumeRolePolicyDocument : >
168- {
169- "Version":"2012-10-17",
170- "Statement": [{
171- "Effect":"Allow",
172- "Principal": {"Service": "pods.eks.amazonaws.com"},
173- "Action": [
174- "sts:TagSession",
175- "sts:AssumeRole"
112+ - attributeName : id
113+ keyType : HASH
114+ attributeDefinitions :
115+ - attributeName : id
116+ attributeType : " S"
117+ - attributeName : customerId
118+ attributeType : " S"
119+ billingMode : PAY_PER_REQUEST
120+ tableName : ${schema.spec.dynamodb.tableName}
121+ globalSecondaryIndexes :
122+ - indexName : idx_global_customerId
123+ keySchema :
124+ - attributeName : customerId
125+ keyType : HASH
126+ - attributeName : id
127+ keyType : RANGE
128+ projection :
129+ projectionType : " ALL"
130+ - id : itemsTableIamPolicy
131+ template :
132+ apiVersion : iam.services.k8s.aws/v1alpha1
133+ kind : Policy
134+ metadata :
135+ name : ${itemsTable.spec.tableName}-iam-policy
136+ spec :
137+ name : ${itemsTable.spec.tableName}-iam-policy
138+ description : " EKS Workshop Carts DynamoDB Policy"
139+ policyDocument : >
140+ {
141+ "Version": "2012-10-17",
142+ "Statement": [
143+ {
144+ "Sid": "AllAPIActionsOnCart",
145+ "Effect": "Allow",
146+ "Action": "dynamodb:*",
147+ "Resource": [
148+ "arn:aws:dynamodb:${schema.spec.aws.region}:${string(schema.spec.aws.accountID)}:table/${itemsTable.spec.tableName}",
149+ "arn:aws:dynamodb:${schema.spec.aws.region}:${string(schema.spec.aws.accountID)}:table/${itemsTable.spec.tableName}/index/*"
150+ ]
151+ }
176152 ]
177- }]
178- }
153+ }
154+ - id : itemsTableIAMRole
155+ template :
156+ apiVersion : iam.services.k8s.aws/v1alpha1
157+ kind : Role
158+ metadata :
159+ name : ${itemsTable.spec.tableName}-iam-role
160+ namespace : ${schema.spec.appName}
161+ spec :
162+ name : ${itemsTable.spec.tableName}-iam-role
163+ description : " EKS Workshop Carts DynamoDB Role"
164+ maxSessionDuration : 3600
165+ policies :
166+ - ${itemsTableIamPolicy.status.ackResourceMetadata.arn}
167+ assumeRolePolicyDocument : >
168+ {
169+ "Version":"2012-10-17",
170+ "Statement": [{
171+ "Effect":"Allow",
172+ "Principal": {"Service": "pods.eks.amazonaws.com"},
173+ "Action": [
174+ "sts:TagSession",
175+ "sts:AssumeRole"
176+ ]
177+ }]
178+ }
0 commit comments