From de72f762a77b971cd20683fcd6d0ed8bfd10c082 Mon Sep 17 00:00:00 2001 From: Andre Kurait Date: Tue, 15 Oct 2024 15:15:07 -0500 Subject: [PATCH] Address PR Comments Signed-off-by: Andre Kurait --- .github/workflows/CI.yml | 10 ++++ TrafficCapture/dockerSolution/build.gradle | 53 +++++++++---------- .../main/docker/captureProxyBase/Dockerfile | 6 +-- .../build.gradle | 10 ++-- .../src/main/docker/docker-compose.yml | 2 +- .../migrations/common/CommonUtils.groovy | 15 ++++-- .../cdk.context.json | 40 +++++++------- .../lib/common-utilities.ts | 19 ++++--- .../service-stacks/capture-proxy-es-stack.ts | 2 +- .../lib/service-stacks/capture-proxy-stack.ts | 2 +- .../lib/service-stacks/elasticsearch-stack.ts | 2 +- .../lib/service-stacks/kafka-stack.ts | 2 +- .../service-stacks/migration-console-stack.ts | 2 +- .../service-stacks/migration-service-core.ts | 6 +-- .../opensearch-container-stack.ts | 2 +- .../reindex-from-snapshot-stack.ts | 2 +- .../service-stacks/traffic-replayer-stack.ts | 2 +- .../test/migration-console-stack.test.ts | 1 - .../test/migration-services-yaml.test.ts | 1 - .../test/network-stack.test.ts | 1 - .../test/opensearch-domain-stack.test.ts | 1 - .../test/reindex-from-snapshot-stack.test.ts | 1 - .../test/stack-composer-ordering.test.ts | 1 - .../test/stack-composer.test.ts | 1 - 24 files changed, 95 insertions(+), 89 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 7aff2f351..7a106f8be 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -200,6 +200,16 @@ jobs: node-version: ${{ env.node-version }} - name: Install NPM dependencies run: npm ci + - name: Mock Docker Images for CDK Tests + run: docker images && docker pull alpine && \ + docker tag alpine migrations/capture_proxy:latest && \ + docker tag alpine migrations/capture_proxy_es:latest && \ + docker tag alpine opensearchproject/opensearch:2 && \ + docker tag alpine migrations/elasticsearch_searchguard:latest && \ + docker tag alpine docker.io/apache/kafka:3.7.0 && \ + docker tag alpine migrations/migration_console:latest && \ + docker tag alpine migrations/reindex_from_snapshot:latest && \ + docker tag alpine migrations/traffic_replayer:latest - name: Run CDK Jest Tests run: npm test diff --git a/TrafficCapture/dockerSolution/build.gradle b/TrafficCapture/dockerSolution/build.gradle index ed13ea60d..d2a87a3da 100644 --- a/TrafficCapture/dockerSolution/build.gradle +++ b/TrafficCapture/dockerSolution/build.gradle @@ -7,10 +7,6 @@ plugins { import org.opensearch.migrations.common.CommonUtils import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage -def calculateDockerHash = { projectName -> - CommonUtils.calculateDockerHash(project.fileTree("src/main/docker/${projectName}")) -} - dependencies { constraints { implementation('software.amazon.awssdk:secretsmanager:2.25.19') { @@ -20,17 +16,16 @@ dependencies { } def dockerFilesForExternalServices = [ - "elasticsearchWithSearchGuard": "elasticsearch_searchguard", - "captureProxyBase": "capture_proxy_base", - "elasticsearchTestConsole": "elasticsearch_client_test_console", - "migrationConsole": "migration_console", - "otelCollector": "otel_collector", + "elasticsearch_searchguard": "elasticsearchWithSearchGuard", + "capture_proxy_base": "captureProxyBase", + "elasticsearch_client_test_console": "elasticsearchTestConsole", + "migration_console": "migrationConsole", + "otel_collector": "otelCollector", "grafana": "grafana" ] - -dockerFilesForExternalServices.each { projectName, dockerImageName -> +dockerFilesForExternalServices.each { dockerImageName, projectName -> def escapedProjectName = projectName; - task("buildDockerImage_${escapedProjectName}", type: DockerBuildImage) { + task("buildDockerImage_${dockerImageName}", type: DockerBuildImage) { if (escapedProjectName == "migrationConsole") { def libraries = [ project(":libraries:kafkaCommandLineFormatter") @@ -52,28 +47,28 @@ dockerFilesForExternalServices.each { projectName, dockerImageName -> } } -static def Sync getMigrationConsoleSyncTask(Project project, String dockerImageName, String escapedProjectName, List libraries, List applications) { +static Sync getMigrationConsoleSyncTask(Project project, String dockerImageName, String escapedProjectName, List libraries, List applications) { // Create a single sync task to copy the required files def destDir = "build/docker/${dockerImageName}_${escapedProjectName}" def syncTask = project.tasks.create("syncArtifact_${dockerImageName}_${escapedProjectName}", Sync) { into destDir duplicatesStrategy = DuplicatesStrategy.EXCLUDE - // Copy libraries - (libraries + applications).each { libProject -> - def applicationDestDir = "staging/${libProject.name}/" - from (libProject.configurations.findByName("runtimeClasspath").files) { + // Applications and Standalone Libraries both have libraries + (libraries + applications).each { lib -> + def applicationDestDir = "staging/${lib.name}/" + from (lib.configurations.findByName("runtimeClasspath").files) { into "${applicationDestDir}/lib" } - from (libProject.tasks.getByName('jar')) { + from (lib.tasks.getByName('jar')) { into "${applicationDestDir}/lib" } } // Copy applications - applications.each { appProject -> - def applicationDestDir = "staging/${appProject.name}/" - from (appProject.tasks.getByName('startScripts').outputs.files) { + applications.each { app -> + def applicationDestDir = "staging/${app.name}/" + from (app.tasks.getByName('startScripts').outputs.files) { into "${applicationDestDir}/bin" } } @@ -87,7 +82,7 @@ static def Sync getMigrationConsoleSyncTask(Project project, String dockerImageN syncTask.dependsOn assembleTasks // Migration Console base image is the test console - syncTask.dependsOn "buildDockerImage_elasticsearchTestConsole" + syncTask.dependsOn "buildDockerImage_elasticsearch_client_test_console" return syncTask } @@ -97,14 +92,14 @@ def javaContainerServices = [ "capture_proxy_es": ":TrafficCapture:trafficCaptureProxyServer", "traffic_replayer": ":TrafficCapture:trafficReplayer" ] -def baseImageProjectOverrides = [ - "capture_proxy": "captureProxyBase", - "capture_proxy_es": "elasticsearchWithSearchGuard", +def baseImageOverrides = [ + "capture_proxy": "capture_proxy_base", + "capture_proxy_es": "elasticsearch_searchguard", ] javaContainerServices.each { dockerImageName, projectName -> def artifactProject = project(projectName); CommonUtils.copyArtifactFromProjectToProjectsDockerStaging(project as Project, artifactProject, dockerImageName) - CommonUtils.createDockerfile(project, artifactProject, baseImageProjectOverrides[dockerImageName], dockerFilesForExternalServices, dockerImageName) + CommonUtils.createDockerfile(project, artifactProject, baseImageOverrides[dockerImageName], dockerFilesForExternalServices, dockerImageName) } javaContainerServices.forEach { dockerImageName, projectName -> @@ -130,9 +125,9 @@ dockerCompose { } task buildDockerImages { - dependsOn buildDockerImage_elasticsearchWithSearchGuard - dependsOn buildDockerImage_migrationConsole - dependsOn buildDockerImage_otelCollector + dependsOn buildDockerImage_elasticsearch_searchguard + dependsOn buildDockerImage_migration_console + dependsOn buildDockerImage_otel_collector dependsOn buildDockerImage_grafana dependsOn buildDockerImage_traffic_replayer dependsOn buildDockerImage_capture_proxy diff --git a/TrafficCapture/dockerSolution/src/main/docker/captureProxyBase/Dockerfile b/TrafficCapture/dockerSolution/src/main/docker/captureProxyBase/Dockerfile index 15ce1bcf2..2ae9630fe 100644 --- a/TrafficCapture/dockerSolution/src/main/docker/captureProxyBase/Dockerfile +++ b/TrafficCapture/dockerSolution/src/main/docker/captureProxyBase/Dockerfile @@ -48,11 +48,7 @@ ENV SEARCHGUARD_CERTS_DIR=$ES_HOME/config # The elasticsearch.yml and proxy_tls.yml files are configured to work seamlessly with the Search Guard plugin and TLS settings. # Add base elasticsearch.yml content -RUN echo 'searchguard.ssl.transport.pemcert_filepath: esnode.pem' >> $ELASTIC_SEARCH_CONFIG_FILE && \ - echo 'searchguard.ssl.transport.pemkey_filepath: esnode-key.pem' >> $ELASTIC_SEARCH_CONFIG_FILE && \ - echo 'searchguard.ssl.transport.pemtrustedcas_filepath: root-ca.pem' >> $ELASTIC_SEARCH_CONFIG_FILE && \ - echo 'searchguard.ssl.transport.enforce_hostname_verification: false' >> $ELASTIC_SEARCH_CONFIG_FILE && \ - echo 'searchguard.ssl.http.enabled: true' >> $ELASTIC_SEARCH_CONFIG_FILE && \ +RUN echo 'searchguard.ssl.http.enabled: true' >> $ELASTIC_SEARCH_CONFIG_FILE && \ echo 'searchguard.ssl.http.pemcert_filepath: esnode.pem' >> $ELASTIC_SEARCH_CONFIG_FILE && \ echo 'searchguard.ssl.http.pemkey_filepath: esnode-key.pem' >> $ELASTIC_SEARCH_CONFIG_FILE && \ echo 'searchguard.ssl.http.pemtrustedcas_filepath: root-ca.pem' >> $ELASTIC_SEARCH_CONFIG_FILE diff --git a/TrafficCapture/trafficCaptureProxyServerTest/build.gradle b/TrafficCapture/trafficCaptureProxyServerTest/build.gradle index 45409f94f..6a876b852 100644 --- a/TrafficCapture/trafficCaptureProxyServerTest/build.gradle +++ b/TrafficCapture/trafficCaptureProxyServerTest/build.gradle @@ -43,12 +43,12 @@ configurations { def dockerFilesForExternalServices = [ - "nginx": "nginx-perf-test-webserver" + "nginx_perf_test_webserver": "nginx" ] // Create the static docker files that aren't hosting migrations java code from this repo -dockerFilesForExternalServices.each { projectName, dockerImageName -> - task("buildDockerImage_${projectName}", type: DockerBuildImage) { +dockerFilesForExternalServices.each { dockerImageName, projectName -> + task("buildDockerImage_${dockerImageName}", type: DockerBuildImage) { def hash = calculateDockerHash(projectName) images.add("migrations/${dockerImageName}:$hash") images.add("migrations/${dockerImageName}:latest") @@ -60,7 +60,7 @@ def javaContainerServices = [ "jmeter": ":TrafficCapture:trafficCaptureProxyServerTest" ] def baseImageProjectOverrides = [ - "nginx": "nginx-perf-test-webserver" + "nginx": "nginx_perf_test_webserver" ] def createContainerTasks = { dockerImageName, projectName -> @@ -88,7 +88,7 @@ dockerCompose { task buildDockerImages { dependsOn ':TrafficCapture:dockerSolution:buildDockerImage_capture_proxy' - dependsOn buildDockerImage_nginx + dependsOn buildDockerImage_nginx_perf_test_webserver dependsOn buildDockerImage_jmeter } diff --git a/TrafficCapture/trafficCaptureProxyServerTest/src/main/docker/docker-compose.yml b/TrafficCapture/trafficCaptureProxyServerTest/src/main/docker/docker-compose.yml index bc96938e6..7ac2139bb 100644 --- a/TrafficCapture/trafficCaptureProxyServerTest/src/main/docker/docker-compose.yml +++ b/TrafficCapture/trafficCaptureProxyServerTest/src/main/docker/docker-compose.yml @@ -1,7 +1,7 @@ version: '3.7' services: webserver: - image: 'migrations/nginx-perf-test-webserver:latest' + image: 'migrations/nginx_perf_test_webserver:latest' networks: - testing ports: diff --git a/buildSrc/src/main/groovy/org/opensearch/migrations/common/CommonUtils.groovy b/buildSrc/src/main/groovy/org/opensearch/migrations/common/CommonUtils.groovy index 79e077bf6..97f66becf 100644 --- a/buildSrc/src/main/groovy/org/opensearch/migrations/common/CommonUtils.groovy +++ b/buildSrc/src/main/groovy/org/opensearch/migrations/common/CommonUtils.groovy @@ -1,5 +1,6 @@ package org.opensearch.migrations.common +import org.gradle.api.GradleException import org.gradle.api.tasks.Sync import org.gradle.api.Project import com.bmuschko.gradle.docker.tasks.image.Dockerfile @@ -54,10 +55,16 @@ class CommonUtils { destFile = dockerBuildProject.file("${dockerBuildDir}/Dockerfile") dependsOn "copyArtifact_${dockerImageName}" if (baseImageProjectOverride) { - def dependentDockerImageName = dockerFilesForExternalServices.get(baseImageProjectOverride) - def hashNonce = CommonUtils.calculateDockerHash( - dockerBuildProject.fileTree("src/main/docker/${baseImageProjectOverride}")) - from "migrations/${dependentDockerImageName}:${hashNonce}" + def dependentDockerImageProjectName = dockerFilesForExternalServices.get(baseImageProjectOverride) + if (dependentDockerImageProjectName == null) { + throw new GradleException("Unexpected baseImageOverride " + baseImageProjectOverride) + } + def dockerFileTree = dockerBuildProject.fileTree("src/main/docker/${dependentDockerImageProjectName}") + if (!dockerFileTree.files) { + throw new GradleException("File tree for ${dependentDockerImageProjectName} does not exist or is empty") + } + def hashNonce = CommonUtils.calculateDockerHash(dockerFileTree) + from "migrations/${baseImageProjectOverride}:${hashNonce}" def dependencyName = "buildDockerImage_${baseImageProjectOverride}"; dependsOn dependencyName if (baseImageProjectOverride.startsWith("elasticsearch")) { diff --git a/deployment/cdk/opensearch-service-migration/cdk.context.json b/deployment/cdk/opensearch-service-migration/cdk.context.json index f12dc6647..20a0f7c8d 100644 --- a/deployment/cdk/opensearch-service-migration/cdk.context.json +++ b/deployment/cdk/opensearch-service-migration/cdk.context.json @@ -1,31 +1,33 @@ { "default": { - "stage": "test-stage", + "stage": "", "targetCluster": { - "endpoint": "https://target-cluster.com:443", + "endpoint": "", "auth": { - "type": "none" + "type": "none | basic | sigv4", + "// basic auth documentation": "The next two lines are releavant for basic auth only", + "username": "", + "passwordFromSecretArn": "", + "// sigv4 documentation": "The next two lines are releavant for sigv4 only", + "region": "", + "serviceSigningName": "es | aoss" } }, "sourceCluster": { - "endpoint": "https://source-cluster.com:443", + "endpoint": "", "auth": { - "type": "none" + "type": "none | basic | sigv4", + "// basic auth documentation": "The next two lines are releavant for basic auth only", + "username": "", + "passwordFromSecretArn": "", + "// sigv4 documentation": "The next two lines are releavant for sigv4 only", + "region": "", + "serviceSigningName": "es | aoss" } }, + "vpcId": "", "reindexFromSnapshotServiceEnabled": true, "reindexFromSnapshotMaxShardSizeGiB": 80, - "migrationAssistanceEnabled": true, - "migrationConsoleServiceEnabled": true, - "otelCollectorEnabled": true, - "targetClusterProxyServiceEnabled": true - }, - "availability-zones:account=767398060394:region=us-east-1": [ - "us-east-1a", - "us-east-1b", - "us-east-1c", - "us-east-1d", - "us-east-1e", - "us-east-1f" - ] -} + "trafficReplayerServiceEnabled": true + } +} \ No newline at end of file diff --git a/deployment/cdk/opensearch-service-migration/lib/common-utilities.ts b/deployment/cdk/opensearch-service-migration/lib/common-utilities.ts index 5e7ed49fc..193e4e0de 100644 --- a/deployment/cdk/opensearch-service-migration/lib/common-utilities.ts +++ b/deployment/cdk/opensearch-service-migration/lib/common-utilities.ts @@ -440,16 +440,20 @@ export function isRegionGovCloud(region: string): boolean { return region.startsWith('us-gov-'); } + /** - * Creates a Docker image asset from the specified image name. + * Creates a Local Docker image asset from the specified image name. * - * This function creates a Docker image asset from the specified image name. - * It can use a local or remote image. + * This allows us to create a private ECR repo for any image allowing us to have a consistent + * experience across VPCs and regions (e.g. running within VPC in gov-cloud with no internet access) + * + * This works by creating a temp Dockerfile with only the FROM with the param imageName and + * using that Dockerfile with cdk.assets to create a local Docker image asset. * - * @param {string} imageName - The name of the Docker image to use as the base image. + * @param {string} imageName - The name of the Docker image to save as a tarball and use in CDK. * @returns {ContainerImage} - A `ContainerImage` object representing the Docker image asset. */ -export function makeDockerImageAsset(scope: Construct, serviceName: string, imageName: string): ContainerImage { +export function makeLocalAssetContainerImage(scope: Construct, imageName: string): ContainerImage { const sanitizedImageName = imageName.replace(/[^a-zA-Z0-9-_]/g, '_'); const tempDir = mkdtempSync(join(tmpdir(), 'docker-build-' + sanitizedImageName)); const dockerfilePath = join(tempDir, 'Dockerfile'); @@ -457,9 +461,8 @@ export function makeDockerImageAsset(scope: Construct, serviceName: string, imag FROM ${imageName} `; writeFileSync(dockerfilePath, dockerfileContent); - const asset = new DockerImageAsset(scope, serviceName + 'Image', { + const asset = new DockerImageAsset(scope, 'ServiceImage', { directory: tempDir, }); return ContainerImage.fromDockerImageAsset(asset); -} - +} \ No newline at end of file diff --git a/deployment/cdk/opensearch-service-migration/lib/service-stacks/capture-proxy-es-stack.ts b/deployment/cdk/opensearch-service-migration/lib/service-stacks/capture-proxy-es-stack.ts index d1eb9efa4..780bf509b 100644 --- a/deployment/cdk/opensearch-service-migration/lib/service-stacks/capture-proxy-es-stack.ts +++ b/deployment/cdk/opensearch-service-migration/lib/service-stacks/capture-proxy-es-stack.ts @@ -81,7 +81,7 @@ export class CaptureProxyESStack extends MigrationServiceCore { this.createService({ serviceName: "capture-proxy-es", - dockerImageRegistryName: "migrations/capture_proxy_es:latest", + dockerImageName: "migrations/capture_proxy_es:latest", dockerImageCommand: ['/bin/sh', '-c', command.concat(" & wait -n 1")], securityGroups: securityGroups, taskRolePolicies: servicePolicies, diff --git a/deployment/cdk/opensearch-service-migration/lib/service-stacks/capture-proxy-stack.ts b/deployment/cdk/opensearch-service-migration/lib/service-stacks/capture-proxy-stack.ts index ef1b45466..36d000e11 100644 --- a/deployment/cdk/opensearch-service-migration/lib/service-stacks/capture-proxy-stack.ts +++ b/deployment/cdk/opensearch-service-migration/lib/service-stacks/capture-proxy-stack.ts @@ -140,7 +140,7 @@ export class CaptureProxyStack extends MigrationServiceCore { this.createService({ serviceName: serviceName, - dockerImageRegistryName: "migrations/capture_proxy:latest", + dockerImageName: "migrations/capture_proxy:latest", dockerImageCommand: ['/bin/sh', '-c', command], securityGroups: securityGroups, taskRolePolicies: servicePolicies, diff --git a/deployment/cdk/opensearch-service-migration/lib/service-stacks/elasticsearch-stack.ts b/deployment/cdk/opensearch-service-migration/lib/service-stacks/elasticsearch-stack.ts index ca5a714a7..f2265e27f 100644 --- a/deployment/cdk/opensearch-service-migration/lib/service-stacks/elasticsearch-stack.ts +++ b/deployment/cdk/opensearch-service-migration/lib/service-stacks/elasticsearch-stack.ts @@ -39,7 +39,7 @@ export class ElasticsearchStack extends MigrationServiceCore { this.createService({ serviceName: "elasticsearch", - dockerImageRegistryName: "migrations/elasticsearch_searchguard:latest", + dockerImageName: "migrations/elasticsearch_searchguard:latest", securityGroups: securityGroups, portMappings: [servicePort], cpuArchitecture: props.fargateCpuArch, diff --git a/deployment/cdk/opensearch-service-migration/lib/service-stacks/kafka-stack.ts b/deployment/cdk/opensearch-service-migration/lib/service-stacks/kafka-stack.ts index 819538e15..2dfee8639 100644 --- a/deployment/cdk/opensearch-service-migration/lib/service-stacks/kafka-stack.ts +++ b/deployment/cdk/opensearch-service-migration/lib/service-stacks/kafka-stack.ts @@ -42,7 +42,7 @@ export class KafkaStack extends MigrationServiceCore { }); this.createService({ serviceName: "kafka", - dockerImageRegistryName: "docker.io/apache/kafka:3.7.0", + dockerImageName: "docker.io/apache/kafka:3.7.0", securityGroups: securityGroups, // see https://github.com/apache/kafka/blob/3.7/docker/examples/jvm/single-node/plaintext/docker-compose.yml environment: { diff --git a/deployment/cdk/opensearch-service-migration/lib/service-stacks/migration-console-stack.ts b/deployment/cdk/opensearch-service-migration/lib/service-stacks/migration-console-stack.ts index 5ca6493de..7fdc6c990 100644 --- a/deployment/cdk/opensearch-service-migration/lib/service-stacks/migration-console-stack.ts +++ b/deployment/cdk/opensearch-service-migration/lib/service-stacks/migration-console-stack.ts @@ -313,7 +313,7 @@ export class MigrationConsoleStack extends MigrationServiceCore { this.createService({ serviceName: "migration-console", - dockerImageRegistryName: "migrations/migration_console:latest", + dockerImageName: "migrations/migration_console:latest", securityGroups: securityGroups, portMappings: servicePortMappings, dockerImageCommand: imageCommand, diff --git a/deployment/cdk/opensearch-service-migration/lib/service-stacks/migration-service-core.ts b/deployment/cdk/opensearch-service-migration/lib/service-stacks/migration-service-core.ts index bd063da1c..1cb760b20 100644 --- a/deployment/cdk/opensearch-service-migration/lib/service-stacks/migration-service-core.ts +++ b/deployment/cdk/opensearch-service-migration/lib/service-stacks/migration-service-core.ts @@ -18,7 +18,7 @@ import { import {Duration, RemovalPolicy, Stack} from "aws-cdk-lib"; import {LogGroup, RetentionDays} from "aws-cdk-lib/aws-logs"; import {PolicyStatement, Role} from "aws-cdk-lib/aws-iam"; -import {createDefaultECSTaskRole, makeDockerImageAsset} from "../common-utilities"; +import {createDefaultECSTaskRole, makeLocalAssetContainerImage} from "../common-utilities"; import {OtelCollectorSidecar} from "./migration-otel-collector-sidecar"; import { IApplicationTargetGroup, INetworkTargetGroup } from "aws-cdk-lib/aws-elasticloadbalancingv2"; @@ -28,7 +28,7 @@ export interface MigrationServiceCoreProps extends StackPropsExt { readonly vpc: IVpc, readonly securityGroups: ISecurityGroup[], readonly cpuArchitecture: CpuArchitecture, - readonly dockerImageRegistryName: string, + readonly dockerImageName: string, readonly dockerImageCommand?: string[], readonly taskRolePolicies?: PolicyStatement[], readonly mountPoints?: MountPoint[], @@ -76,7 +76,7 @@ export class MigrationServiceCore extends Stack { props.volumes.forEach(vol => serviceTaskDef.addVolume(vol)) } - const serviceImage = makeDockerImageAsset(this, props.serviceName, props.dockerImageRegistryName) + const serviceImage = makeLocalAssetContainerImage(this, props.dockerImageName) const serviceLogGroup = new LogGroup(this, 'ServiceLogGroup', { retention: RetentionDays.ONE_MONTH, diff --git a/deployment/cdk/opensearch-service-migration/lib/service-stacks/opensearch-container-stack.ts b/deployment/cdk/opensearch-service-migration/lib/service-stacks/opensearch-container-stack.ts index 530c0be8a..f8ba5a823 100644 --- a/deployment/cdk/opensearch-service-migration/lib/service-stacks/opensearch-container-stack.ts +++ b/deployment/cdk/opensearch-service-migration/lib/service-stacks/opensearch-container-stack.ts @@ -83,7 +83,7 @@ export class OpenSearchContainerStack extends MigrationServiceCore { this.createService({ serviceName: dnsNameForContainer, - dockerImageRegistryName: "opensearchproject/opensearch:2", + dockerImageName: "opensearchproject/opensearch:2", securityGroups: securityGroups, environment: { "cluster.name": "os-docker-cluster", diff --git a/deployment/cdk/opensearch-service-migration/lib/service-stacks/reindex-from-snapshot-stack.ts b/deployment/cdk/opensearch-service-migration/lib/service-stacks/reindex-from-snapshot-stack.ts index 5947ce9f9..0a172252c 100644 --- a/deployment/cdk/opensearch-service-migration/lib/service-stacks/reindex-from-snapshot-stack.ts +++ b/deployment/cdk/opensearch-service-migration/lib/service-stacks/reindex-from-snapshot-stack.ts @@ -167,7 +167,7 @@ export class ReindexFromSnapshotStack extends MigrationServiceCore { this.createService({ serviceName: 'reindex-from-snapshot', taskInstanceCount: 0, - dockerImageRegistryName: "migrations/reindex_from_snapshot:latest", + dockerImageName: "migrations/reindex_from_snapshot:latest", dockerImageCommand: ['/bin/sh', '-c', "/rfs-app/entrypoint.sh"], securityGroups: securityGroups, volumes: volumes, diff --git a/deployment/cdk/opensearch-service-migration/lib/service-stacks/traffic-replayer-stack.ts b/deployment/cdk/opensearch-service-migration/lib/service-stacks/traffic-replayer-stack.ts index 9dbab37d6..362263b6b 100644 --- a/deployment/cdk/opensearch-service-migration/lib/service-stacks/traffic-replayer-stack.ts +++ b/deployment/cdk/opensearch-service-migration/lib/service-stacks/traffic-replayer-stack.ts @@ -128,7 +128,7 @@ export class TrafficReplayerStack extends MigrationServiceCore { this.createService({ serviceName: `traffic-replayer-${deployId}`, taskInstanceCount: 0, - dockerImageRegistryName: "migrations/traffic_replayer:latest", + dockerImageName: "migrations/traffic_replayer:latest", dockerImageCommand: ['/bin/sh', '-c', command], securityGroups: securityGroups, volumes: [sharedLogFileSystem.asVolume()], diff --git a/deployment/cdk/opensearch-service-migration/test/migration-console-stack.test.ts b/deployment/cdk/opensearch-service-migration/test/migration-console-stack.test.ts index 8f3a952f2..00c8c85c8 100644 --- a/deployment/cdk/opensearch-service-migration/test/migration-console-stack.test.ts +++ b/deployment/cdk/opensearch-service-migration/test/migration-console-stack.test.ts @@ -5,7 +5,6 @@ import {ContainerImage} from "aws-cdk-lib/aws-ecs"; import {describe, beforeEach, afterEach, test, expect, jest} from '@jest/globals'; import {ReindexFromSnapshotStack} from "../lib"; -jest.mock('aws-cdk-lib/aws-ecr-assets'); describe('Migration Console Stack Tests', () => { // Mock the implementation of fromDockerImageAsset before all tests beforeEach(() => { diff --git a/deployment/cdk/opensearch-service-migration/test/migration-services-yaml.test.ts b/deployment/cdk/opensearch-service-migration/test/migration-services-yaml.test.ts index 784ada0cd..d1c37d328 100644 --- a/deployment/cdk/opensearch-service-migration/test/migration-services-yaml.test.ts +++ b/deployment/cdk/opensearch-service-migration/test/migration-services-yaml.test.ts @@ -7,7 +7,6 @@ import {createStackComposer} from "./test-utils"; import * as yaml from 'yaml'; import {describe, afterEach, beforeEach, test, expect, jest} from '@jest/globals'; -jest.mock('aws-cdk-lib/aws-ecr-assets'); describe('Migration Services YAML Tests', () => { beforeEach(() => { jest.spyOn(ContainerImage, 'fromDockerImageAsset').mockImplementation(() => ContainerImage.fromRegistry("ServiceImage")); diff --git a/deployment/cdk/opensearch-service-migration/test/network-stack.test.ts b/deployment/cdk/opensearch-service-migration/test/network-stack.test.ts index 61e996406..e6c75d710 100644 --- a/deployment/cdk/opensearch-service-migration/test/network-stack.test.ts +++ b/deployment/cdk/opensearch-service-migration/test/network-stack.test.ts @@ -7,7 +7,6 @@ import { describe, beforeEach, afterEach, test, expect, jest } from '@jest/globa import { GatewayVpcEndpointAwsService, InterfaceVpcEndpointAwsService } from "aws-cdk-lib/aws-ec2"; import { Stack } from "aws-cdk-lib"; -jest.mock('aws-cdk-lib/aws-ecr-assets'); function getExpectedEndpoints(networkStack: NetworkStack): (InterfaceVpcEndpointAwsService | GatewayVpcEndpointAwsService)[] { return [ diff --git a/deployment/cdk/opensearch-service-migration/test/opensearch-domain-stack.test.ts b/deployment/cdk/opensearch-service-migration/test/opensearch-domain-stack.test.ts index 79f57c088..85070b651 100644 --- a/deployment/cdk/opensearch-service-migration/test/opensearch-domain-stack.test.ts +++ b/deployment/cdk/opensearch-service-migration/test/opensearch-domain-stack.test.ts @@ -6,7 +6,6 @@ import { ClusterYaml } from '../lib/migration-services-yaml'; import { ContainerImage } from "aws-cdk-lib/aws-ecs"; import { describe, beforeEach, afterEach, test, expect, jest} from '@jest/globals'; -jest.mock('aws-cdk-lib/aws-ecr-assets'); describe('OpenSearch Domain Stack Tests', () => { beforeEach(() => { jest.spyOn(ContainerImage, 'fromDockerImageAsset').mockImplementation(() => ContainerImage.fromRegistry("ServiceImage")); diff --git a/deployment/cdk/opensearch-service-migration/test/reindex-from-snapshot-stack.test.ts b/deployment/cdk/opensearch-service-migration/test/reindex-from-snapshot-stack.test.ts index 4f74b2ba7..68c645993 100644 --- a/deployment/cdk/opensearch-service-migration/test/reindex-from-snapshot-stack.test.ts +++ b/deployment/cdk/opensearch-service-migration/test/reindex-from-snapshot-stack.test.ts @@ -5,7 +5,6 @@ import { ReindexFromSnapshotStack } from '../lib/service-stacks/reindex-from-sna import { createStackComposer } from './test-utils'; import { describe, beforeEach, afterEach, test, expect, jest } from '@jest/globals'; -jest.mock('aws-cdk-lib/aws-ecr-assets'); describe('ReindexFromSnapshotStack Tests', () => { beforeEach(() => { diff --git a/deployment/cdk/opensearch-service-migration/test/stack-composer-ordering.test.ts b/deployment/cdk/opensearch-service-migration/test/stack-composer-ordering.test.ts index 29def817e..db0424492 100644 --- a/deployment/cdk/opensearch-service-migration/test/stack-composer-ordering.test.ts +++ b/deployment/cdk/opensearch-service-migration/test/stack-composer-ordering.test.ts @@ -11,7 +11,6 @@ import {OpenSearchContainerStack} from "../lib/service-stacks/opensearch-contain import {ReindexFromSnapshotStack} from "../lib/service-stacks/reindex-from-snapshot-stack"; import {describe, beforeEach, afterEach, test, expect, jest} from '@jest/globals'; -jest.mock('aws-cdk-lib/aws-ecr-assets'); describe('Stack Composer Ordering Tests', () => { beforeEach(() => { jest.spyOn(ContainerImage, 'fromDockerImageAsset').mockImplementation(() => ContainerImage.fromRegistry("ServiceImage")); diff --git a/deployment/cdk/opensearch-service-migration/test/stack-composer.test.ts b/deployment/cdk/opensearch-service-migration/test/stack-composer.test.ts index c3ff6c34c..65002d981 100644 --- a/deployment/cdk/opensearch-service-migration/test/stack-composer.test.ts +++ b/deployment/cdk/opensearch-service-migration/test/stack-composer.test.ts @@ -7,7 +7,6 @@ import { KafkaStack } from "../lib"; import { describe, beforeEach, afterEach, test, expect, jest } from '@jest/globals'; import { ContainerImage } from "aws-cdk-lib/aws-ecs"; -jest.mock('aws-cdk-lib/aws-ecr-assets'); describe('Stack Composer Tests', () => { beforeEach(() => { jest.spyOn(ContainerImage, 'fromDockerImageAsset').mockImplementation(() => ContainerImage.fromRegistry("ServiceImage"));