-
Notifications
You must be signed in to change notification settings - Fork 53
feat: new resource - LaunchTemplate #255
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: new resource - LaunchTemplate #255
Conversation
c42abc5
to
c739883
Compare
/retest |
f7ac8eb
to
ac413db
Compare
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 @michaelhtm ! some comments inline
return err | ||
} | ||
|
||
for _, elem := range resp.LaunchTemplateVersions { |
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 think function can be generated using custom templates and sdk_file_end
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.
putting setResourceForLaunchTemplateData there since that's the setter with the most LOC
} | ||
var resp *svcsdk.DescribeLaunchTemplatesOutput | ||
resp, err = rm.sdkapi.DescribeLaunchTemplates(ctx, input) | ||
rm.metrics.RecordAPICall("READ_MANY", "DescribeLaunchTemplates", err) |
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 want make the DescribeLaunchVersion
here instead?
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'm not opposed to it..
DefaultVersion: | ||
from: | ||
operation: ModifyLaunchTemplate | ||
path: LaunchTemplate.DefaultVersionNumber |
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.
Can we make this field a string instead? i like integer, but looks like the api takes a string, maybe cause they support non integer versions?
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.
There's only one use case where it's used as a string...the rest of the time it's a number..
The Create API returns a string, while the ModifyLaunchTemplate
accepts a string
// TODO (michaelhtm) Not sure if we should check if | ||
// the defaultVersion is greater than latestVersion | ||
// | ||
// My proposal would be to return a terminal error | ||
// since the launchTemplate's latestVersion will never | ||
// increase intil we make updates...˘\\/(ヅ)\/˘˘ | ||
// if *desired.ko.Spec.DefaultVersion > *latest.ko.Status.LatestVersion { | ||
// return ackerr.NewTerminalError(fmt.Errorf("desired version number is ahead of the latest version")) | ||
// } |
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 like it.
27c2335
to
3c8e066
Compare
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.
adding thoughts..
LatestVersion *int64 `json:"latestVersion,omitempty"` | ||
// The entity that manages the launch template. | ||
// +kubebuilder:validation:Optional | ||
Operator *OperatorResponse `json:"operator,omitempty"` |
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 believe this field does not make sense for kubernetes..if another entity is managing this launchTemplate, we might encounter diffs whenever the entity makes changes
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.
shall we remove it?
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.
it's not affecting anything significant since it's in the status..so idk
// +kubebuilder:validation:Required | ||
Data *RequestLaunchTemplateData `json:"data"` | ||
// The version number of the default version of the launch template. | ||
DefaultVersion *int64 `json:"defaultVersion,omitempty"` |
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.
Having DefaultVersion in the spec is risky, and a one way decision. We need to discuss this before merging..
Currently, when a launchTemplate is created, and later updated, the DefaultVersion will no longer be matching the data in the spec. This may not be ideal IMO.
If we put the defaultVersion in the status, we can start ignoring the latestVersion there and combine them both into one field called Version.
This Version will reflect the data in the spec, and with every update, we can call the APIs necessary to Create a new version with the latest data, ensure that version is the defaultVersion, delete the older version.
Thoughts?
return err | ||
} | ||
|
||
for _, elem := range resp.LaunchTemplateVersions { |
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.
putting setResourceForLaunchTemplateData there since that's the setter with the most LOC
5229cca
to
5c88415
Compare
/retest |
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 @michaelhtm ! i left a couple questions below
templates/hooks/launch_template/sdk_update_pre_build_request.go.tpl
Outdated
Show resolved
Hide resolved
assert default_version == cr['spec']['defaultVersion'] | ||
assert latest_version == cr['status']['latestVersion'] |
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.
So even if the user doesn't specific a default version, we patch one back to the CR? do we want that behaviour?
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.
yes, at least after the create Operation...or would it make sense to put it in status?
5c88415
to
77bc52a
Compare
LatestVersion *int64 `json:"latestVersion,omitempty"` | ||
// The entity that manages the launch template. | ||
// +kubebuilder:validation:Optional | ||
Operator *OperatorResponse `json:"operator,omitempty"` |
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.
shall we remove it?
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.
👍
39b8a4c
to
f1b371f
Compare
/retest |
Adding support for LaunchTemplate. Co-Authored-By: Rohit Kurdukar - Amazon <[email protected]>
f1b371f
to
d71330d
Compare
/test ec2-kind-e2e |
/retest |
Mmmm ... the test failures seem unrelated to the changes |
/retest |
1 similar comment
/retest |
@michaelhtm: The following test failed, say
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. |
/lgtm |
/lgtm cancel |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: a-hilaly, michaelhtm The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Issue #1841
Description of changes:
Adding support for LaunchTemplate.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.