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

Simplify buildLaunchTemplateTask() part one #11452

Merged
merged 10 commits into from
May 11, 2021

Conversation

johngmyers
Copy link
Member

/kind cleanup

@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 11, 2021
@k8s-ci-robot k8s-ci-robot added the area/provider/aws Issues or PRs related to aws provider label May 11, 2021
Copy link
Member

@hakman hakman left a comment

Choose a reason for hiding this comment

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

One small nit, other than this looks great. Thanks for taking the time to do it.

HTTPPutResponseHopLimit: lc.HTTPPutResponseHopLimit,
Name: fi.String(name),
Lifecycle: b.Lifecycle,
CPUCredits: fi.String(fi.StringValue(ig.Spec.CPUCredits)),
Copy link
Member

Choose a reason for hiding this comment

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

Could we keep this similar to others, without String(StringValue())?

Suggested change
CPUCredits: fi.String(fi.StringValue(ig.Spec.CPUCredits)),
CPUCredits: fi.String(""),

Copy link
Member Author

@johngmyers johngmyers May 11, 2021

Choose a reason for hiding this comment

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

The previous code turns nil into *"". String(StringValue()) is the simplest way to do that. The suggested replacement ignores the value of ig.Spec.CPUCredits.

Copy link
Member

Choose a reason for hiding this comment

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

Meant to add below something like, which may be a little easier to read:

if ig.Spec.CPUCredits != nil {
 	lt.CPUCredits = ig.Spec.CPUCredits
}

Copy link
Member

Choose a reason for hiding this comment

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

Anyway, it's just a nit, if you like it more this way, I am ok with that too.

Copy link
Member Author

Choose a reason for hiding this comment

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

I find splitting the logic into two places and coding it with a verbose if statement to be harder to read, but then I find a lot of idiomatic Go to be annoyingly verbose.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 11, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hakman

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 11, 2021
@johngmyers
Copy link
Member Author

/retest

@k8s-ci-robot k8s-ci-robot merged commit abc6bc0 into kubernetes:master May 11, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.21 milestone May 11, 2021
@johngmyers johngmyers deleted the refactor-lt branch May 11, 2021 18:57
@johngmyers johngmyers modified the milestones: v1.21, v1.22 May 13, 2021
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. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants