aws-quickstart / cdk-eks-blueprints

AWS Quick Start Team
Apache License 2.0
430 stars 190 forks source link

EKS-Blueprint as Service Catalog Product #979

Open thpham opened 2 months ago

thpham commented 2 months ago

Describe the feature

I'm investigating how to use this cdk-eks-blueprints stack builder with AWS Service Catalog.

Use Case

Allow my organization to provision on-demand EKS product from a catalog portfolio, based on a standardized EKS blueprint.

Proposed Solution

No response

Other Information

Any example or hints would be very much appreciated !

Acknowledgements

CDK version used

2.133

EKS Blueprints Version

1.14.1

Node.js Version

v20.12.0

Environment details (OS name and version, etc.)

macos 14.4.1

thpham commented 2 months ago

Hello @elamaran11 or @shapirov103 ! Any hints how to resolve or implement the feature request based on current status ? I might be able to help given your recommendations !

I'm checking internally with my company if I can share access to the code of my PoC to highlight a bit more the challenge I'm facing.

But roughly, I'm able to use the synthesized stack to deploy an EKS cluster, as normal. But I'm not able to used the synthesized deployment assets to be associated with a service catalog product. So that it could be used later on to provision the product from the portfolio.

image
thpham commented 2 months ago

btw, an other challenge I'm facing is the various orphan left over resources when I'm destroying this EKS cloudformation stack (.ie ACK created resources, alb/nlb+their security groups, volumes...) => which makes the cdk destroy fails and requires manual cleanup. Any hints how to have potential custom cdk destroy hooks instruction (through a lambda?) to remove them as well ?

shapirov103 commented 2 months ago

@thpham we can potentially look into creating service catalog product/portfolio automatically from CDK. E.g. https://catalog.us-east-1.prod.workshops.aws/workshops/d40750d7-a330-49be-9945-cde864610de9/en-US/4-builders-devs/sc-cdk

thpham commented 2 months ago

Thank you. I already reached that point and tried the integration with a service catalog product. Sorry, I'm pretty new with CDK, my interpretation might be stupid, but as far I understood, the blueprints.EksBlueprint.builder()...build(...) creates a CFN stack, instead, with another function, would it be possible to just return an higher order Construct to be instantiated then in a extended ProductStack class ?

shapirov103 commented 2 months ago

would it be possible to just return an higher order Construct to be instantiated then in a extended ProductStack class ?

Yes,it is possible and requires refactoring of the existing codebase. That means

  1. Moving existing functionality of the EKSBlueprint stack to a common class (generic).
  2. Existing EKSBlueprint class extends the new common class.
  3. We create a new EKSBlueprintProduct class that extends ProductStack.
  4. We create a builder or add a function to the existing builder like buildProductStack that returns the product stack.

Probably easier said than done. I can take a stab on a branch and we can use it as a feature dev branch.

thpham commented 2 months ago

Probably easier said than done. I can take a stab on a branch and we can use it as a feature dev branch.

OK, that would be very much appreciated, even a small draft with the classes, and then I could try to integrate, continue further and test.

thpham commented 2 weeks ago

I made good progress, but I had to re-implement the eks-blueprint-stack.ts like this: https://gist.github.com/thpham/49fbc437f3e08de6702acf473320ef00