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

Get launch template versions after filtering templates #9909

Merged
merged 1 commit into from
Sep 11, 2020

Conversation

johngmyers
Copy link
Member

Should at least partially remediate #9806 by filtering the launch templates before enumerating their versions.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 10, 2020
@k8s-ci-robot k8s-ci-robot added area/provider/aws Issues or PRs related to aws provider approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Sep 10, 2020
@hakman
Copy link
Member

hakman commented Sep 10, 2020

/assign

if strings.HasPrefix(aws.StringValue(x.LaunchTemplateName), prefix) {
err := func() error {
for {
resp, err := cloud.EC2().DescribeLaunchTemplateVersions(&ec2.DescribeLaunchTemplateVersionsInput{
Copy link
Member

Choose a reason for hiding this comment

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

FYI it looks like we could also use DescribeLaunchTemplateVersionsPages - that can be a separate PR though

list = append(list, resp.LaunchTemplateVersions...)
if resp.NextToken == nil {
return nil
if strings.HasPrefix(aws.StringValue(x.LaunchTemplateName), prefix) {
Copy link
Member

Choose a reason for hiding this comment

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

Totally out of scope for this PR, but apparently filters can also support wildcards, e.g. fmt.Sprintf("%s-*", name). I certainly didn't know that - so it wouldn't surprise me if we had multiple places where we could pre-filter by prefix.

Source: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Filtering.html#Filtering_Resources_CLI

@justinsb
Copy link
Member

LGTM - will approve but hold for other reviewers. Feel free to hold cancel after a few hours!

/approve
/lgtm

@justinsb
Copy link
Member

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 10, 2020
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 10, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: johngmyers, justinsb

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:
  • OWNERS [johngmyers,justinsb]

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

@johngmyers
Copy link
Member Author

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 11, 2020
@k8s-ci-robot k8s-ci-robot merged commit 041f774 into kubernetes:master Sep 11, 2020
@k8s-ci-robot k8s-ci-robot added this to the v1.19 milestone Sep 11, 2020
@johngmyers johngmyers deleted the template-filter branch September 11, 2020 04:50
k8s-ci-robot added a commit that referenced this pull request Sep 12, 2020
…09-upstream-release-1.18

Automated cherry pick of #9909: Get launch template versions after filtering templates
k8s-ci-robot added a commit that referenced this pull request Sep 15, 2020
…09-upstream-release-1.17

Automated cherry pick of #9909: Get launch template versions after filtering templates
oded7hoffman pushed a commit to spotinst/kubernetes-kops that referenced this pull request Jan 23, 2023
…ick-of-#9909-upstream-release-1.17

Automated cherry pick of kubernetes#9909: Get launch template versions after filtering templates
oded7hoffman pushed a commit to spotinst/kubernetes-kops that referenced this pull request Jan 23, 2023
…ick-of-#9909-upstream-release-1.17

Automated cherry pick of kubernetes#9909: Get launch template versions after filtering templates
oded7hoffman pushed a commit to spotinst/kubernetes-kops that referenced this pull request Jan 23, 2023
…ick-of-#9909-upstream-release-1.17

Automated cherry pick of kubernetes#9909: Get launch template versions after filtering templates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/provider/aws Issues or PRs related to aws provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants