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

new resource ec2launch template and test caes #151

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

rkurduka
Copy link

Issue #, if available:
1841

Description of changes:

New resource added - LaunchTemplate
Test cases added.

Features:

  1. Create new EC2 launch template
  2. Delete existing EC2 launch template

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ack-prow ack-prow bot requested review from a-hilaly and jljaco September 20, 2023 14:48
@ack-prow ack-prow bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Sep 20, 2023
@ack-prow
Copy link

ack-prow bot commented Sep 20, 2023

Hi @rkurduka. Thanks for your PR.

I'm waiting for a aws-controllers-k8s member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@a-hilaly
Copy link
Member

/ok-to-test

@ack-prow ack-prow bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 20, 2023
Copy link
Member

@a-hilaly a-hilaly left a comment

Choose a reason for hiding this comment

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

Good stuff, thank you @rkurduka ! I left few comments in-line

apis/v1alpha1/ack-generate-metadata.yaml Outdated Show resolved Hide resolved
cmd/controller/controller Outdated Show resolved Hide resolved
config/controller/deployment.yaml Outdated Show resolved Hide resolved
apis/v1alpha1/launch_template.go Outdated Show resolved Hide resolved
apis/v1alpha1/launch_template.go Outdated Show resolved Hide resolved
test/e2e/resources/launchtemplate_invalid.yaml Outdated Show resolved Hide resolved
test/e2e/tests/test_launch_template.py Outdated Show resolved Hide resolved
test/e2e/tests/test_launch_template.py Outdated Show resolved Hide resolved
# Validate LaunchTemplate
launch_template = ec2_validator.get_launch_template(resource_id)
assert launch_template["LaunchTemplateId"] == resource_id

Copy link
Member

Choose a reason for hiding this comment

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

can we also add an update test?

Copy link
Author

Choose a reason for hiding this comment

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

To update launch template only one parameter is supported in "ModifyLaunchTemplate" SDK API call.

  1. DefaultVersionNumber -- for this to test , there has to be multiple "launchtemplateversions" must be available and "launchtemplateversion" is separate resource in EC2. So once we have that , so we can add update test case here for it.

Note:
update tags is not supported "ModifyLaunchTemplate" SDK API call , which is used in SDKUPDATE function, hence not added update test case yet .

Copy link
Member

Choose a reason for hiding this comment

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

Great, thanks for the clearance! We could support add some hooks to call CreateTags/UpdateTags for the Spec.Tags field?
If i understand well, this funciton can be used with any ec2 resource? https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateTags.html

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

Yes , looking into this

Copy link
Author

Choose a reason for hiding this comment

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

added tags -creation/update logic , including test cases for it as well .

test/e2e/tests/test_launch_template.py Outdated Show resolved Hide resolved
@rkurduka
Copy link
Author

fixed - conflicts

@rkurduka rkurduka reopened this Sep 25, 2023
@ack-prow
Copy link

ack-prow bot commented Sep 25, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: rkurduka
Once this PR has been reviewed and has the lgtm label, please assign jljaco for approval by writing /assign @jljaco in a comment. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

1 similar comment
@ack-prow
Copy link

ack-prow bot commented Sep 25, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: rkurduka
Once this PR has been reviewed and has the lgtm label, please assign jljaco for approval by writing /assign @jljaco in a comment. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Member

@a-hilaly a-hilaly left a comment

Choose a reason for hiding this comment

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

Very nice!! Thank you @rkurduka !

I have few comments/questions bellow.

helm/Chart.yaml Outdated Show resolved Hide resolved
func (rm *resourceManager) setDefaultTemplateVersion(r *resource, input *svcsdk.ModifyLaunchTemplateInput) error {

if r.ko.Spec.DefaultVersionNumber != nil {
input.SetDefaultVersion(strconv.Itoa(int(*r.ko.Spec.DefaultVersionNumber)))
Copy link
Member

Choose a reason for hiding this comment

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

So the API accept an int the create but a string in the update... wow

Copy link
Author

Choose a reason for hiding this comment

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

In "CreateLaunchTemplate" we dont need to provide "DefaultTemplateVersion" - but once it is created. In "DescribeLaunchTemplateOutput" Its *int64 , So while modifying same attribute in ModifyLaunchTemplate its *string , hence conversion is require

# Validate LaunchTemplate
launch_template = ec2_validator.get_launch_template(resource_id)
assert launch_template["LaunchTemplateId"] == resource_id

Copy link
Member

Choose a reason for hiding this comment

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

Great, thanks for the clearance! We could support add some hooks to call CreateTags/UpdateTags for the Spec.Tags field?
If i understand well, this funciton can be used with any ec2 resource? https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateTags.html

# Check LaunchTemplate no longer exists in AWS
ec2_validator.assert_launch_template(resource_id, exists=False)

def test_terminal_condition_invalid_parameter_value(self):
Copy link
Member

Choose a reason for hiding this comment

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

Awesome!

# Validate LaunchTemplate
launch_template = ec2_validator.get_launch_template(resource_id)
assert launch_template["LaunchTemplateId"] == resource_id

Copy link
Member

Choose a reason for hiding this comment

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

@ack-bot
Copy link
Collaborator

ack-bot commented Mar 29, 2024

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-prow ack-prow bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 29, 2024
@a-hilaly a-hilaly removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 15, 2024
@kejne
Copy link
Contributor

kejne commented Jun 27, 2024

Is there anything particular blocking this PR from being merged, other than having a merge conflict after having been stale for 6m?

@kejne
Copy link
Contributor

kejne commented Jun 28, 2024

@rkurduka ok if i cherry pick your changes to keep working on the changes you started so we can get this functionality in?

@a-hilaly
Copy link
Member

a-hilaly commented Jul 2, 2024

@kejne please go for it :)

Copy link

ack-prow bot commented Aug 30, 2024

@rkurduka: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ec2-verify-attribution 04807c5 link true /test ec2-verify-attribution

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@a-hilaly
Copy link
Member

a-hilaly commented Sep 5, 2024

@kejne are you still thinking of picking up this PR?

@kejne
Copy link
Contributor

kejne commented Sep 5, 2024

I'm afraid other projects fit our use case better, so haven't looked further into it.

@a-hilaly
Copy link
Member

a-hilaly commented Sep 5, 2024

@kejne no worries :) may I ask what projects are you using to workaround this and manage launch templates?

@kejne
Copy link
Contributor

kejne commented Sep 5, 2024

It wasn't really just about Launch Templates, but more of the whole. For example, since we will be leveraging multiple cloud providers we are leaning more towards Crossplane atm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test Indicates a non-member PR verified by an org member that is safe to test.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants