-
Notifications
You must be signed in to change notification settings - Fork 32
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 elasticsearch from default capture proxy base image #1061
Remove elasticsearch from default capture proxy base image #1061
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1061 +/- ##
============================================
+ Coverage 80.16% 80.19% +0.02%
- Complexity 2744 2863 +119
============================================
Files 367 383 +16
Lines 13743 14333 +590
Branches 949 988 +39
============================================
+ Hits 11017 11494 +477
- Misses 2149 2245 +96
- Partials 577 594 +17
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
adf072e
to
704f424
Compare
…ild improvements Signed-off-by: Andre Kurait <[email protected]>
81abe7e
to
4777117
Compare
Signed-off-by: Andre Kurait <[email protected]>
08cb381
to
0a4c8c9
Compare
Signed-off-by: Andre Kurait <[email protected]>
Signed-off-by: Andre Kurait <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for refactoring some of this, left some comments
deployment/cdk/opensearch-service-migration/lib/common-utilities.ts
Outdated
Show resolved
Hide resolved
* @param {string} imageName - The name of the Docker image to use as the base image. | ||
* @returns {ContainerImage} - A `ContainerImage` object representing the Docker image asset. | ||
*/ | ||
export function makeDockerImageAsset(scope: Construct, serviceName: string, imageName: string): ContainerImage { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this much better than what existed previously? I guess it has the added benefit of not potentially rebuilding intermediary layers in our image, but does seem to subtly introduce a new wrapper layer that we are pushing to ECR. This is probably a good trade but curious if you had other thoughts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other benefit here is that we're not depending on the build output directory anymore. I don't know of any functional difference with the wrapper layer being here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just an alias, right? Please rename the function & explain why we need an alias.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated, this is an alias, but it also pulls the image locally. This will add it to a private ECR instead of pulling on container start potentially from an outside source (which can add costly nat gateway bills)
Signed-off-by: Andre Kurait <[email protected]>
b76a164
to
5c3d165
Compare
TrafficCapture/dockerSolution/src/main/docker/captureProxyBase/Dockerfile
Outdated
Show resolved
Hide resolved
TrafficCapture/dockerSolution/src/main/docker/captureProxyBase/Dockerfile
Outdated
Show resolved
Hide resolved
def javaContainerServices = [ | ||
":TrafficCapture:trafficCaptureProxyServerTest": "jmeter" | ||
"jmeter": ":TrafficCapture:trafficCaptureProxyServerTest" | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should really just kill this thing or figure out how to rig a valuable test with it (I'm fine yanking it until we do)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call this something other than jmeter since it's pulling one of our packages in too?
Thanks for noticing that they were flipped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is published under migrations/jmeter
, can we keep this in this PR since this is an existing feature and we can make a separate one to review regarding removing it. I'd like to get more maintainers input on that.
deployment/cdk/opensearch-service-migration/lib/service-stacks/migration-service-core.ts
Outdated
Show resolved
Hide resolved
deployment/cdk/opensearch-service-migration/lib/common-utilities.ts
Outdated
Show resolved
Hide resolved
* @param {string} imageName - The name of the Docker image to use as the base image. | ||
* @returns {ContainerImage} - A `ContainerImage` object representing the Docker image asset. | ||
*/ | ||
export function makeDockerImageAsset(scope: Construct, serviceName: string, imageName: string): ContainerImage { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just an alias, right? Please rename the function & explain why we need an alias.
@@ -313,7 +313,7 @@ export class MigrationConsoleStack extends MigrationServiceCore { | |||
|
|||
this.createService({ | |||
serviceName: "migration-console", | |||
dockerDirectoryPath: join(__dirname, "../../../../../", "TrafficCapture/dockerSolution/src/main/docker/migrationConsole"), | |||
dockerImageRegistryName: "migrations/migration_console:latest", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome! This saves a big headache in an upcoming refactor!
Signed-off-by: Andre Kurait <[email protected]>
Signed-off-by: Andre Kurait <[email protected]>
Signed-off-by: Andre Kurait <[email protected]>
Signed-off-by: Andre Kurait <[email protected]>
Signed-off-by: Andre Kurait <[email protected]>
29968f2
to
715b17e
Compare
Signed-off-by: Andre Kurait <[email protected]>
image=$(docker images --format '{{.Repository}}:{{.Tag}}' | head -n 1) | ||
echo "Using image for mocked tags: $image" | ||
docker tag $image migrations/capture_proxy:latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the idea of using a mock image tag that resolves to a valid version of the image for potentially one image and for all others it resolves to some other equally valid image. If you need mock values, can you just hard code them? What are you trying to test here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolves to a valid version of the image for potentially one image
This is not the case, this github step doesn't have any built images so this is using the default node
docker image for all the tags.
This is verifying the cdk maps to these images and properly synthesizes with docker.
@@ -144,6 +144,6 @@ tasks.named('composeUp') { | |||
} | |||
|
|||
tasks.named('slowTest') { | |||
dependsOn(':TrafficCapture:dockerSolution:buildDockerImage_elasticsearchTestConsole') | |||
dependsOn(':TrafficCapture:dockerSolution:buildDockerImage_elasticsearch_client_test_console') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit because it's style, but I miss the camel casing. The '' that was previously used was for effect to separate the auto-generated part from the task name. Other than that underscore, none of the other tasks in the tree use it (AFAIK).
Take a look at the gradle CLI on task names - w/ camel case (or kebab-case), you can do abbreviations like agradle :TC:DS:BDI_M
- you can still put snake-case as that example shows, but it's a bit clunkier. I'd also be happy if we swapped the "buildDockerImage" prefix for an "Image" suffix or just a "build" prefix.
@@ -25,7 +25,7 @@ services: | |||
- migrations | |||
ports: | |||
- "9200:9200" | |||
command: /runJavaWithClasspath.sh org.opensearch.migrations.trafficcapture.proxyserver.CaptureProxy --kafkaConnection kafka:9092 --destinationUri https://elasticsearch:9200 --insecureDestination --listenPort 9200 --sslConfigFile /usr/share/elasticsearch/config/proxy_tls.yml --otelCollectorEndpoint http://otel-collector:4317 | |||
command: /runJavaWithClasspath.sh org.opensearch.migrations.trafficcapture.proxyserver.CaptureProxy --kafkaConnection kafka:9092 --destinationUri https://elasticsearch:9200 --insecureDestination --listenPort 9200 --sslConfigFile /usr/share/captureProxy/config/proxy_tls.yml --otelCollectorEndpoint http://otel-collector:4317 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this line work? I'm not sure that it does since the capture_proxy_es builds off of elasticsearch + searchguard & I don't see any changes to that dockerfile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have tests for both proxy containers w/ & w/out TLS enabled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is without elastic
capture-proxy:
image: 'migrations/capture_proxy:latest'
networks:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of our current testing has TLS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shoot - sorry, there was a collapse bar between this & the previous snippet!
@@ -25,7 +25,7 @@ services: | |||
- migrations | |||
ports: | |||
- "9200:9200" | |||
command: /runJavaWithClasspath.sh org.opensearch.migrations.trafficcapture.proxyserver.CaptureProxy --kafkaConnection kafka:9092 --destinationUri https://elasticsearch:9200 --insecureDestination --listenPort 9200 --sslConfigFile /usr/share/elasticsearch/config/proxy_tls.yml --otelCollectorEndpoint http://otel-collector:4317 | |||
command: /runJavaWithClasspath.sh org.opensearch.migrations.trafficcapture.proxyserver.CaptureProxy --kafkaConnection kafka:9092 --destinationUri https://elasticsearch:9200 --insecureDestination --listenPort 9200 --sslConfigFile /usr/share/captureProxy/config/proxy_tls.yml --otelCollectorEndpoint http://otel-collector:4317 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shoot - sorry, there was a collapse bar between this & the previous snippet!
Description
Currently, the capture proxy container image builds on the es base image. This is not needed for running the capture proxy independently. This change modifies this base image to use AL2023.
This change uses a multi-staged build to generate the certs with openssl without including it in the final image.
Other Changes:
Issues Resolved
https://opensearch.atlassian.net/browse/MIGRATIONS-2078
Is this a backport? If so, please add backport PR # and/or commits #
Testing
Local docker/gradle testing, cdk deploy in aws
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.