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

Remove Migration Console API from ALB #924

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
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,6 @@ export function getMigrationStringParameterName(props: MigrationSSMConfig): stri
}

export enum MigrationSSMParameter {
MIGRATION_API_URL = 'albMigrationApiUrl',
MIGRATION_API_URL_ALIAS = 'albMigrationApiUrlAlias',
SOURCE_PROXY_URL = 'albSourceProxyUrl',
SOURCE_PROXY_URL_ALIAS = 'albSourceProxyUrlAlias',
TARGET_PROXY_URL = 'albTargetProxyUrl',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class NetworkStack extends Stack {
public readonly albSourceProxyTG: IApplicationTargetGroup;
public readonly albTargetProxyTG: IApplicationTargetGroup;
public readonly albSourceClusterTG: IApplicationTargetGroup;
public readonly albMigrationConsoleTG: IApplicationTargetGroup;
public readonly migrationConsoleTG: IApplicationTargetGroup;

// Validate a proper url string is provided and return an url string which contains a protocol, host name, and port.
// If a port is not provided, the default protocol port (e.g. 443, 80) will be explicitly added
Expand Down Expand Up @@ -139,7 +139,6 @@ export class NetworkStack extends Stack {

const needAlb = props.captureProxyServiceEnabled ||
props.elasticsearchServiceEnabled ||
props.migrationAPIEnabled ||
props.captureProxyESServiceEnabled ||
props.targetClusterProxyServiceEnabled;

Expand Down Expand Up @@ -191,14 +190,6 @@ export class NetworkStack extends Stack {
createALBListenerUrlParameter(9999, MigrationSSMParameter.SOURCE_CLUSTER_ENDPOINT);
}

// Setup when deploying migration console api on ecs
if (props.migrationAPIEnabled) {
this.albMigrationConsoleTG = this.createSecureTargetGroup('ALBMigrationConsole', props.stage, 8000, this.vpc);
this.createSecureListener('MigrationConsole', 8000, alb, cert, this.albMigrationConsoleTG);
createALBListenerUrlParameter(8000, MigrationSSMParameter.MIGRATION_API_URL);
createALBListenerUrlParameterAlias(8000, MigrationSSMParameter.MIGRATION_API_URL_ALIAS);
}

// Setup when deploying capture proxy in ECS
if (props.captureProxyServiceEnabled || props.captureProxyESServiceEnabled) {
this.albSourceProxyTG = this.createSecureTargetGroup('ALBSourceProxy', props.stage, 9200, this.vpc);
Expand Down Expand Up @@ -229,6 +220,11 @@ export class NetworkStack extends Stack {
}
}

// TG for Migration Console on ecs when migration API is enabled
if (props.migrationAPIEnabled) {
this.migrationConsoleTG = this.createSecureTargetGroup('MigrationConsole', props.stage, 8000, this.vpc);
}

// Create Source SSM Parameter
if (props.sourceClusterEndpoint) {
createMigrationStringParameter(this, props.sourceClusterEndpoint, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export class MigrationConsoleStack extends MigrationServiceCore {
}) : "";

const sharedLogFileSystem = new SharedLogFileSystem(this, props.stage, props.defaultDeployId);


const ecsClusterArn = `arn:${this.partition}:ecs:${this.region}:${this.account}:service/migration-${props.stage}-ecs-cluster`
const allReplayerServiceArn = `${ecsClusterArn}/migration-${props.stage}-traffic-replayer*`
Expand Down Expand Up @@ -236,7 +236,7 @@ export class MigrationConsoleStack extends MigrationServiceCore {
]
})

const getSecretsPolicy = props.servicesYaml.target_cluster.basic_auth?.password_from_secret_arn ?
const getSecretsPolicy = props.servicesYaml.target_cluster.basic_auth?.password_from_secret_arn ?
getTargetPasswordAccessPolicy(props.servicesYaml.target_cluster.basic_auth.password_from_secret_arn) : null;

// Upload the services.yaml file to Parameter Store
Expand Down Expand Up @@ -334,16 +334,6 @@ export class MigrationConsoleStack extends MigrationServiceCore {

const defaultAllowedHosts = 'localhost'
environment["API_ALLOWED_HOSTS"] = props.migrationAPIAllowedHosts ? `${defaultAllowedHosts},${props.migrationAPIAllowedHosts}` : defaultAllowedHosts
const migrationApiUrl = getMigrationStringParameterValue(this, {
...props,
parameter: MigrationSSMParameter.MIGRATION_API_URL
});
const migrationApiUrlAlias = getMigrationStringParameterValue(this, {
...props,
parameter: MigrationSSMParameter.MIGRATION_API_URL_ALIAS
});
environment["API_ALLOWED_HOSTS"] += migrationApiUrl ? `,${this.getHostname(migrationApiUrl)}` : ""
environment["API_ALLOWED_HOSTS"] += migrationApiUrlAlias ? `,${this.getHostname(migrationApiUrlAlias)}` : ""
}

if (props.migrationConsoleEnableOSI) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ export class StackComposer {
fetchMigrationEnabled: fetchMigrationEnabled,
migrationConsoleEnableOSI: migrationConsoleEnableOSI,
migrationAPIEnabled: migrationAPIEnabled,
targetGroups: [networkStack.albMigrationConsoleTG],
targetGroups: [networkStack.migrationConsoleTG],
servicesYaml: servicesYaml,
migrationAPIAllowedHosts: migrationAPIAllowedHosts,
sourceClusterDisabled,
Expand Down