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

refactor: store default region in const #508

Merged
merged 2 commits into from
Apr 17, 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
4 changes: 2 additions & 2 deletions infra/cdk.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { App } from 'aws-cdk-lib';

import { ClusterName } from './constants.js';
import { ClusterName, DefaultRegion } from './constants.js';
import { tryGetContextArns } from './eks/arn.js';
import { LinzEksCluster } from './eks/cluster.js';
import { fetchSsmParameters } from './util/ssm.js';
Expand All @@ -22,7 +22,7 @@ async function main(): Promise<void> {
}

new LinzEksCluster(app, ClusterName, {
env: { region: 'ap-southeast-2', account: accountId },
env: { region: DefaultRegion, account: accountId },
maintainerRoleArns,
slackChannelConfigurationName: slackSsmConfig.slackChannelConfigurationName,
slackWorkspaceId: slackSsmConfig.slackWorkspaceId,
Expand Down
4 changes: 2 additions & 2 deletions infra/charts/argo.workflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Chart, ChartProps, Duration, Helm } from 'cdk8s';
import { Secret } from 'cdk8s-plus-27';
import { Construct } from 'constructs';

import { ArgoDbName, ArgoDbUser } from '../constants.js';
import { ArgoDbName, ArgoDbUser, DefaultRegion } from '../constants.js';
import { applyDefaultLabels } from '../util/labels.js';

export interface ArgoWorkflowsProps {
Expand Down Expand Up @@ -65,7 +65,7 @@ export class ArgoWorkflows extends Chart {
bucket: props.tempBucketName,
keyFormat:
'{{workflow.creationTimestamp.Y}}-{{workflow.creationTimestamp.m}}/{{workflow.creationTimestamp.d}}-{{workflow.name}}/{{pod.name}}',
region: 'ap-southeast-2',
region: DefaultRegion,
endpoint: 's3.amazonaws.com',
useSDKCreds: true,
insecure: false,
Expand Down
5 changes: 3 additions & 2 deletions infra/charts/fluentbit.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Chart, ChartProps, Helm } from 'cdk8s';
import { Construct } from 'constructs';

import { DefaultRegion } from '../constants.js';
import { applyDefaultLabels } from '../util/labels.js';

/**
Expand Down Expand Up @@ -73,9 +74,9 @@ HC_Period 5
serviceAccount: { name: props.saName, create: false },
cloudWatchLogs: {
enabled: true,
region: 'ap-southeast-2',
region: DefaultRegion,
/** Specify Cloudwatch endpoint to add a trailing `.` to force FQDN DNS request */
endpoint: 'logs.ap-southeast-2.amazonaws.com.',
endpoint: `logs.${DefaultRegion}.amazonaws.com.`,
autoCreateGroup: true,
logRetentionDays: 30,
logGroupName: `/aws/eks/${props.clusterName}/logs`,
Expand Down
14 changes: 8 additions & 6 deletions infra/constants.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
/* Cluster name */
/** Cluster name */
export const ClusterName = 'Workflows';
/* LINZ conventional name for Argo Workflows artifact bucket */
/** LINZ conventional name for Argo Workflows artifact bucket */
export const ScratchBucketName = `linz-${ClusterName.toLowerCase()}-scratch`;
/* Argo Database Instance name */
/** Argo Database Instance name */
export const ArgoDbInstanceName = 'ArgoDb';
/* Argo Database name */
/** Argo Database name */
export const ArgoDbName = 'argo';
/* Argo Database user */
/** Argo Database user */
export const ArgoDbUser = 'argo_user';
/** AWS default region for our stack */
export const DefaultRegion = 'ap-southeast-2';

/**
* Should NodeLocal DNS be enabled for the cluster
Expand All @@ -16,7 +18,7 @@ export const ArgoDbUser = 'argo_user';
*/
export const UseNodeLocalDns = true;

/* CloudFormation Output to access from CDK8s */
/** CloudFormation Output to access from CDK8s */
export const CfnOutputKeys = {
ClusterEndpoint: 'ClusterEndpoint',

Expand Down
Loading