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

✨ Add extra root volume options #1498

Merged

Conversation

johnharris85
Copy link

Signed-off-by: John Harris joharris@vmware.com

What this PR does / why we need it:
Allows users to specify additional options for a machine's root volume.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #1403

Notes:

  • If a user wants to specify a KMS key, they need to ensure the relevant user / role has use permissions on the key. Should this be documented somewhere? (if so, where?)
  • If EncryptionKey is set, we set Encrypted to true (even if it was omitted / set to false). Thought this was a reasonable assumption, but open to changes there (error if key set but encrypted missing / false).

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 25, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @johnharris85. Thanks for your PR.

I'm waiting for a kubernetes-sigs 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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 25, 2020
@ncdc
Copy link
Contributor

ncdc commented Jan 27, 2020

/ok-to-test
/assign

@k8s-ci-robot k8s-ci-robot 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 Jan 27, 2020
Copy link
Contributor

@ncdc ncdc left a comment

Choose a reason for hiding this comment

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

Generally LGTM.

/approve

/assign @vincepri

api/v1alpha3/awsmachine_webhook.go Outdated Show resolved Hide resolved
api/v1alpha3/types.go Outdated Show resolved Hide resolved
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: johnharris85, ncdc

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 Jan 27, 2020
@johnharris85
Copy link
Author

/retest

@johnharris85
Copy link
Author

@vincepri pointed out on Slack this should have some restore logic built in to make sure we don't miss these fields from annotations. Will add that and address Andy's comments later today.

@vincepri
Copy link
Member

Sounds good! Holding the PR until we have those in place

/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 Jan 27, 2020
@ncdc ncdc added this to the v0.5.0 milestone Jan 27, 2020
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 31, 2020
api/v1alpha2/awsmachine_conversion.go Outdated Show resolved Hide resolved
api/v1alpha3/types.go Outdated Show resolved Hide resolved
api/v1alpha3/types.go Outdated Show resolved Hide resolved
pkg/cloud/services/ec2/instances.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 1, 2020
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 1, 2020
@johnharris85
Copy link
Author

Addressed most of @vincepri comments (except the size question) and rebased.

@vincepri
Copy link
Member

vincepri commented Feb 3, 2020

@johnharris85 Regarding #1498, I think the only thing I'd add is a kubebuilder validation tag that checks that Size is greater than 0, and remove all the checks where we do .Size != 0.

This makes sure that when a user sets the rootVolume struct, the size field should never be zero, if the struct is not-nil.

Comment on lines +576 to +571
func (s *Service) getImageSnapshotSize(imageID string) (*int64, error) {
input := &ec2.DescribeImagesInput{
ImageIds: []*string{aws.String(imageID)},
}

output, err := s.scope.EC2.DescribeImages(input)
if err != nil {
return nil, err
}

if len(output.Images) == 0 {
return nil, errors.Errorf("no images returned when looking up ID %q", imageID)
}

return output.Images[0].BlockDeviceMappings[0].Ebs.VolumeSize, nil
}

Copy link
Author

Choose a reason for hiding this comment

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

This func is basically identical to the one above (to get the root device name), just returning a different attribute. Thoughts on adjusting the above one (which is only used once) to return size and name to save an AWS call?

Copy link
Member

Choose a reason for hiding this comment

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

+1 to consolidating the calls. This can also be handled as a followup.

Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

/lgtm

@ncdc over to you to un-hold

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 4, 2020
@johnharris85
Copy link
Author

Discussion w/ @vincepri on Slack around how to handle the size wrt defaults / validation -> https://app.slack.com/client/T09NY5SBT/CD6U2V71N/thread/CD6U2V71N-1580776492.150700.

Addressed all comments I think but left a couple questions in for feedback, can squash when ready.

@johnharris85
Copy link
Author

Failure looks like generation out of date, but make verify succeeds on my machine...? (and make generate doesn't generate any changes?) Am I missing something?

@ncdc
Copy link
Contributor

ncdc commented Feb 4, 2020

@johnharris85 try to rebase on top of master

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 4, 2020
@vincepri
Copy link
Member

vincepri commented Feb 4, 2020

api/v1alpha3/awsmachine_webhook_test.go:27: File is not `gofmt`-ed with `-s` (gofmt)
		name       string
api/v1alpha2/awsmachine_conversion_test.go:154: File is not `gofmt`-ed with `-s` (gofmt)
}

@johnharris85 seems linting errors now

@randomvariable
Copy link
Member

Should probably queue this one after #1525 so we get the object fuzzer, and then this will then need rebasing I think.

@johnharris85 johnharris85 force-pushed the expand-disk-options branch 2 times, most recently from 0ca9fe7 to 1f80852 Compare February 7, 2020 19:03
@johnharris85
Copy link
Author

OK rebased now #1525 landed. Fuzzer found a couple bugs which I also fixed.

  • AWSClusterStatus conversion funcs were using the auto conversions for Instance, changed to using the manual ones (with the additional volume options)
  • AWSCluster conversion func needed to restore the bastion if present (from annotation)

@randomvariable
Copy link
Member

/unhold
as we have the restore logic in place.

@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 Feb 10, 2020
@randomvariable
Copy link
Member

Should merge cleanly via 3-way, but merge after #1535

@ncdc
Copy link
Contributor

ncdc commented Feb 10, 2020

@johnharris85 could you please rebase & resolve conflicts - thanks!

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 10, 2020
Signed-off-by: John Harris <joharris@vmware.com>
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 10, 2020
@ncdc ncdc assigned detiber and unassigned ncdc Feb 11, 2020
@detiber
Copy link
Member

detiber commented Feb 11, 2020

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 11, 2020
@k8s-ci-robot k8s-ci-robot merged commit 81e5184 into kubernetes-sigs:master Feb 11, 2020
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. 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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to configure node disks
8 participants