aws-controllers-k8s / community

AWS Controllers for Kubernetes (ACK) is a project enabling you to manage AWS services from Kubernetes
https://aws-controllers-k8s.github.io/community/
Apache License 2.0
2.44k stars 258 forks source link

EC2 Template ( creation/modify) using EC2 controller. #1841

Open rkurduka opened 1 year ago

rkurduka commented 1 year ago

Is your feature request related to a problem?

During large scale migration (on-prem to cloud) using AWS MGN (AWS application migration service) , EC2 - Launch template is used to spin up servers across multiple accounts , one of the common problem that we see , is to update/multiple templates across multiple accounts from single source .

https://docs.aws.amazon.com/mgn/latest/ug/ec2-launch.html

Same challenge is with AWS DRS service as well , which is used to perform DR actions on multiple AWS accounts https://docs.aws.amazon.com/drs/latest/userguide/ec2-launch.html

Describe the solution you'd like If we able to update/modify 100's of EC2 templates from any kubernetes cluster like Kind, Minikube, EKS , that will really help to speed up the migration process.

Describe alternatives you've considered Python boto3 is usually common choice to update these templates .

rkurduka commented 1 year ago

I am working on it

rkurduka commented 1 year ago

Hello All, i am trying to contribute to project by creating ec2- Launchtemplate and Launchtemplateversions as resources , i am able to create/delete Launchtemplates , but while creating Launchtemplateversions , resource keep getting into terminal condition with message - "Resource already exist and To bring the resource under ACK management, you should explicitly adopt the resource by creating a services.k8s.aws/AdoptedResource" , even though original Launchtemplate created by ACK . Also i noticed that "ko" objects values are properly getting assigned in SDKFIND function , and function return resource successfully , but SDKCREATE function never gets called . i am missing something any help will be really helpful

a-hilaly commented 1 year ago

When controller A creates a resource X, and you subsequentlly delete the cluster, resource X will only exist on AWS and no longer in etcd. If you attempt to recreate resource X in a new cluster, the controller will raise an error because the resource already exists in AWS. To address this, if you want the controller to manage an already existing resource in AWS, you should utilize "AdoptedResource."

As an alternative, you have two options to handle this situation:

gecube commented 1 year ago

Hi! Thanks for your efforts. I am also struggling because of absence of InstanceTemplate objects.

rkurduka commented 1 year ago

@gecube @a-hilaly yea , i also see need for it . just putting current progress here on this,

I am able to create launchtemplate and its versions as well and even able to delete resources as well from K8s and AWS , but only problem i see now or i am trying to figure out is how to change default version of launch template as it is not "SPEC" field but "Status" field on launch template . And it is "input" field in "modify launch template" API call.

Once i figure this out maybe i will be ready to raise pull request , will keep you posted ,

here is latest on this , if any one wants to give a try

https://github.com/rkurduka/ec2-controller/tree/ec2-launch-template

ack-bot commented 10 months ago

Issues go stale after 180d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 60d of inactivity and eventually close. If this issue is safe to close now please do so with /close. Provide feedback via https://github.com/aws-controllers-k8s/community. /lifecycle stale

ack-bot commented 4 months ago

Issues go stale after 180d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 60d of inactivity and eventually close. If this issue is safe to close now please do so with /close. Provide feedback via https://github.com/aws-controllers-k8s/community. /lifecycle stale

gecube commented 4 months ago

/remove-lifecycle stale