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 ephemeral storage support to the AdditionalBlockDevices #1696

Merged
merged 3 commits into from
Oct 30, 2023

Conversation

EmilienM
Copy link
Contributor

@EmilienM EmilienM commented Sep 29, 2023

Add ephemeral storage support to the AdditionalBlockDevices

What this PR does / why we need it:

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 #1692

Special notes for your reviewer:

  1. We only support unformated disks for now (we don't expose guestFormat) so the user can handle the filesystem themselves. Note that we initially added it and tested swap but it didn't work in CAPO CI. The field can be added later.
  2. While we support multiple ephemeral disks in this PR, we documented that this is to use at your own risks, this hasn't been well tested in Nova.
  3. API union discriminators aren't used but are here just in case at some point kube api will support it.

TODOs:

  • squashed commits
  • if necessary:
    • includes documentation
    • adds unit tests

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Sep 29, 2023
@netlify
Copy link

netlify bot commented Sep 29, 2023

Deploy Preview for kubernetes-sigs-cluster-api-openstack ready!

Name Link
🔨 Latest commit 71fa48f
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-openstack/deploys/653fa710fc5b48000890eff0
😎 Deploy Preview https://deploy-preview-1696--kubernetes-sigs-cluster-api-openstack.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Sep 29, 2023
@EmilienM EmilienM force-pushed the bd_ephemeral branch 2 times, most recently from 4081b9f to ef93718 Compare September 30, 2023 01:23
api/v1alpha7/types.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 Oct 4, 2023
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Oct 5, 2023
@mandre
Copy link
Contributor

mandre commented Oct 5, 2023

I'll help on this PR as we'd like to get that merge relatively soon. For now, this is just a simple rebase to resolve the conflicts, it obviously needs more work, and I suspect I broke the tests in the process 😅

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 6, 2023
api/v1alpha7/types.go Outdated Show resolved Hide resolved
api/v1alpha7/types.go Outdated Show resolved Hide resolved
@EmilienM EmilienM force-pushed the bd_ephemeral branch 3 times, most recently from 38b304d to 080fa93 Compare October 10, 2023 23:59
@mandre
Copy link
Contributor

mandre commented Oct 11, 2023

/test pull-cluster-api-provider-openstack-e2e-test

@EmilienM EmilienM force-pushed the bd_ephemeral branch 3 times, most recently from 26f74c3 to d425b01 Compare October 12, 2023 15:47
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Oct 12, 2023
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 26, 2023
@EmilienM
Copy link
Contributor Author

I've removed CEL validations from the PR into a separate commit, see commit message for details, please.

@EmilienM
Copy link
Contributor Author

/test pull-cluster-api-provider-openstack-e2e-test

@@ -89,7 +89,6 @@ type OpenStackMachineSpec struct {
// + ---
// + While it's possible to have unlimited number of block devices attached to a server instance, the number is
// + limited to 255 to avoid rule cost exceeded error in CRD validation.
// +kubebuilder:validation:MaxItems=255
Copy link
Contributor Author

Choose a reason for hiding this comment

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

#1736 is an issue that I created so at some point we can re-add CEL.

@mdbooth
Copy link
Contributor

mdbooth commented Oct 27, 2023

The offline CEL discussion was with me, btw. For the record I'm very much in favour of CEL and I'd like to replace all webhook validations that can be implemented with it. My concern is that we should not add CEL without tests because it will inevitably be broken, and this will break folks using a cluster where it's enabled. If we're going to add CEL we need to test it. If we can't test it, we shouldn't add it yet. But we will add it.

Copy link
Contributor

@mdbooth mdbooth left a comment

Choose a reason for hiding this comment

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

Nothing major from me. This is nearly ready to go.

.golangci.yml Show resolved Hide resolved
api/v1alpha7/openstackmachine_types.go Show resolved Hide resolved
api/v1alpha7/openstackmachine_types.go Outdated Show resolved Hide resolved
// contains additional storage options.
// +union
//
//nolint:godot
Copy link
Contributor

Choose a reason for hiding this comment

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

What was godot complaining about?

Copy link
Contributor

Choose a reason for hiding this comment

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

I can help with this. It is complaining about missing dot in the comment above. And this is also the directive that no-unused was complaining about.

// AvailabilityZone is the volume availability zone to create the volume in.
// blockDeviceStorage is the storage type of a block device to create and
// contains additional storage options.
// +union
Copy link
Contributor

Choose a reason for hiding this comment

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

Does +union do anything here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Joel asked me to put it, I don't think it hurts but I also don't think it's functionally useful now in the way things work.


// volume contains additional storage options for a volume block device.
// +optional
// +unionMember,optional
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto.

pkg/cloud/services/compute/instance.go Outdated Show resolved Hide resolved
pkg/cloud/services/compute/instance.go Show resolved Hide resolved
pkg/cloud/services/compute/instance_test.go Outdated Show resolved Hide resolved
pkg/cloud/services/compute/instance.go Outdated Show resolved Hide resolved
@EmilienM EmilienM force-pushed the bd_ephemeral branch 2 times, most recently from 423e91d to c757f37 Compare October 27, 2023 14:25
@EmilienM EmilienM requested a review from mdbooth October 27, 2023 14:26
@@ -62,6 +62,14 @@ func (r *OpenStackMachine) ValidateCreate() (admission.Warnings, error) {
allErrs = append(allErrs, field.Forbidden(field.NewPath("spec", "identityRef", "kind"), "must be a Secret"))
}

if r.Spec.RootVolume != nil && r.Spec.AdditionalBlockDevices != nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this file has no unit tests, but I started to write it and i'll publish via another PR if reviewers don't mind.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally these would be envtests, btw. We could then re-use them to validate CEL.

type BlockDeviceStorage struct {
// type is the type of block device to create.
// This can be either "Volume" or "Local".
// +unionDiscriminator
Copy link
Contributor

Choose a reason for hiding this comment

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

We discussed this. These stay at least for now.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: EmilienM, mdbooth

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 Oct 27, 2023
Copy link
Contributor

@lentzi90 lentzi90 left a comment

Choose a reason for hiding this comment

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

Not sure if I missed it before or if it was changed, but the doc strings should be matching the code also for capitalization. I get that this will then make the yaml description not match the yaml fields but this is the system we currently follow.

api/v1alpha7/openstackmachine_types.go Outdated Show resolved Hide resolved
api/v1alpha7/types.go Outdated Show resolved Hide resolved
api/v1alpha7/types.go Outdated Show resolved Hide resolved
api/v1alpha7/types.go Outdated Show resolved Hide resolved
api/v1alpha7/types.go Outdated Show resolved Hide resolved
api/v1alpha7/types.go Outdated Show resolved Hide resolved
api/v1alpha7/types.go Outdated Show resolved Hide resolved
api/v1alpha7/types.go Outdated Show resolved Hide resolved
api/v1alpha7/types.go Outdated Show resolved Hide resolved
EmilienM and others added 3 commits October 30, 2023 08:52
Co-authored-by: Emilien Macchi <[email protected]>
Co-authored-by: Martin André <[email protected]>
Hitting golangci/golangci-lint#3228 when
adding nolint.

So allow to ignore unused nolints.
I've put that into a separate commit so we can re-add it later.
It also serves as documentation for the work we have done to add CEL.

However and unfortunately, we don't have CEL tests in place now so we
decided to not have CEL validations for now; add them later and then
we'll be able to revert this commit.
Copy link
Contributor

@lentzi90 lentzi90 left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 30, 2023
@lentzi90
Copy link
Contributor

/test pull-cluster-api-provider-openstack-e2e-full-test

@k8s-ci-robot k8s-ci-robot merged commit 5968640 into kubernetes-sigs:main Oct 30, 2023
3 checks passed
@EmilienM EmilienM deleted the bd_ephemeral branch October 30, 2023 14:14
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. 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.

Add ephemeral storage support to the AdditionalBlockDevices
7 participants