Skip to content

Commit 8e2d0b0

Browse files
committed
Merge branch 'refs/heads/master' into feat/add-pdal-workflow-TDE-1649
2 parents a60508c + adc741b commit 8e2d0b0

32 files changed

Lines changed: 313 additions & 149 deletions

.github/workflows/main.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,26 +37,32 @@ jobs:
3737
if: ${{ github.ref == 'refs/heads/master' }}
3838
environment:
3939
name: prod
40+
4041
permissions:
4142
id-token: write
4243
contents: read
44+
4345
env:
4446
CLUSTER_NAME: Workflows
47+
4548
steps:
4649
- uses: linz/action-typescript@9bf69b0f313b3525d3ba3116f26b1aff7eb7a6c0 # v3.1.0
4750
with:
4851
node-version: 20.x
52+
4953
# Configure access to AWS / EKS
5054
- name: Setup kubectl
5155
uses: azure/setup-kubectl@3e0aec4d80787158d308d7b364cb1b702e7feb7f # v3
5256
with:
5357
version: 'latest'
58+
5459
- name: AWS Configure
5560
uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4
5661
with:
5762
aws-region: ap-southeast-2
5863
mask-aws-account-id: true
5964
role-to-assume: ${{ secrets.AWS_CI_ROLE }}
65+
6066
- name: Find Changes in Infra
6167
id: get-infra-changes
6268
run: |
@@ -66,31 +72,39 @@ jobs:
6672
else
6773
echo "run_infra=false" >> "$GITHUB_OUTPUT"
6874
fi
75+
6976
- name: (CDK) Deploy
7077
if: steps.get-infra-changes.outputs.run_infra == 'true'
7178
run: |
7279
npx cdk deploy ${{ env.CLUSTER_NAME }} \
73-
-c maintainer-arns=${{ secrets.AWS_CI_ROLE }},${{ secrets.AWS_ADMIN_ROLE }},${{ secrets.AWS_WFMAINTAINER_ROLE }} \
80+
-c maintainer-arns=${{ secrets.AWS_CI_ROLE }},${{ secrets.AWS_ADMIN_ROLE }},${{ secrets.AWS_ADMIN_SSO_ROLE }},${{ secrets.AWS_WFMAINTAINER_ROLE }} \
7481
-c aws-account-id=${{ secrets.AWS_ACCOUNT_ID }} \
7582
--require-approval never
83+
env:
84+
NODE_ENV: production
85+
7686
- name: Login to EKS
7787
run: |
7888
aws eks update-kubeconfig --name ${{ env.CLUSTER_NAME }} --region ap-southeast-2
89+
7990
- name: Check EKS connection
8091
run: |
8192
kubectl get nodes
93+
8294
# Configure the Kubernetes cluster with CDK8s
8395
- name: (CDK8s) Synth
8496
if: steps.get-infra-changes.outputs.run_infra == 'true'
8597
run: |
8698
npx cdk8s synth
8799
# nb: kubectl diff - is somewhat dangerous as it dumps out secrets in plain text
88100
# so it should not be used in this pipeline
101+
89102
# TODO use a --prune and --applyset to remove unused objects
90103
- name: (CDK8s) Deploy
91104
if: steps.get-infra-changes.outputs.run_infra == 'true'
92105
run: |
93106
kubectl apply -f dist/
107+
94108
- name: Deploy workflows
95109
if: github.ref == 'refs/heads/master'
96110
run: |
@@ -118,12 +132,14 @@ jobs:
118132
for cwf in $CRON_WORKFLOWS; do
119133
kubectl apply -f "$cwf" --namespace argo
120134
done
135+
121136
- name: Install Argo
122137
if: steps.get-infra-changes.outputs.run_infra == 'true'
123138
run: |
124139
curl --location --remote-name --silent "${{ env.ARGO_URL }}"
125140
gunzip argo-linux-amd64.gz
126141
chmod +x argo-linux-amd64
142+
127143
- name: Smoke test
128144
if: steps.get-infra-changes.outputs.run_infra == 'true'
129145
run: |

infra/cdk.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { applyTags, SecurityClassification } from '@linzjs/cdk-tags';
12
import { App } from 'aws-cdk-lib';
23

34
import { ClusterName, DefaultRegion } from './constants.js';
@@ -22,7 +23,7 @@ async function main(): Promise<void> {
2223
throw new Error("Missing AWS Account information, set with either '-c aws-account-id' or $CDK_DEFAULT_ACCOUNT");
2324
}
2425

25-
new LinzEksCluster(app, ClusterName, {
26+
const cluster = new LinzEksCluster(app, ClusterName, {
2627
env: { region: DefaultRegion, account: accountId },
2728
maintainerRoleArns,
2829
slackChannelConfigurationName: ssmConfig.slackChannelConfigurationName,
@@ -31,6 +32,15 @@ async function main(): Promise<void> {
3132
s3BatchRestoreRoleArn: ssmConfig.s3BatchRestoreRoleArn,
3233
});
3334

35+
applyTags(cluster, {
36+
application: 'argo',
37+
environment: process.env['NODE_ENV'] === 'production' ? 'prod' : 'nonprod',
38+
group: 'li',
39+
impact: 'moderate',
40+
classification: SecurityClassification.Unclassified,
41+
responderTeam: 'LI - Geospatial Data Engineering',
42+
});
43+
3444
app.synth();
3545
}
3646

infra/eks/cluster.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,13 @@ export class LinzEksCluster extends Stack {
154154
for (const roleArn of props.maintainerRoleArns) {
155155
const roleId = `MaintainerRole-${createHash('sha256').update(roleArn).digest('hex').slice(0, 12)}`;
156156
const role = Role.fromRoleArn(this, roleId, roleArn, { defaultPolicyName: this.stackName });
157-
role.addToPrincipalPolicy(
158-
new iam.PolicyStatement({ actions: ['eks:DescribeCluster'], resources: [this.cluster.clusterArn] }),
159-
);
157+
if (!roleArn.includes('AWSReservedSSO_')) {
158+
role.addToPrincipalPolicy(
159+
new iam.PolicyStatement({ actions: ['eks:DescribeCluster'], resources: [this.cluster.clusterArn] }),
160+
);
161+
} else {
162+
console.warn(`Skipping policy attachment for SSO-managed role: ${roleArn}`);
163+
}
160164
this.cluster.awsAuth.addMastersRole(role);
161165
}
162166

0 commit comments

Comments
 (0)