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

feat(opensearch-vectorindex): replace docker-based custom resource with typescript #583

Conversation

cagataycali
Copy link
Contributor

feat(opensearch-vectorindex): replace docker-based custom resource with typescript implementation

  • remove docker dependency for opensearch vector index creation
  • implement typescript-based lambda function for index management
  • add support for configurable vector search parameters
  • enhance vectorindex construct with new optional properties
  • update custom resource provider to use bundled typescript code
  • improve error handling and logging in lambda function
  • wip: further testing and integration required

Fixes #567 #566


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.

…th typescript implementation

- remove docker dependency for opensearch vector index creation
- implement typescript-based lambda function for index management
- add support for configurable vector search parameters
- enhance vectorindex construct with new optional properties
- update custom resource provider to use bundled typescript code
- improve error handling and logging in lambda function
- wip: further testing and integration required
@cagataycali cagataycali changed the title [draft] feat(opensearch-vectorindex): replace docker-based custom resource with typescript feat(opensearch-vectorindex): replace docker-based custom resource with typescript Jul 26, 2024
runtime: lambda.Runtime.PYTHON_3_12,
__dirname, '../../../lambda/opensearch-serverless-custom-resources/index.ts'),
handler: 'handler',
runtime: lambda.Runtime.NODEJS_18_X,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using latest AWS Lambda runtime?

Suggested change
runtime: lambda.Runtime.NODEJS_18_X,
runtime: lambda.Runtime.NODEJS_20_X,

@krokoko
Copy link
Collaborator

krokoko commented Aug 14, 2024

Cannot get this to build and run. Tested a different approach by updating the custom-resource-provider-helper to use

const pathToBuildFile = codePath+'/build.js';
        const pathToOutputFile = codePath;
        const handler = 'index.handler';

        const commandThatIsRanDuringCdkSynth = ['node', pathToBuildFile];
        const code = lambda.Code.fromCustomCommand(
          pathToOutputFile,
          commandThatIsRanDuringCdkSynth,
        );
        
        customResourceFunction = new lambdanode.NodejsFunction(this, 'CustomResourcesFunction', {
          code: code,
          handler,
          runtime,
          role: this.role,
          timeout: cdk.Duration.minutes(15),
          memorySize: 128,
          vpc,
          vpcSubnets: vpc ? { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS } : undefined,
          securityGroups: vpc && securityGroup ? [securityGroup] : undefined,
          logRetention: logs.RetentionDays.ONE_WEEK,
          description: 'Custom Resource Provider',
        });

And have the original files in the folder to invoke the custom build script

@krokoko
Copy link
Collaborator

krokoko commented Aug 14, 2024

Update:
Locally it is building and passing tests.

  • Failing on mutation as the esbuild step is changing the content of index.js Thanks @scottschreckengaust
  • Tested with a sample stack to deploy a kb with oss and getting an error:
image

Copy link
Contributor

This pull request is now marked as stale because it hasn't seen activity for a while. Add a comment or it will be closed soon. If you wish to exclude this issue from being marked as stale, add the "backlog" label.

@github-actions github-actions bot added the stale label Sep 10, 2024
Copy link
Contributor

Closing this pull request as it hasn't seen activity for a while. Please add a comment @mentioning a maintainer to reopen. If you wish to exclude this issue from being marked as stale, add the "backlog" label.

@github-actions github-actions bot closed this Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Removing Docker build dependency from build phase
4 participants