Skip to content

Latest commit

 

History

History

infra

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Topo-Workflows Infrastructure

The infrastructure running the workflows is mainly based on a Kubernetes (AWS EKS) cluster and Argo Workflows.

Generally all Kubernetes resources are defined with cdk8s and anything that needs AWS interactions such as service accounts are defined with aws-cdk.

EKS Cluster / AWS CDK

The EKS Cluster base configuration is defined in ./cdk.ts using aws-cdk.

Kubernetes resources / CDK8s

The additional components (or Kubernetes resources) running on the EKS cluster are defined in ./cdk8s.ts using cdk8s.

Main entry point: app

Components

Deployments

Prerequisites

  • Helm

  • Ensure all dependencies are installed

    npm install
  • Login to AWS

Deploy CDK

To deploy with AWS CDK a few context values need to be set:

  • aws-account-id: Account ID to deploy into. This can be set with export CDK_DEFAULT_ACCOUNT="$(aws sts get-caller-identity --query Account --output text)".
  • maintainer-arns: Comma-separated list of AWS Role ARNs for the stack maintainers.

Then a deployment can be made with cdk:

ci_role="$(aws iam list-roles | jq --raw-output '.Roles[] | select(.RoleName | contains("CiTopo")) | select(.RoleName | contains("-CiRole")).Arn')"
admin_role="arn:aws:iam::$(aws sts get-caller-identity --query Account --output text):role/AccountAdminRole"
workflow_maintainer_role="$(aws cloudformation describe-stacks --stack-name=TopographicSharedResourcesProd | jq --raw-output .Stacks[0].Outputs[0].OutputValue)"
npx cdk deploy --context=maintainer-arns="${ci_role},${admin_role},${workflow_maintainer_role}" Workflows

Deploy CDK8s

Generate the kubernetes configuration yaml into dist/

npx cdk8s synth

Apply the generated yaml files

kubectl apply --filename=dist/

Testing

To debug use the following as cdk8s synth swallows the errors

npx tsx infra/cdk8s.ts

CICD Deployment

The deployment of the K8s config is managed by GithubActions in main.

Notes